From: Jim C. Nasby <jnasby@pervasive.com>
To: Antal Attila <atesz@ritek.hu>
Cc: pgsql-performance@postgresql.org
Subject: Re: Wrong plan for subSELECT with GROUP BY
Date: Fri, 12 May 2006 14:12:13 -0500
Message-ID: <20060512191213.GS6201@pervasive.com> (raw)
In-Reply-To: <446482E4.6050906@ritek.hu>
References: <446482E4.6050906@ritek.hu>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: jnasby@pervasive.com, atesz@ritek.hu
Subject: Re: Wrong plan for subSELECT with GROUP BY
In-Reply-To: <20060512191213.GS6201@pervasive.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox