Re: Wrong plan for subSELECT with GROUP BY

From: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
To: Antal Attila <atesz(at)ritek(dot)hu>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Wrong plan for subSELECT with GROUP BY
Date: 2006-05-12 19:12:13
Message-ID: 20060512191213.GS6201@pervasive.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

If you wrap the LIMIT select into a subquery in the FROM the planner
might figure it out...

SELECT ...
FROM (SELECT blah FROM a LIMIT 10)
LEFT JOIN ...

Unlike some other databases that will spend huge amounts of time on
trying to re-arrange queries and then hope they can effectively cache
query plans, PostgreSQL prefers not to spend cycles on more esoteric
cases so that query planning is fast.
--
Jim C. Nasby, Sr. Engineering Consultant jnasby(at)pervasive(dot)com
Pervasive Software http://pervasive.com work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf cell: 512-569-9461

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Jim C. Nasby 2006-05-12 19:14:15 Re: Firebird 1.5.3 X Postgresql 8.1.3 (linux and windows)
Previous Message Phil Frost 2006-05-12 17:59:08 stable function optimizations, revisited