Ramifications of turning off Nested Loops for slow queries

From: Chris Kratz <chris(dot)kratz(at)vistashare(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Ramifications of turning off Nested Loops for slow queries
Date: 2008-03-04 14:42:49
Message-ID: 483ACAF5-A485-40D9-9D7E-7008EF12F909@vistashare.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hello Everyone,

I had posted an issue previously that we've been unable to resolve.
An early mis-estimation in one or more subqueries causes the remainder
of the query to choose nested loops instead of a more efficient method
and runs very slowly (CPU Bound). I don't think there is any way to
"suggest" to the planner it not do what it's doing, so we are starting
to think about turning off nested loops entirely.

Here is the history so far:

http://archives.postgresql.org/pgsql-performance/2008-02/msg00205.php

At the suggestion of the list, we upgraded to 8.2.6 and are still
experiencing the same problem. I'm now installing 8.3 on my
workstation to see if it chooses a better plan, but it will take some
time to get it compiled, a db loaded, etc.

We have a number of very long running reports that will run in seconds
if nested loops are turned off. The other alternative we are
exploring is programmatically turning off nested loops just for the
problematic reports. But with the speedups we are seeing, others are
getting gun shy about having them on at all.

So, I've now been asked to ping the list as to whether turning off
nested loops system wide is a bad idea, and why or why not.

Any other thoughts or suggestions?

Thanks,

-Chris

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Shane Ambler 2008-03-04 15:04:32 Re: How to allocate 8 disks
Previous Message Matthew 2008-03-04 14:14:33 Re: Performance tuning on FreeBSD