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 -- Sent via pgsql-performance mailing list (pgsql-performance@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance