From: Glenn Sullivan <glenn.sullivan@varianinc.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-performance@postgresql.org
Subject: Re: Performance of ORDER BY
Date: Tue, 05 Dec 2006 13:42:56 -0700
Message-ID: <4575D9D0.5010206@varianinc.com> (raw)
In-Reply-To: <7090.1165341726@sss.pgh.pa.us>
References: <4575A863.6040504@varianinc.com>
<7090.1165341726@sss.pgh.pa.us>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Thanks to Luke and Tom for the input. I guess this was good timing
given that it looks like<br>
8.2 was just released today. I will upgade to that before doing
anything else.<br>
<br>
Glenn<br>
<br>
Tom Lane wrote:
<blockquote cite="mid7090.1165341726@sss.pgh.pa.us" type="cite">
<pre wrap="">Glenn Sullivan <a class="moz-txt-link-rfc2396E" href="mailto:glenn.sullivan@varianinc.com"><glenn.sullivan@varianinc.com></a> writes:
</pre>
<blockquote type="cite">
<pre wrap="">I am wanting some ideas about improving the performance of ORDER BY in
our use. I have a DB on the order of 500,000 rows and 50 columns.
The results are always sorted with ORDER BY. Sometimes, the users end up
with a search that matches most of the rows. In that case, I have a
LIMIT 5000 to keep the returned results under control. However, the
sorting seems to take 10-60 sec. If I do the same search without the
ORDER BY, it takes about a second.
</pre>
</blockquote>
<pre wrap=""><!---->
Does the ORDER BY match an index? If so, is it using the index?
(See EXPLAIN.)
</pre>
<blockquote type="cite">
<pre wrap="">I am currently on version 8.0.1 on Windows XP using a Dell Optiplex 280
with 1Gb of ram. I have set sort_mem=100000 set.
</pre>
</blockquote>
<pre wrap=""><!---->
In 8.0 that might be counterproductively high --- we have seen cases
where more sort_mem = slower with the older sorting code. I concur
with Luke's advice that you should update to 8.2 (not 8.1) to get the
improved sorting code.
regards, tom lane
</pre>
</blockquote>
</body>
</html>
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: glenn.sullivan@varianinc.com, tgl@sss.pgh.pa.us
Subject: Re: Performance of ORDER BY
In-Reply-To: <4575D9D0.5010206@varianinc.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