Re: Anything I can do to speed up this query? - Mailing list pgsql-general

From Ragnar
Subject Re: Anything I can do to speed up this query?
Date
Msg-id 1165358111.24477.68.camel@localhost.localdomain
Whole thread Raw
In response to Anything I can do to speed up this query?  (Wei Weng <wweng@kencast.com>)
List pgsql-general
On þri, 2006-12-05 at 15:56 -0500, Wei Weng wrote:
> I have a table that has roughly 200,000 entries and many columns.
>
> SELECT Field1, Field2, Field3... FieldN FROM TargetTable;

> The thing is on this machine with 1Gig Ram, the above query still takes
> about 20 seconds to finish. And I need it to run faster, ideally around
> 5 seconds.

> Test=> show shared_buffers ;
>  shared_buffers
> ----------------
>  60800

do you mean that you want the data to be cached, or do you need it to be
fast the first time?
if you want it to be cached you might be better served
with a lower shared buffers, to leave more memory tothe OS cache.

If you just need more speed reading from the disks,
you probably just need a faster disk subsystem, although
should should make sure the table does not contain
a lot of dead rows, by doing a VACUUM FULL or a CLUSTER
once before trying again.

If Field1, Field2 ... FieldN are a small subset of the
tables row-width, you should consider vertical
partitioning, to minimize IO needed for this particular
query, although this will not help much if the subset is
not fixed.

gnari



pgsql-general by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: Row-based authorization
Next
From: "Mike G"
Date:
Subject: Re: Speed of postgres compared to ms sql, is this