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.