Re: No merge sort?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Taral <taral(at)taral(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: No merge sort?
Date: 2003-03-15 03:43:30
Message-ID: 26094.1047699810@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Taral <taral(at)taral(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Taral 2003-03-15 04:07:03 Re: No merge sort?
Previous Message Steve Crawford 2003-03-15 01:10:10 Re: Error message style guide