That's actually a clever idea. Why count all the way if you are only interested in first N rows?
I ran a couple of test and window functions with a custom frame definition were faster for big result sets:
count(*) OVER (ROWS BETWEEN CURRENT ROW AND 1001 FOLLOWING) AS total_max_1001
The problem is, you may get a different count for every row, which may or may not be a problem. If you only consider the first row, this works just fine.
Either way, for big result sets, a (uncorrelated) subquery was much faster, yet:
SELECT id
,(SELECT count(*)::int
FROM (SELECT FROM tbl WHERE ... LIMIT 1001) x -- repeat conditions
) AS total_max_1001
FROM tbl
WHERE ...
LIMIT 100;
Tests were in Postgres 9.1. I expect similar results for all versions since 8.4, up to 9.3.
Gives you an exact full count up to 1001 (which may be read as "more than 1000"), but does not count any further. Also works great with indexes. I am going to tune a couple of my own queries with this ...