Received: from dsh.de (firewall-user@neptun.sns-felb.debis.de [53.122.101.2]) by hub.org (8.8.8/8.8.8) with ESMTP id GAA13566 for ; Mon, 19 Oct 1998 06:22:27 -0400 (EDT) (envelope-from wieck@sapserv.debis.de) Received: by dsh.de; id MAA13918; Mon, 19 Oct 1998 12:21:16 +0200 (MET DST) Received: from dshmail.dsh.de(53.47.15.3) by neptun.dsh.de via smap (3.2) id xma013635; Mon, 19 Oct 98 12:20:55 +0200 Received: from mail1.hh1.dsh.de (mail1.hh1.dsh.de [53.47.9.5]) by dshmail.dsh.de (8.8.7/8.8.7) with ESMTP id MAA11037; Mon, 19 Oct 1998 12:18:27 +0200 (MET DST) Received: from mars.SAPserv.Hamburg.dsh.de (root@mail5.hh1.dsh.de [53.2.168.17]) by mail1.hh1.dsh.de (8.8.7/8.8.7) with SMTP id MAA29382; Mon, 19 Oct 1998 12:20:49 +0200 Received: from orion.SAPserv.Hamburg.dsh.de by mars.SAPserv.Hamburg.dsh.de with smtp for <> id m0zVA2V-000B5AC; Mon, 19 Oct 98 09:47 MET DST Received: by orion.SAPserv.Hamburg.dsh.de for maillist@candle.pha.pa.us id m0zVCaT-000EBPC; Mon, 19 Oct 98 12:30 MET DST Message-Id: From: jwieck@debis.com (Jan Wieck) Subject: Re: [HACKERS] What about LIMIT in SELECT ? To: Inoue@tpf.co.jp (Hiroshi Inoue) Date: Mon, 19 Oct 1998 12:30:52 +0200 (MET DST) Cc: jwieck@debis.com, pgsql-hackers@postgreSQL.org, maillist@candle.pha.pa.us Reply-To: jwieck@debis.com (Jan Wieck) In-Reply-To: <002801bdfb46$39ad8ec0$2801007e@cadzone.tpf.co.jp> from "Hiroshi Inoue" at Oct 19, 98 06:52:46 pm X-Mailer: ELM [version 2.4 PL25] Content-Type: text 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) #