Is disableing nested_loops a bad idea ? - Mailing list pgsql-performance

From Franck Routier
Subject Is disableing nested_loops a bad idea ?
Date
Msg-id 1284625427.2527.13.camel@franck-laptop
Whole thread Raw
Responses Re: Is disableing nested_loops a bad idea ?
Re: Is disableing nested_loops a bad idea ?
List pgsql-performance
Hi,

I am confronted with a use case where my database mainly does big
aggregate select (ROLAP), a bunch of batch jobs, and quite few OLTP.

I come into cases where the planner under-estimates the number of rows
in some relations, chooses to go for nested loops, and takes forever to
complete the request. (Notice as the side note that Oracle (10g or 11g)
is not any better on this workload and will sometime go crazy and choose
a plan that takes hours...)

I've played with statistics, vacuum and so on, but at the end the
planner is not accurate enough when evaluating the number of rows in
some complex queries.

Disableing nested loops most of the time solves the performance issues
in my tests... generally going from 30 sec. down to 1 sec.

So my question is : would it be a very bad idea to disable nested loops
in production ?
The way I see it is that it could be a little bit less optimal to use
merge join or hash join when joining on a few rows, but this is peanuts
compared to how bad it is to use nested loops when the number of rows
happens to be much higher than what the planner thinks.

Is this stupid, ie are there cases when merge join or hash join are much
slower than nested loops on a few rows ?

Thanks in advance,

Franck




pgsql-performance by date:

Previous
From: Greg Smith
Date:
Subject: Re: locking issue on simple selects?
Next
From: Samuel Gendler
Date:
Subject: Re: Is disableing nested_loops a bad idea ?