Typically, you should replace your list of columns with count(*) to return the number of rows.
I'm not sure how well this works on really complex queries with many joins and such, but for simpler queries, everything should be fine. Replace:
select a,b,c from t where a > 7;
with
select count(*) from t where a > 7;
This will give you a row counter before running a real query. Just keep in mind that there is a chance that the data may change between your account request and the actual request (hopefully not too much). Knowing the properties of the data will allow you to approach kilobytes from the number of lines.
source share