limit and other joined tables

Поиск
Список
Период
Сортировка
От Ivan Sergio Borgonovo
Тема limit and other joined tables
Дата
Msg-id 20090113130113.6ba7e51a@dawn.webthatworks.it
обсуждение исходный текст
Список pgsql-general
Is the planner/optimiser smart enough to join just after the LIMIT
in a similar situation:

select [columns from A, B and C] from A
join B on A.Aid=B.Bid
join C on A.Aid=C.Cid
where (conditions on A and B columns)
order by [columns from A and B]
limit 10;

What about a similar situation with subselects?

select [columns from A, B, C] from (
 select [column from A, B]
   where (conditions on A and B columns)
) s
join C on s.Aid=C.Cid
order by [columns from A, B]
limit 10;

vs

select [columns from A, B, C] from (
 select [column from A, B]
  order by [columns from A, B]
  limit 10
) s
join C on s.Aid=C.Cid;

Can postgresql take advantage of the LIMIT even if it is in the
outer select?

--
Ivan Sergio Borgonovo
http://www.webthatworks.it


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

Предыдущее
От: "Dave Page"
Дата:
Сообщение: Re: one-click installer in linux redhat-centos-fedora
Следующее
От: Emanuel Calvo Franco
Дата:
Сообщение: Re: Trying to create implicit casts to text in PG 8.3