| От | Bruno Wolff III |
|---|---|
| Тема | Re: count(*) slow on large tables |
| Дата | |
| Msg-id | 20031002193905.GD18417@wolff.to обсуждение исходный текст |
| Ответ на | count(*) slow on large tables (Dror Matalon <dror@zapatec.com>) |
| Список | pgsql-performance |
On Thu, Oct 02, 2003 at 12:15:47 -0700, Dror Matalon <dror@zapatec.com> wrote: > Hi, > > I have a somewhat large table, 3 million rows, 1 Gig on disk, and growing. Doing a > count(*) takes around 40 seconds. > > Looks like the count(*) fetches the table from disk and goes through it. > Made me wonder, why the optimizer doesn't just choose the smallest index > which in my case is around 60 Megs and goes through it, which it could > do in a fraction of the time. Because it can't tell from the index if a tuple is visible to the current transaction and would still have to hit the table to check this. So that performance would be a lot worse instead of better.
В списке pgsql-performance по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера