Re: SORT performance - slow? - Mailing list pgsql-performance

From Tomas Vondra
Subject Re: SORT performance - slow?
Date
Msg-id 4DDA9FEB.7020001@fuzzy.cz
Whole thread Raw
In response to Re: SORT performance - slow?  (Maciek Sakrejda <msakrejda@truviso.com>)
List 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

pgsql-performance by date:

Previous
From: Robert Haas
Date:
Subject: Re: SORT performance - slow?
Next
From: Nick Raj
Date:
Subject: Logfile