Re: Wrong plan for subSELECT with GROUP BY - Mailing list pgsql-performance

From Jim C. Nasby
Subject Re: Wrong plan for subSELECT with GROUP BY
Date
Msg-id 20060512191213.GS6201@pervasive.com
Whole thread Raw
In response to Wrong plan for subSELECT with GROUP BY  (Antal Attila <atesz@ritek.hu>)
List 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@pervasive.com
Pervasive Software      http://pervasive.com    work: 512-231-6117
vcard: http://jim.nasby.net/pervasive.vcf       cell: 512-569-9461

pgsql-performance by date:

Previous
From: Phil Frost
Date:
Subject: stable function optimizations, revisited
Next
From: "Jim C. Nasby"
Date:
Subject: Re: Firebird 1.5.3 X Postgresql 8.1.3 (linux and windows)