Thread: amount of join's and sequential access to the tables involved

amount of join's and sequential access to the tables involved

From
Gerardo Herzig
Date:
Hi all. Im working on a 'simple' query with 7, 8 left joins. After the
9nth join or so, explain analyze became to show the plan with many
tables being read in sequential fashion. Of course, this slows down the
query response in a factor on 10.

I can alter the order in wich the join's are appended, allways with the
same result.

So,it looks like a resources config situation.

Wich config variables are involved in the use of hash joins?

(I dont have access right now to the server running pg, so i cannot show
query plan nor pg configuration)

Thanks!

Gerardo



Re: amount of join's and sequential access to the tables involved

From
Tom Lane
Date:
Gerardo Herzig <gherzig@fmed.uba.ar> writes:
> Hi all. Im working on a 'simple' query with 7, 8 left joins. After the
> 9nth join or so, explain analyze became to show the plan with many
> tables being read in sequential fashion. Of course, this slows down the
> query response in a factor on 10.

increase join_collapse_limit, perhaps?
        regards, tom lane


Re: amount of join's and sequential access to the tables involved

From
Gerardo Herzig
Date:
El mié, 11-01-2012 a las 10:40 -0500, Tom Lane escribió:
> Gerardo Herzig <gherzig@fmed.uba.ar> writes:
> > Hi all. Im working on a 'simple' query with 7, 8 left joins. After the
> > 9nth join or so, explain analyze became to show the plan with many
> > tables being read in sequential fashion. Of course, this slows down the
> > query response in a factor on 10.
>
> increase join_collapse_limit, perhaps?
>
>             regards, tom lane
>

Crap, yes. That was it.
Just curious about one thing:

That query is part of a function. If i raise set_join_collapse in a psql
bash session, and then excecute the function, there is no changes. But
if i excecute the query directly in the psql session, it flys.

So, what happens, when a plsql function is excecuted, it takes is own
enviroment variables, or something like that?

Thanks again, Tom!

Gerardo



Re: amount of join's and sequential access to the tables involved

From
Tom Lane
Date:
Gerardo Herzig <gherzig@fmed.uba.ar> writes:
> So, what happens, when a plsql function is excecuted, it takes is own
> enviroment variables, or something like that?

No, but it probably cached a plan from an execution before you changed
join_collapse_limit ...
        regards, tom lane


Re: amount of join's and sequential access to the tables involved

From
Gerardo Herzig
Date:
El mié, 11-01-2012 a las 10:40 -0500, Tom Lane escribió:
> Gerardo Herzig <gherzig@fmed.uba.ar> writes:
> > Hi all. Im working on a 'simple' query with 7, 8 left joins. After the
> > 9nth join or so, explain analyze became to show the plan with many
> > tables being read in sequential fashion. Of course, this slows down the
> > query response in a factor on 10.
>
> increase join_collapse_limit, perhaps?
>
>             regards, tom lane
>

Im sory Tom and all, again stuck with this. Now i have 9 joins, and
join_collapse_limit = 20, and the query slows down big time when the 9th
join appears.

Another configuration variable to check against?

Thanks again.
Gerardo