Re: [HACKERS] Much Ado About COUNT(*)

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: [HACKERS] Much Ado About COUNT(*)
Дата
Msg-id 87d5w8udrw.fsf@stark.xeocode.com
обсуждение исходный текст
Ответ на Re: [HACKERS] Much Ado About COUNT(*)  (Wes <wespvp@syntegra.com>)
Список pgsql-general
Wes <wespvp@syntegra.com> writes:

> On 1/13/05 6:44 PM, "Greg Stark" <gsstark@mit.edu> wrote:
>
> > That's simply false. Oracle does indeed have to count the records one by one.

> Ok, I stand corrected - I was given some wrong information.  However, my
> experience has been that count(*) on Oracle is a whole lot faster than
> PostgreSQL - what appeared instantaneous on Oracle took some time on
> PostgreSQL.  That was one of the first things I noticed when moving a
> database application to PostgreSQL.  I've since disposed of the Oracle
> database, so can't go back and retest.

If it was instantaneous then the data must have all been in cache. A lot of
Oracle kudos really come down to the fact that Oracle is often run on beefier
machines than others.

But if it was merely 2x as fast or so, more if the table was really wide, then
it could have just been because of the fast index-only scan.

If it was more than 2-4x as fast for a narrow table and you don't think the
whole thing was in cache then I would start to wonder about whether your
postgres table suffered from bloat from not having vacuum run frequently
enough or having the fsm settings too low.

--
greg

В списке pgsql-general по дате отправления:

Предыдущее
От: Wes
Дата:
Сообщение: Re: [HACKERS] Much Ado About COUNT(*)
Следующее
От: "Frank D. Engel, Jr."
Дата:
Сообщение: Re: [HACKERS] Much Ado About COUNT(*)