influxdb/influxdb — pull request #821 by toddboom (2014-10-26 04:47:10+00:00)
Title: Investigate possible performance bug with limit 1 queries with where clause

This blog post: http://www.ryandaigle.com/a/time-series-db-design-with-influx mentions getting a performance increase on a query like this:
```sql
select value
from gateway.account.sample
where account_key = 'abc123'
limit 1

-- and this gives same result, but much better performance
select value
from gateway.account.sample
where time > now() - 2d
and account_key = 'abc123'
limit 1
```
This is on a series that has hundreds of thousands of points. This looks to me like the range scan is still going through after the limit has already been hit.

We need to look into this and ensure that once the limit is hit, the scan stops.