Re: [PHP3] [OT]: SELECT COUNT(*) in Postgres
Re: [PHP3] [OT]: SELECT COUNT(*) in Postgres
От:
Clark Evans <clark.evans@manhattanproject.com>
Дата:
It seems that one topic of discussion regarding the optimizer is that it dosen't know how many rows are in the table untill an analyze is done. Doing SELECT COUNT(*) seems like something often done that also requires the number of rows in the table to be known. Perhaps it would be prudent to keep a running total of the number of active rows for each table cashed? Clark Jordan Krushen wrote: > I know that MySQL doesn't actually hit the tables when doing a SELECT > COUNT(*), and it returns very quickly as a result.. On large Postgres > tables, COUNT(*) is horrendously slow. What I'm wondering is if anybody > here knows a faster way to get the row count, be it an internal Postgres > variable one can access, or if a COUNT(small_primary_key) would be faster. > Any ideas? >