Re: horizontal partition

Поиск
Список
Период
Сортировка
От Josh Berkus
Тема Re: horizontal partition
Дата
Msg-id 200502022241.57799.josh@agliodbs.com
обсуждение исходный текст
Ответ на Re: horizontal partition  (Klint Gore <kg@kgb.une.edu.au>)
Ответы Re: horizontal partition  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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

В списке pgsql-performance по дате отправления:

Предыдущее
От: Sean Davis
Дата:
Сообщение: Re: [SQL] OFFSET impact on Performance???
Следующее
От: Tom Lane
Дата:
Сообщение: Re: horizontal partition