{"action":"created","issue":{"url":"https://api.github.com/repos/influxdb/influxdb/issues/4192","labels_url":"https://api.github.com/repos/influxdb/influxdb/issues/4192/labels{/name}","comments_url":"https://api.github.com/repos/influxdb/influxdb/issues/4192/comments","events_url":"https://api.github.com/repos/influxdb/influxdb/issues/4192/events","html_url":"https://github.com/influxdb/influxdb/issues/4192","id":107663007,"number":4192,"title":"[0.9.4.1] Optimize LIMIT","user":{"login":"jeremyVignelles","id":3399355,"avatar_url":"https://avatars.githubusercontent.com/u/3399355?v=3","gravatar_id":"","url":"https://api.github.com/users/jeremyVignelles","html_url":"https://github.com/jeremyVignelles","followers_url":"https://api.github.com/users/jeremyVignelles/followers","following_url":"https://api.github.com/users/jeremyVignelles/following{/other_user}","gists_url":"https://api.github.com/users/jeremyVignelles/gists{/gist_id}","starred_url":"https://api.github.com/users/jeremyVignelles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeremyVignelles/subscriptions","organizations_url":"https://api.github.com/users/jeremyVignelles/orgs","repos_url":"https://api.github.com/users/jeremyVignelles/repos","events_url":"https://api.github.com/users/jeremyVignelles/events{/privacy}","received_events_url":"https://api.github.com/users/jeremyVignelles/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/influxdb/influxdb/labels/category/performance","name":"category/performance","color":"006b75"},{"url":"https://api.github.com/repos/influxdb/influxdb/labels/category/queries","name":"category/queries","color":"5319e7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-09-22T07:57:27Z","updated_at":"2015-12-02T19:24:27Z","closed_at":null,"body":"Hi,\r\nAs the points stored in the database increase, the query\r\n```SELECT * FROM measurement LIMIT 1```\r\nis getting longer and longer. Is it possible to optimize this, since we told the interpreter that we are interested in only one point.\r\n\r\nThe idea behind this is to make queries like\r\n```SELECT * FROM measurement GROUP BY tag ORDER BY time DESC LIMIT 1```\r\nto get the last value for each tag."},"comment":{"url":"https://api.github.com/repos/influxdb/influxdb/issues/comments/161405517","html_url":"https://github.com/influxdb/influxdb/issues/4192#issuecomment-161405517","issue_url":"https://api.github.com/repos/influxdb/influxdb/issues/4192","id":161405517,"user":{"login":"beckettsean","id":6537329,"avatar_url":"https://avatars.githubusercontent.com/u/6537329?v=3","gravatar_id":"","url":"https://api.github.com/users/beckettsean","html_url":"https://github.com/beckettsean","followers_url":"https://api.github.com/users/beckettsean/followers","following_url":"https://api.github.com/users/beckettsean/following{/other_user}","gists_url":"https://api.github.com/users/beckettsean/gists{/gist_id}","starred_url":"https://api.github.com/users/beckettsean/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beckettsean/subscriptions","organizations_url":"https://api.github.com/users/beckettsean/orgs","repos_url":"https://api.github.com/users/beckettsean/repos","events_url":"https://api.github.com/users/beckettsean/events{/privacy}","received_events_url":"https://api.github.com/users/beckettsean/received_events","type":"User","site_admin":false},"created_at":"2015-12-02T19:24:27Z","updated_at":"2015-12-02T19:24:27Z","body":"@benbjohnson is this something you are also looking into as part of the query engine refactoring? It does appear that `SELECT * FROM foo` and `SELECT * FROM foo LIMIT 1` are equivalently expensive queries, which doesn't make sense. It seems that each node should only return one point for this query, and the `ORDER BY` clause would determine if it should be the first or last point in the time range. \r\n\r\n@toddboom "}}