inefficient query plan with left joined view

Поиск
Список
Период
Сортировка
От Andreas Pflug
Тема inefficient query plan with left joined view
Дата
Msg-id 3E36B4F2.1020506@web.de
обсуждение исходный текст
Ответы Re: inefficient query plan with left joined view
Список pgsql-performance
What I'm doing on V7.3.1:

select t1.keycol, t2.keycol
  from  tab1 t1
  LEFT join myview t2 on t1.keycol=t2.keycol
where t1.keycol=1000001

t1 has 100 rows, t2 has 4000, both with keycol as PK.

the view is created as
CREATE myview AS SELECT keycol, 22::integer as calc_col FROM tab2

The query plan will show an ugly subquery scan on all tab2 rows. If the
view is created without calculated columns, the query plan looks as
expected showing and index scan on tab2 with the correct condition,
inner join will always be ok.

In real life, the view consists of a lot more tables, and the tables may
contain >1,000,000 rows so you may imagine the performance...



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

Предыдущее
От: Ron Johnson
Дата:
Сообщение: Re: Indexing foreign keys
Следующее
От: Tom Lane
Дата:
Сообщение: Re: inefficient query plan with left joined view