Skip site navigation (1) Skip section navigation (2)

Re: Top-k optimizations?

From: Kris Jurka <books(at)ejurka(dot)com>
To: David Fetter <david(at)fetter(dot)org>
Cc: PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Top-k optimizations?
Date: 2005-01-14 04:07:55
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers

On Thu, 13 Jan 2005, David Fetter wrote:

> 3.  What kinds of top-k optimizations might (eventually) be included
> in PostgreSQL?

See the TODO item:

Allow ORDER BY ... LIMIT 1 to select high/low value without sort or index 
using a sequential scan for highest/lowest values

If only one value is needed, there is no need to sort the entire table. 
Instead a sequential scan could get the matching value.

There is some discussion of this on the -general list here:,fe626a7cc9021d12,4f1d0575be60c26f,5c44463d8ef0e1ef,ceff42f0dae09272,dc9da98adcb6142c,7f34133e99b38825,28b43c5e79924da6,98be76099ea6513f,5d3f19a69e3b5a93?thread_id=7d35d3eb00ffd0e8&mode=thread&noheader=1&q=oleg+limit+sort#doc_7f34133e99b38825

Kris Jurka

In response to

pgsql-hackers by date

Next:From: Tom LaneDate: 2005-01-14 04:17:32
Subject: Re: FATAL: catalog is missing 1 attribute(s) for relid 16396
Previous:From: Tom LaneDate: 2005-01-14 04:01:12
Subject: Re: Bug? 8.0 does not use partial index

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group