nice stuff (the whole presentation, full of stuff i did not know), thanks.
of course, a question...
the bit that reads:
If you know the maximum value of an integer column and have an index on
it:
SELECT COUNT(*) FROM t2 WHERE c2 100;
made me think that the above would do an index
i need to get a row count on a large table. it appears that
select count(*) from table;
always does a table scan, whether i have an index or not, and that is too
slow.
so i found this:
select reltuples from pg_class where relname = 'table';
this is nice and fast, but not all that accurate
[EMAIL PROTECTED] writes:
so, i am wondering if analyze also does a table scan,
It does not --- it does a statistical sampling, and it's quite possible
that the estimate will be badly off.
regards, tom lane
---(end of
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
i need to get a row count on a large table. it appears that
select count(*) from table;
always does a table scan, whether i have an index or not, and that is too
slow.
http://www.gtsm.com/oscon2003/findrows.html
- --
Greg Sabino Mullane