Re: Chaotically weird execution plan

От: Tom Lane
Тема: Re: Chaotically weird execution plan
Дата: ,
Msg-id: 17587.1222225090@sss.pgh.pa.us
(см: обсуждение, исходный текст)
Ответ на: Chaotically weird execution plan  (Einars)
Ответы: Re: Chaotically weird execution plan  ("Scott Carey")
Список: pgsql-performance

Скрыть дерево обсуждения

Chaotically weird execution plan  (Einars, )
 Re: Chaotically weird execution plan  (Craig Ringer, )
  Re: Chaotically weird execution plan  (Tom Lane, )
   Re: Chaotically weird execution plan  (Craig Ringer, )
 Re: Chaotically weird execution plan  (Tom Lane, )
  Re: Chaotically weird execution plan  ("Scott Carey", )

Einars <> writes:
> When displaying information about information about an user in our
> site, I noticed an unreasonable slowdown. The culprit turned out to be
> a trivial select, which determines the number of comments left by an
> user:

I don't see anything even slightly wrong here.  Your first example pulls
15888 rows from the table in 13134 ms.  Your second example pulls 3
rows from the table in 0.121 ms --- which I rather imagine is because
those three rows are already in cache; it would take a lot longer if it
actually had to go to disk several times.

The planner's rowcount estimates are on target and it appears to be
choosing appropriate plans in each case.  It just takes longer to
process 5000 times as many rows ...

            regards, tom lane


В списке pgsql-performance по дате сообщения:

От: "Sabin Coanda"
Дата:
Сообщение: Re: Different execution plan
От: "Sabin Coanda"
Дата:
Сообщение: Re: Different execution plan