Re: make query faster?? - Mailing list pgsql-sql

From Stephan Szabo
Subject Re: make query faster??
Date
Msg-id 20011204131843.I6514-100000@megazone23.bigpanda.com
Whole thread Raw
In response to make query faster??  (DI Hasenöhrl <i.hasenoehrl@aon.at>)
List pgsql-sql
On Tue, 4 Dec 2001, [iso-8859-1] DI Hasen�hrl wrote:

> I've a simple query, but when I use *ORDER BY* it takes a long time
> till I can see the result.
>
> a_nr is varchar(20) and the primary key of my table artikel.
>
> Please, can someone give me a hint, how to improve my query.

If you have not yet done so, you may want to increase sort_mem in your
postgresql.conf assuming you have sufficient memory in your machine
(and shared_buffers while you're at it). The defaults are fairly low and
you may see a performance gain in general if you raise them to amounts
more reasonable for your machine.

> In Bruce Momjian's book I read, that indexes are usually not used for
> ORDER BY operations: a sequential scan followed by an explicit sort is
> fatser than an indexscan.
>
> What's an explicit sort????????

Actually sorting the results of the sequence scan rather than using the
fact that the index keys can be gotten in sorted order to get the rows
in order.



pgsql-sql by date:

Previous
From: DI Hasenöhrl
Date:
Subject: make query faster??
Next
From: "Jeff Barrett"
Date:
Subject: Memory exhausted in AllocSetAlloc(269039)