From: Franck Routier <franck.routier@axege.com>
To: pgsql-performance@postgresql.org
Subject: Is disableing nested_loops a bad idea ?
Date: Thu, 16 Sep 2010 10:23:47 +0200
Message-ID: <1284625427.2527.13.camel@franck-laptop> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: franck.routier@axege.com
Subject: Re: Is disableing nested_loops a bad idea ?
In-Reply-To: <1284625427.2527.13.camel@franck-laptop>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox