pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Greg Stark <gsstark@mit.edu>
Cc: Stephan Szabo <sszabo@megazone.bigpanda.com>
Cc: Merlin Moncure <merlin.moncure@rcsonline.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: best way to fetch next/prev record based on index
Date: Wed, 28 Jul 2004 19:11:06 -0400
Message-ID: <814.1091056266@sss.pgh.pa.us> (raw)
In-Reply-To: <876587spxw.fsf@stark.xeocode.com>
References: <6EE64EF3AB31D5448D0007DD34EEB34101AEFF@Herge.rcsinc.local>
	<20040727204057.S28969@megazone.bigpanda.com>
	<87oem0u182.fsf@stark.xeocode.com>
	<21449.1091023621@sss.pgh.pa.us>
	<87y8l4rujq.fsf@stark.xeocode.com>
	<23584.1091033781@sss.pgh.pa.us>
	<876587spxw.fsf@stark.xeocode.com>

Greg Stark <gsstark@mit.edu> writes:
> Tom Lane <tgl@sss.pgh.pa.us> writes:
>> One thing I did not like about your first pass is that it makes
>> unsupportable assumptions about there being a semantic relationship
>> between operators named, say, '<' and '<='.  

> In that case though, it seems even the existing code is insufficient.

Well, yeah, we know the existing code is broken ;-)

> Instead of testing whether the operator with strcmp against "=" and
> "<>" it should perhaps be looking for an operator class and the
> strategy number for the operator and its negator.

Probably.  You can find some relevant code in indxpath.c in the stuff
that tries to determine whether partial indexes are relevant.

I think that the ideal behavior is that we not look directly at the
operator name at all.  For example it's not too unreasonable to want
to write (a,b) ~<~ (c,d) if you have an index that uses those
non-locale-aware operators.  We should find the operator that matches
the name and input arguments, and then try to make sense of the operator
semantics by matching it to btree opclasses.

Note that it's possible to find multiple matches, for example if someone
has installed a "reverse sort" opclass.  I think we would want to prefer
a match in the datatype's default opclass, if there is one, but
otherwise we can probably follow the lead of the existing code and
assume that any match is equally good.

			regards, tom lane



view thread (34+ messages)  latest in thread

Message-ID: <814.1091056266@sss.pgh.pa.us>
Permalink:  ../814.1091056266@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/814.1091056266@sss.pgh.pa.us

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, gsstark@mit.edu, sszabo@megazone.bigpanda.com, merlin.moncure@rcsonline.com
  Subject: Re: best way to fetch next/prev record based on index
  In-Reply-To: <814.1091056266@sss.pgh.pa.us>

* 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