Re: View performance question

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: View performance question
Дата
Msg-id 4558.993229559@sss.pgh.pa.us
обсуждение исходный текст
Ответ на View performance question  ("Josh Berkus" <josh@agliodbs.com>)
Список pgsql-sql
"Josh Berkus" <josh@agliodbs.com> writes:
> I created a view to support comprehensive reporting on one of the
> databases I work with.  Unfortunately, due to the structure of the
> database, which includes 25 reference tables, this requires 3 regular
> joins and about 40 LEFT OUTER JOINS, outputting about 100 columns.

I suppose this is a star schema, wherein rows of the main tables join
to at most one row of the "reference" tables?  If so, you probably want
to make sure you perform the join of the main tables before you start
outerjoining the reference tables onto them.  The syntax you are using
is constraining the planner to use what's probably not a good plan.
See
http://www.ca.postgresql.org/users-lounge/docs/7.1/postgres/explicit-joins.html
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Incremental sum ?
Следующее
От: Alex Pilosov
Дата:
Сообщение: Re: View performance question