pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: jwieck@debis.com
To: maillist@candle.pha.pa.us
Cc: lockhart@alumni.caltech.edu
Cc: jwieck@debis.com
Cc: eric@linux-hw.com
Cc: jeff@remapcorp.com
Cc: hackers@postgreSQL.org
Subject: Re: [HACKERS] What about LIMIT in SELECT ?
Date: Wed, 14 Oct 1998 19:57:27 +0200 (MET DST)
Message-ID: <m0zTVAt-000EBRC@orion.SAPserv.Hamburg.dsh.de> (raw)
In-Reply-To: <199810141721.NAA28746@candle.pha.pa.us>

> But, you are correct that certain cases where in index is already being
> used on a query, you could just skip the sort IF you used the index to
> get the rows from the base table.

    Especially in the case where

        SELECT ... WHERE key > 'val' ORDER BY key;

    creates  a Sort->IndexScan plan. The index scan already jumps
    around on the disc to collect the sorts input  and  the  sort
    finally returns exactly the same output (if the used index is
    only on key).

    And this is the case for  large  tables.  The  planner  first
    decides  to  use  an  index  scan due to the WHERE clause and
    later it notices the ORDER BY clause and creates a sort  over
    the scan.

    I'm  actually  hacking  around on it to see what happens if I
    suppress the sort node in some cases.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#======================================== jwieck@debis.com (Jan Wieck) #





view thread (60+ messages)  latest in thread

Message-ID: <m0zTVAt-000EBRC@orion.SAPserv.Hamburg.dsh.de>
Permalink:  ../m0zTVAt-000EBRC@orion.SAPserv.Hamburg.dsh.de/
Also on:    postgresql.org/message-id/m0zTVAt-000EBRC@orion.SAPserv.Hamburg.dsh.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: jwieck@debis.com, maillist@candle.pha.pa.us, lockhart@alumni.caltech.edu, eric@linux-hw.com, jeff@remapcorp.com, hackers@postgreSQL.org
  Subject: Re: [HACKERS] What about LIMIT in SELECT ?
  In-Reply-To: <m0zTVAt-000EBRC@orion.SAPserv.Hamburg.dsh.de>
  References: <199810141721.NAA28746@candle.pha.pa.us> <m0zTVAt-000EBRC@orion.SAPserv.Hamburg.dsh.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox