Re: SORT performance - slow?

From: Tomas Vondra <tv(at)fuzzy(dot)cz>
To: pgsql-performance(at)postgresql(dot)org
Subject: Re: SORT performance - slow?
Date: 2011-05-23 17:56:59
Message-ID: 4DDA9FEB.7020001@fuzzy.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Dne 23.5.2011 19:01, Maciek Sakrejda napsal(a):
>> You're probably reading it wrong. The sort itself takes about 1 ms (just
>> subtract the numbers in "actual=").
>
> I thought it was cost=startup_cost..total_cost. That is not quite the
> same thing, since startup_cost is effectively "cost to produce first
> row", and Sort can't really operate in a "streaming" fashion (well,
> theoretically, something like selection sort could, but that's beside
> the point) so it needs to do all the work up front. I'm no explain
> expert, so someone please correct me if I'm wrong.

Good point, thanks. In that case the second number (2.3 sec) is correct.

I still think the problem is not the sorting but the inaccurate
estimates - fixing this might yield a much better / faster plan. But the
OP posted just a small part of the plan, so it's hard to guess.

regards
Tomas

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Tomas Vondra 2011-05-23 18:46:39 Re: Performance degradation of inserts when database size grows
Previous Message Robert Haas 2011-05-23 17:27:13 Re: SORT performance - slow?