Re: Database slowness -- my design, hardware, or both? - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: Database slowness -- my design, hardware, or both?
Date
Msg-id 20070306201939.GH12837@alvh.no-ip.org
Whole thread Raw
In response to Re: Database slowness -- my design, hardware, or both?  ("Reuven M. Lerner" <reuven@lerner.co.il>)
Responses Re: Database slowness -- my design, hardware, or both?
List pgsql-general
Reuven M. Lerner escribió:
> Hi, Webb Sprague.  You wrote:
> >... but I see two seq scans in your explain in a loop -- this is
> >probably not good.  If you can find a way to rewrite the IN clause
> >(either de-normalizing through triggers to save whatever you need on
> >an insert and not have to deal with a set, or by using except in the
> >query, or someing else more creative)...
> I would normally agree that an IN clause is a place to worry -- except
> that I'm using IN on a very small table, with about 4-5 rows.  That
> might indeed affect things, and I could certainly pull out these values
> into a Perl variable that I then interpolate literally into the SQL.
> However, I have to assume that this wouldn't affect things all that much.

Don't assume -- measure.  I had a query which ran orders of magnitude
faster because I interpolated the constant list in the big query.  The
table from which the interpolated values were being extracted had about
30 rows or so.

--
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

pgsql-general by date:

Previous
From: Alexander Elgert
Date:
Subject: postgres slower on nested queries
Next
From: Richard Huxton
Date:
Subject: Re: postgres slower on nested queries