counting rows
От | pgboy@guthrie.charm.net |
---|---|
Тема | counting rows |
Дата | |
Msg-id | Pine.LNX.4.50.0308060920070.7263-100000@guthrie.charm.net обсуждение исходный текст |
Ответы |
Re: counting rows
Re: counting rows |
Список | pgsql-admin |
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 at any given time. but, i *did* notice that it is pretty accurate if i run analyze just before. so, i am wondering if analyze also does a table scan, in which case i am back to where i started. it *seems* to run fairly quickly, even on a large table, but i am just wall-clocking all of this. or any other ideas on counting rows are welcome. thanks. pg
В списке pgsql-admin по дате отправления: