X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EFEEAD1B258 for ; Wed, 28 Jul 2004 01:01:42 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 28308-05 for ; Wed, 28 Jul 2004 04:00:44 +0000 (GMT) Received: from megazone.bigpanda.com (megazone.bigpanda.com [64.147.171.210]) by svr1.postgresql.org (Postfix) with ESMTP id D7688D1CBAA for ; Wed, 28 Jul 2004 00:45:35 -0300 (ADT) Received: by megazone.bigpanda.com (Postfix, from userid 1001) id 47EB5355E6; Tue, 27 Jul 2004 20:45:34 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by megazone.bigpanda.com (Postfix) with ESMTP id 4652A355E4; Tue, 27 Jul 2004 20:45:34 -0700 (PDT) Date: Tue, 27 Jul 2004 20:45:34 -0700 (PDT) From: Stephan Szabo To: Merlin Moncure Cc: gsstark@mit.edu, pgsql-performance@postgresql.org, Tom Lane Subject: Re: best way to fetch next/prev record based on index In-Reply-To: <6EE64EF3AB31D5448D0007DD34EEB34101AEFF@Herge.rcsinc.local> Message-ID: <20040727204057.S28969@megazone.bigpanda.com> References: <6EE64EF3AB31D5448D0007DD34EEB34101AEFF@Herge.rcsinc.local> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=1.1 tagged_above=0.0 required=5.0 tests=NO_DNS_FOR_FROM X-Spam-Level: * X-Archive-Number: 200407/210 X-Sequence-Number: 7601 On Tue, 27 Jul 2004, Merlin Moncure wrote: > Greg Stark wrote: > > > > do it for multi-column keys. It seems it would be nice if some > syntax > > > > similar to (a,b,c) > (a1,b1,c1) worked for this. > > Hum. It would seem my intuition matches the SQL92 spec and Postgres > gets > > this > > wrong. > [...] > > Even if Postgres did this right I'm not sure that would solve your > index > > woes. > > I imagine the first thing Postgres would do is rewrite it into regular > > scalar > > expressions. Ideally the optimizer should be capable of then deducing > from > > the > > scalar expressions that an index scan would be useful. > > Wow. For once, the standard is my friend. Well, what has to be done? > :) Does pg do it the way it does for a reason? From the outside it > seems like the planner would have an easier job if it can make a field > by field comparison. > > Would a patch introducing the correct behavior (per the standard) be > accepted? It seems pretty complicated (not to mention the planner > issues). Given the comment on make_row_op, /* * XXX it's really wrong to generate a simple AND combination for < <= * > >=. We probably need to invent a new runtime node type to handle * those correctly. For the moment, though, keep on doing this ... */ I'd expect it'd be accepted.