From: Richard Huxton <dev@archonet.com>
To: Joel Fradkin <jfradkin@wazagua.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Sorry I see my first question did not get posted (maybe
Date: Wed, 26 Jan 2005 08:50:21 +0000
Message-ID: <41F759CD.80709@archonet.com> (raw)
In-Reply-To: <000e01c5035a$b989c140$797ba8c0@jfradkin>
References: <000e01c5035a$b989c140$797ba8c0@jfradkin>
Joel Fradkin wrote:
> Basically the question was why would a view use an indexed search on one
> result set but a seq search on a larger result set. Same view only
> difference is how many rows are returned. The large result set was doing a
> seq search and did not return after several minutes. The same sql ran in 135
> seconds on my MSSQL system.
Accessing an index 1000 times then reading 1000 rows may be slower than
just reading a whole table of 2000 rows.
You can examine what PostgreSQL thinks the query will cost by running an
explain: EXPLAIN ANALYSE SELECT ...
This will display two sets of figures for each stage, the expected costs
and the actual.
Finally, make sure your configuration settings are reasonable. Read
through the guide at:
http://www.varlena.com/varlena/GeneralBits/Tidbits/index.php
There's a -performance list that specialises in dealing with these
issues. If you post there, mention you've tuned as per GeneralBits and
provide an example of the query, view definition and the output from
explain.
--
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-sql@postgresql.org
Cc: dev@archonet.com, jfradkin@wazagua.com
Subject: Re: Sorry I see my first question did not get posted (maybe
In-Reply-To: <41F759CD.80709@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