From: jwieck@debis.com
To: Inoue@tpf.co.jp
Cc: jwieck@debis.com
Cc: pgsql-hackers@postgreSQL.org
Cc: maillist@candle.pha.pa.us
Subject: Re: [HACKERS] What about LIMIT in SELECT ?
Date: Mon, 19 Oct 1998 12:30:52 +0200 (MET DST)
Message-ID: <m0zVCaT-000EBPC@orion.SAPserv.Hamburg.dsh.de> (raw)
In-Reply-To: <002801bdfb46$39ad8ec0$2801007e@cadzone.tpf.co.jp>
Hiroshi Inoue wrote:
> 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 ?
With my LIMIT patch, the offset and the row count are part of
the querytree. And if a LIMIT is given, the limitCount elemet
of the querytree (a Node *) isn't NULL what it is by default.
When a LIMIT is given, the optimizer could assume that first
rows is wanted (even if the limit is ALL maybe - but I have
to think about this some more). And this assumption might let
it decide to use an index to resolve an ORDER BY even if no
qualification was given.
Telling the optimizer that first rows wanted in a cursor
operation would read
DECLARE CURSOR c FOR SELECT * FROM mytab ORDER BY a LIMIT ALL;
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) #
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, Inoue@tpf.co.jp, maillist@candle.pha.pa.us
Subject: Re: [HACKERS] What about LIMIT in SELECT ?
In-Reply-To: <m0zVCaT-000EBPC@orion.SAPserv.Hamburg.dsh.de>
References: <002801bdfb46$39ad8ec0$2801007e@cadzone.tpf.co.jp> <m0zVCaT-000EBPC@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