From: Tomas Vondra <tv@fuzzy.cz>
To: pgsql-performance@postgresql.org
Subject: Re: SORT performance - slow?
Date: Mon, 23 May 2011 19:56:59 +0200
Message-ID: <4DDA9FEB.7020001@fuzzy.cz> (raw)
In-Reply-To: <BANLkTi=g+xaY_2cWqPCBS5=aKdHtfOWsVw@mail.gmail.com>
References: <EF37296944B47C40ADDCCB7BFD6289FE04ECC9CA3F@EMASC201VS01.exchad.jpmchase.net>
<4DD9982C.6000807@fuzzy.cz>
<BANLkTi=g+xaY_2cWqPCBS5=aKdHtfOWsVw@mail.gmail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: tv@fuzzy.cz
Subject: Re: SORT performance - slow?
In-Reply-To: <4DDA9FEB.7020001@fuzzy.cz>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox