From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Alvaro Herrera <alvherre(at)commandprompt(dot)com> |
Cc: | Hans-Jürgen Schönig <postgres(at)cybertec(dot)at>, PGSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: "micro bucket sort" ... |
Date: | 2010-08-11 15:33:05 |
Message-ID: | 6261.1281540785@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> Excerpts from Hans-Jrgen Schnig's message of mi ago 11 08:21:10 -0400 2010:
>> test=# explain analyze select * from t_test order by x, y limit 20;
> But if you put the limit in a subquery which is ordered by the
> known-indexed condition, it is very fast:
> alvherre=# explain analyze select * from (select * from t_test order by x limit 20) f order by x, y;
That's not guaranteed to give you the right 20 rows, though. Consider
the case where there are > 20 rows having the minimal x value.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2010-08-11 15:35:04 | Re: Regression tests versus the buildfarm environment |
Previous Message | Robert Haas | 2010-08-11 15:29:39 | Re: MERGE command for inheritance |