of the conversation. breaks the flow because it toppost Please don't At 1:17p -0400 on 01 Jun 2007, Tyler Durden wrote:
Yes, either case happens the same. I'm come recently from MySQL and it works in a different way. I find strange that a simple SELECT COUNT(...) is so slow with only 700 000 records. Has been a nightmare optimizing this tables/queries. Sorry about this silly question, but I'm new to Posgresql.
The much more knowledgable will correct me, but the abbr. version is that it is for data integrity and correctness reasons and the inherent way in which the MVCC model works. If it's any condolence, I believe that Oracle also suffers with this particular query, but I haven't seen any benchmarks to prove that (I think because Oracle expressly forbids benchmarks and comparisons in their license, but don't quote me on that).
For a complete discussion, go this page and look for the thread with the subject 'Performance of count(*)'
http://archives.postgresql.org/pgsql-performance/2007-03/threads.php I believe that may help. Kevin