pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Hiroshi Inoue <Inoue@tpf.co.jp>
To: Jan Wieck <jwieck@debis.com>
Cc: pgsql-hackers <pgsql-hackers@postgreSQL.org>
Cc: maillist@candle.pha.pa.us
Subject: RE: [HACKERS] What about LIMIT in SELECT ?
Date: Mon, 19 Oct 1998 18:52:46 +0900
Message-ID: <002801bdfb46$39ad8ec0$2801007e@cadzone.tpf.co.jp> (raw)
In-Reply-To: <m0zU57w-000EBQC@orion.SAPserv.Hamburg.dsh.de>

> -----Original Message-----
> From: Jan Wieck [mailto:jwieck@debis.com]
> Sent: Friday, October 16, 1998 5:21 PM
> To: Hiroshi Inoue
> Cc: maillist@candle.pha.pa.us; jwieck@debis.com
> Subject: Re: [HACKERS] What about LIMIT in SELECT ?
> 
> 
> Hiroshi Inoue wrote:
> 
> > In the following cases I didn't modify my code to use index scan,
> > because I couldn't formulate how to tell PostgreSQL optimizer whether
> > the response to get first rows is needed or the throughput to process
> > sufficiently many target rows is needed.
> >
> > 3.The access plan made by current PostgreSQL optimizer for a query with
> >    ORDER BY clause doesn't include index scan.
> >
> > I thought the use of Tatsuo's QUERY_LIMIT to decide that the responce
> > is needed. It is sufficient but not necessary ?
> > In Oracle the hints FIRST_ROWS,ALL_ROWS are used.
> 
>     I  still  think  that  the  QUERY LIMIT should be part of the
>     parse tree and not thrown in  by  a  magic  SET  command.  If
>     rewriting  or  function  calls turn the one query sent to the
>     backend into multiple queries processed internal, how  should
>     this QUERY LIMIT variable know to which of all the queries it
>     has to be applied?  It can really break functions and rewrite
>     rules  if  this  variable  is used on all queries while it is
>     set.
> 
>     For your case 3 I think, if there is a  QUERY  LIMIT  in  the
>     parse  tree, the (future) optimizer definitely knows that not
>     all rows will get processed even if there is no qualification
>     given.   So  if  there is an index, that matches the ORDER BY
>     clause and it is no a join and the (future) executor  handles
>     OFFSET  in  single table index scans fast, it could choose an
>     index scan for this query too.
>

When using cursors,in most cases the response to get first(next) rows 
is necessary for me,not the throughput.
How can we tell PostgreSQL optimzer that the response is necessary ?

Hiroshi Inoue
Inoue@tpf.co.jp  




view thread (60+ messages)  latest in thread

Message-ID: <002801bdfb46$39ad8ec0$2801007e@cadzone.tpf.co.jp>
Permalink:  ../002801bdfb46$39ad8ec0$2801007e@cadzone.tpf.co.jp/
Also on:    postgresql.org/message-id/002801bdfb46$39ad8ec0$2801007e@cadzone.tpf.co.jp

 · 

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: Inoue@tpf.co.jp, jwieck@debis.com, maillist@candle.pha.pa.us
  Subject: Re: [HACKERS] What about LIMIT in SELECT ?
  In-Reply-To: <002801bdfb46$39ad8ec0$2801007e@cadzone.tpf.co.jp>
  References: <m0zU57w-000EBQC@orion.SAPserv.Hamburg.dsh.de> <002801bdfb46$39ad8ec0$2801007e@cadzone.tpf.co.jp>

* 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