Skip site navigation (1) Skip section navigation (2)

Re: Merge Join vs Nested Loop

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Tobias Brox <tobias(at)nordicbet(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Merge Join vs Nested Loop
Date: 2006-09-26 22:09:56
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
Tobias Brox <tobias(at)nordicbet(dot)com> writes:
> What causes the nested loops to be estimated so costly - or is it the
> merge joins that are estimated too cheaply?  Should I raise all the
> planner cost constants, or only one of them?

If your tables are small enough to fit (mostly) in memory, then the
planner tends to overestimate the cost of a nestloop because it fails to
account for cacheing effects across multiple scans of the inner table.
This is addressed in 8.2, but in earlier versions about all you can do
is reduce random_page_cost, and a sane setting of that (ie not less than
1.0) may not be enough to push the cost estimates where you want them.
Still, reducing random_page_cost ought to be your first recourse.

			regards, tom lane

In response to


pgsql-performance by date

Next:From: Bucky JordanDate: 2006-09-26 22:14:07
Subject: Re: Decreasing BLKSZ
Previous:From: Marc MorinDate: 2006-09-26 21:36:04
Subject: Re: Decreasing BLKSZ

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group