From: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
---|---|
To: | "Reuven M(dot) Lerner" <reuven(at)lerner(dot)co(dot)il> |
Cc: | Webb Sprague <webb(dot)sprague(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Database slowness -- my design, hardware, or both? |
Date: | 2007-03-06 20:19:39 |
Message-ID: | 20070306201939.GH12837@alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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.
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Huxton | 2007-03-06 20:25:34 | Re: postgres slower on nested queries |
Previous Message | Nik | 2007-03-06 20:19:28 | Re: No buffer space available |