From: Richard Huxton <dev@archonet.com>
To: Charlie Savage <cfis@interserv.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Sort performance on large tables
Date: Tue, 08 Nov 2005 11:14:41 +0000
Message-ID: <437088A1.8090304@archonet.com> (raw)
In-Reply-To: <43704E1D.80708@interserv.com>
References: <43704E1D.80708@interserv.com>
Charlie Savage wrote:
> Hi everyone,
>
> I have a question about the performance of sort.
> Note it takes over 10 times longer to do the sort than the full
> sequential scan.
>
> Should I expect results like this? I realize that the computer is quite
> low-end and is very IO bound for this query, but I'm still surprised
> that the sort operation takes so long.
The sort will be spilling to disk, which will grind your I/O to a halt.
> work_mem = 16384 # in Kb
Try upping this. You should be able to issue "set work_mem = 100000"
before running your query IIRC. That should let PG do its sorting in
larger chunks.
Also, if your most common access pattern is ordered via tlid look into
clustering the table on that.
--
Richard Huxton
Archonet Ltd
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: dev@archonet.com, cfis@interserv.com
Subject: Re: Sort performance on large tables
In-Reply-To: <437088A1.8090304@archonet.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