Re: optimizing a view-driven query

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: optimizing a view-driven query
Дата
Msg-id 20360.985822298@sss.pgh.pa.us
обсуждение исходный текст
Ответ на optimizing a view-driven query  (will trillich <will@serensoft.com>)
Список pgsql-general
will trillich <will@serensoft.com> writes:
>     select topic from course where course like '%comput%' ;
>     -- not asking for state, we don't need to join the state table

But you still do need to join, because the join affects which rows
will be returned.  The fact that you don't happen to use any values
out of one of the joined tables in your SELECT list is not very
relevant.

In this example, you might happen to know (or think you know) that there
will be one and only one state row matching any possible row from the
subjoin of the other tables, so in the end it wouldn't affect the number
of rows output.  This is not an assumption the planner is prepared to
make, however.

            regards, tom lane

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: joins and indexes -- a=b or b=a?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Unexplained behaviour