From: Josh Berkus <josh@agliodbs.com>
To: Ron Mayer <rm_pg@cheapcomplexdevices.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: half the query time in an unnecessary(?) sort?
Date: Mon, 25 Apr 2005 15:11:41 -0700
Message-ID: <200504251511.41949.josh@agliodbs.com> (raw)
In-Reply-To: <426D4FA1.1050000@cheapcomplexdevices.com>
References: <426D4FA1.1050000@cheapcomplexdevices.com>
Ron,
> If I have a freshly CLUSTERed table and queries that want to do a
> merge join, it seems to me that quite a bit of time is spent
> unnecessarily sorting the already-sorted table. An example such
> query I found in my log files is shown below. If I read the
> EXPLAIN ANALYZE output correctly, it's saying that roughly half
> the time (570-269 = 300 out of 670 ms) was spent sorting the
> already sorted data.
It still has to sort because the clustering isn't guarenteed to be 100%.
However, such sorts should be very quick as they have little work to do.
Looking at your analyze, though, I think it's not the sort that's taking the
time as it is that the full sorted entity_id column won't fit in work_mem.
Try increasing it?
--
--Josh
Josh Berkus
Aglio Database Solutions
San Francisco
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: josh@agliodbs.com, rm_pg@cheapcomplexdevices.com
Subject: Re: half the query time in an unnecessary(?) sort?
In-Reply-To: <200504251511.41949.josh@agliodbs.com>
* 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