Re: LIMIT/SORT optimization - Mailing list pgsql-patches

From Tom Lane
Subject Re: LIMIT/SORT optimization
Date
Msg-id 10816.1175969508@sss.pgh.pa.us
Whole thread Raw
In response to Re: LIMIT/SORT optimization  (Bruce Momjian <bruce@momjian.us>)
Responses Re: LIMIT/SORT optimization  ("Simon Riggs" <simon@2ndquadrant.com>)
Re: LIMIT/SORT optimization  (Gregory Stark <stark@enterprisedb.com>)
List pgsql-patches
Bruce Momjian <bruce@momjian.us> writes:
> I did some performance testing of the patch, and the results were good.
> I did this:

>     test=> CREATE TABLE test (x INTEGER);
>     test=> INSERT INTO test SELECT * FROM generate_series(1, 1000000);
>     test=> SET log_min_duration_statement = 0;
>     test=> SELECT * FROM test ORDER BY x LIMIT 3;

LIMIT 3 seems an awfully favorable case; if the patch can only manage a
factor of 4 speedup there, what happens at limit 10, 20, 100?  Also,
you've tested only one sort size and only one (unspecified) value of
work_mem, and the usefulness of the patch would surely vary depending on
that.  In particular, what happens with a LIMIT large enough to overflow
work_mem?

Lastly, I suspect that sorting presorted input might be particularly
favorable for this patch.  Please try it with random data for comparison.

            regards, tom lane

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: simply custom variables protection
Next
From: Neil Conway
Date:
Subject: Re: RESET SESSION v2