Hi.'select count(id)'
I have a table with 24k records and btree index on column 'id'. Is this normal, that 'select max(id)' or 'select count(id)' causes a sequential scan? It takes over 24 seconds (on a pretty fast machine):
Yes, this is normal. Because of MVCC all rows must be checked and Postgres doesn't cache count(*) like Mysql.
'select max(id)' This is also normal, but try to change this query into: select id from some_table order by id desc limit 1;
What is your Postgresql version?
Regards, Tomasz Myrta
---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly