Nested Loop join being improperly chosen

From: Brad Ediger <brad(at)bradediger(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: Nested Loop join being improperly chosen
Date: 2008-08-22 15:26:28
Message-ID: D51F400E-CA0D-45A0-825A-40C5240CD230@bradediger.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hello,
I'm having trouble with a Nested Loop being selected for a rather
complex query; it turns out this is a pretty bad plan as the nested
loop's row estimates are quite off (1 estimated / 1207881 actual). If
I disable enable_nestloop, the query executes much faster (42 seconds
instead of 605). The tables in the query have all been ANALYZEd just
before generating these plans.

Here are the plans with and without enable_nestloop:

http://pastie.org/258043

The inventory table is huge; it currently has about 1.3 x 10^9 tuples.
The items table has around 10,000 tuples, and the other tables in the
query are tiny.

Any ideas or suggestions would be greatly appreciated. Thanks!
--
Brad Ediger

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message André Volpato 2008-08-22 17:05:32 Re: Postgres not using array
Previous Message Jan Otto 2008-08-22 14:37:59 Re: The state of PG replication in 2008/Q2?