pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gauri Kanekar <meetgaurikanekar@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-performance@postgresql.org
Subject: Re: Cross Join Problem
Date: Tue, 19 Aug 2008 19:04:17 +0530
Message-ID: <7e4ba9550808190634q123274ffgca0f7a26df822ee9@mail.gmail.com> (raw)
In-Reply-To: <28902.1219072800@sss.pgh.pa.us>
References: <7e4ba9550808180637v382ce149sf0577849b03d955@mail.gmail.com>
	<18370.1219068149@sss.pgh.pa.us>
	<7e4ba9550808180706l4f595729h102cbc2bb3e1bfa@mail.gmail.com>
	<28902.1219072800@sss.pgh.pa.us>

Thanx alot... its solved my problem

On Mon, Aug 18, 2008 at 8:50 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:

> [ please keep the list cc'd for the archives' sake ]
>
> "Gauri Kanekar" <meetgaurikanekar@gmail.com> writes:
> > On Mon, Aug 18, 2008 at 7:32 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> >> No PG release since 7.3 would have voluntarily planned that query that
> >> way.  Maybe you were using join_collapse_limit = 1 to force the join
> >> order?
>
> > Yes, We have set join_collapse_limit set to 1.
>
> Ah, so really your question is why join_collapse_limit isn't working as
> you expect.  That code changed quite a bit in 8.2, and the way it works
> now is that the critical decision occurs while deciding whether to fold
> the cross-join (a sub-problem of size 2) into the top-level join
> problem.  Which is a decision that's going to be driven by
> from_collapse_limit not join_collapse_limit.
>
> So one way you could make it work is to reduce from_collapse_limit to
> less than 3, but I suspect you'd find that that has too many bad
> consequences for other queries.  What's probably best is to write the
> problem query like this:
>
>        FROM table1 a cross join ( table2 b cross join table3 c )
>
> which will cause join_collapse_limit to be the relevant number at both
> steps.
>
>                        regards, tom lane
>



-- 
Regards
Gauri

view thread (4+ messages)

Message-ID: <7e4ba9550808190634q123274ffgca0f7a26df822ee9@mail.gmail.com>
Permalink:  ../7e4ba9550808190634q123274ffgca0f7a26df822ee9@mail.gmail.com/
Also on:    postgresql.org/message-id/7e4ba9550808190634q123274ffgca0f7a26df822ee9@mail.gmail.com

 · 

reply

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: meetgaurikanekar@gmail.com, tgl@sss.pgh.pa.us
  Subject: Re: Cross Join Problem
  In-Reply-To: <7e4ba9550808190634q123274ffgca0f7a26df822ee9@mail.gmail.com>

* 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