Querying large datasets take up large amount of memory

`select count(value) some_series` on a series with many points takes up a huge amount of memory. Shouldn't be the case...