Re: problem with from_collapse_limit and joined views - Mailing list pgsql-performance

From Markus Schulz
Subject Re: problem with from_collapse_limit and joined views
Date
Msg-id 201012041946.21722@Mail-Followup-To
Whole thread Raw
In response to Re: problem with from_collapse_limit and joined views  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-performance
Am Samstag 04 Dezember 2010 schrieb Tom Lane:
> "Kevin Grittner" <Kevin.Grittner@wicourts.gov> writes:
...
> > One option would be to create a different user for running queries
> > which read from complex views such as this.
>
> If you don't want to change the collapse limits, the only other
> option is to restructure this specific query so that its syntactic
> structure is closer to the ideal join order.  Look at the plan you
> get in the good-performing case and re-order the join syntax to look
> like that.

no that's not working in this case.
view1 and view2 are written with explicit joins and no better join was
possible. Each view works perfect standalone.
In my above example i have rewritten view1 without explicit joins only
for testing purpose. Without explicit joins i can gather the optimal
query plan from a slightly higher from_collapse_limit (see workaround 2
from my initial posting).
If both views using explicit joins the from_collapse_limit is useless
(only join_collapse_limit usable).

The problem exists only for "view1 JOIN view2" and that pgsql don't
"see" that an element of view2 contains an index-access for reducing the
data from view1. Only if he can break the complete join of both views
into one query-plan he can "see" this. But for this i must raise the
limits.

Looks like some improvement to the geco optimizer was needed here ;)


regards
msc

pgsql-performance by date:

Previous
From: Markus Schulz
Date:
Subject: Re: problem with from_collapse_limit and joined views
Next
From: felix
Date:
Subject: Re: Update problem on large table