Re: [HACKERS] What about LIMIT in SELECT ?

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: jwieck(at)debis(dot)com
Cc: lockhart(at)alumni(dot)caltech(dot)edu, jwieck(at)debis(dot)com, eric(at)linux-hw(dot)com, jeff(at)remapcorp(dot)com, hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] What about LIMIT in SELECT ?
Date: 1998-10-15 05:52:06
Message-ID: 199810150552.BAA07576@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-hackers

> > I have had more time to think about this. Basically, for pre-sorted
> > data, our psort code is very fast, because it does not need to sort
> > anything. It just moves the rows in and out of the sort memory. Yes,
> > it could be removed in some cases, and probably should be, but it is not
> > going to produce great speedups.
>
> And I got the time to hack around about this.
>
> I hacked in a little check into the planner, that compares
> the sortClause against the key field list of an index scan
> and just suppresses the sort node if it exactly matchs and
> all sort operators are "<".
>
> I tested with a 10k row table where key is a text field. The
> base query is a
>
> SELECT ... WHERE key > 'val' ORDER BY key;
>
> The used 'val' is always a key that is close to the first of
> all keys in the table ('' on the first query and the last
> selected value on subsequent ones).

This is good stuff. I want to think about it for a day. Sounds very
promising.

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message Bruce Momjian 1998-10-16 05:34:33 Re: [HACKERS] What about LIMIT in SELECT ?
Previous Message Jan Wieck 1998-10-14 21:05:07 Re: [HACKERS] What about LIMIT in SELECT ?

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1998-10-15 05:59:37 Open 6.4 items
Previous Message Bruce Momjian 1998-10-15 05:49:37 Re: [HACKERS] PostgreSQL v6.4 BETA2 ...