Search Postgresql Archives

limit and other joined tables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux