Re: explain analyse and nested loop joins

From: Oliver Kohll - Mailing Lists <oliver(dot)lists(at)gtwm(dot)co(dot)uk>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: explain analyse and nested loop joins
Date: 2011-11-07 09:47:26
Message-ID: 5B34B39C-85BF-4D33-8BC4-3D29ADB8A485@gtwm.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks,

It does look like an incorrect prediction. Looking again, I think it's the row estimate for the join that's out - the planner estimates one row returned, in which case a nested join would probably make sense, whereas in fact there are 23.

However it's a generated (user created) query, so I think what I might do is get the application to detect this case from the query plan where there is a slow query and automatically test turning off nested joins. I'll just have to keep an eye on it to see if it becomes unnecessary in future PG versions.

Regards
Oliver
www.agilebase.co.uk

On 6 Nov 2011, at 04:17, Pavel Stehule wrote:

> Hello
>
> Propably there are a dependency between following columns - and then a
> prediction is not correct.
>
> Try to move one less selective to OUTER SELECT
>
> SELECT * FROM (SELECT your query OFFSET 0) x WHERE x.invoiced = false
>
> Regards
>
> Pavel Stehule
>
> 2011/11/5 Oliver Kohll - Mailing Lists <oliver(dot)lists(at)gtwm(dot)co(dot)uk>:
>> b2deliveryorders.complete = false AND b2deliveryorders.invoiced = false

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2011-11-07 14:28:46 Re: PostgreSQL references in the Middle East
Previous Message Craig Ringer 2011-11-07 05:46:00 Re: Linker error VS2008 c++