Re: No merge sort? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: No merge sort?
Date
Msg-id 26094.1047699810@sss.pgh.pa.us
Whole thread Raw
In response to Re: No merge sort?  (Taral <taral@taral.net>)
Responses Re: No merge sort?  (Taral <taral@taral.net>)
List pgsql-hackers
Taral <taral@taral.net> writes:
> On Thu, Mar 13, 2003 at 10:30:27PM -0500, Tom Lane wrote:
>> The idea is you look at the index to make a list of main-table tuple
>> positions you are interested in, which you represent compactly as a
>> compressed bitmap.  [snip]

> And it loses bigtime in the case of LIMIT. If the unlimited query
> returns 4,000 records and I only want 20, you're retrieving 200x too
> much data from disk.

Sure.  That's why we have a planner that distinguishes between startup
cost and total cost, and interpolates when a LIMIT is involved.  But
if this mergesort idea only helps for small-limit cases, that's another
restriction on its scope of usefulness...
        regards, tom lane


pgsql-hackers by date:

Previous
From:
Date:
Subject: Re: [HACKERS] log_duration
Next
From: Taral
Date:
Subject: Re: No merge sort?