Re: So, is COUNT(*) fast now?
| От | Tom Lane |
|---|---|
| Тема | Re: So, is COUNT(*) fast now? |
| Дата | |
| Msg-id | 25287.1319217499@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | So, is COUNT(*) fast now? (Robert Haas <robertmhaas@gmail.com>) |
| Ответы |
Re: So, is COUNT(*) fast now?
|
| Список | pgsql-hackers |
Robert Haas <robertmhaas@gmail.com> writes:
> That's a bit disappointing - it's now more than a third faster to do
> the sequential scan, even though the sequential scan has to touch six
> times as many blocks (at scale factor 20, index is 43 MB, table is 256
> MB) all of which are in cache. Of course, touching that many fewer
> blocks does have some advantages if there is concurrent activity on
> the system, but it still seems unfortunate that the ratio of runtime
> to blocks touched is more than 8x higher for the index-only case.
I don't know why you'd imagine that touching an index is free, or even
cheap, CPU-wise. The whole point of the index-only optimization is to
avoid I/O. When you try it on a case where there's no I/O to be saved,
*and* no shared-buffers contention to be avoided, there's no way it's
going to be a win.
regards, tom lane
В списке pgsql-hackers по дате отправления: