Re: horizontal partition

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Klint Gore <kg(at)kgb(dot)une(dot)edu(dot)au>
Cc: Gaetano Mendola <mendola(at)bigfoot(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: horizontal partition
Date: 2005-02-03 06:41:57
Message-ID: 200502022241.57799.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Klint,

> This is how I interpret it (if anyone wants to set me straight or
> improve on it feel free)
>
> Views are implemented as rules.
>
> Rules are pretty much just a macro to the query builder. When it sees
> the view, it replaces it with the implementation of the view.

Right so far.

>
> When you join a view to a table, it generates a subselect of the
> implementation and joins that to the other table.

More or less. A join set and a subselect are not really different in the
planner.

> So the subselect will generate the entire set of data from the view
> before it can use the join to eliminate rows.

Well, not exactly. That's what's happening in THIS query, but it doesn't
happen in most queries, no matter how many view levels you nest (well, up to
the number FROM_COLLAPSE_LIMIT, anyway).

The issue here is that the planner is capable of "pushing down" the WHERE
criteria into the first view, but not into the second, "nested" view, and so
postgres materializes the UNIONed data set before perfoming the join.

Thing is, I seem to recall that this particular issue was something Tom fixed
a while ago. Which is why I wanted to know what version Gaetano is using.

--
Josh Berkus
Aglio Database Solutions
San Francisco

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2005-02-03 06:55:28 Re: horizontal partition
Previous Message Tom Lane 2005-02-03 05:26:16 Re: GiST indexes and concurrency (tsearch2)