From: Matteo Beccati <php@beccati.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Simon Riggs <simon@2ndquadrant.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: ORDER BY and LIMIT not propagated on inherited
Date: Fri, 02 Sep 2005 17:00:50 +0200
Message-ID: <43186922.4060703@beccati.com> (raw)
In-Reply-To: <14074.1125672054@sss.pgh.pa.us>
References: <43182789.4070307@beccati.com>
<1125664532.3956.278.camel@localhost.localdomain>
<43184B8F.2090505@beccati.com>
<14074.1125672054@sss.pgh.pa.us>
Hi,
>>The correct strategy IMHO would
>>be applying the order by and limit for each child table (which results
>>in an index scan, if possible), appending, then finally sorting a bunch
>>of rows, and limiting again.
>
> This would be a win in some cases, and in many others a loss (ie, wasted
> sort steps). The hard part is determining when to apply it.
I don't actually know how many smaller separate sorts compare to a
single big sort, but I guess the difference wouldn't be so big if the
LIMIT is low. Add to this that you don't need to append the whole
rowsets, but just smaller ones.
Best regards
--
Matteo Beccati
http://phpadsnew.comhttp://phppgads.com
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: php@beccati.com, tgl@sss.pgh.pa.us, simon@2ndquadrant.com
Subject: Re: ORDER BY and LIMIT not propagated on inherited
In-Reply-To: <43186922.4060703@beccati.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