469,599 Members | 2,590 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,599 developers. It's quick & easy.

minimum operators for b-tree, r-tree


When creating a new data type, what are
the operators absolutely necessary for that
type to particpate in a btree index?

I know you need a "compare" that says = < or >=
so does that mean that those three operators
are the ones required?

If you also know that answer for our implementation
of R-trees that would also be helpful.
I believe it is intersects and overlaps but
it would be nice to get confirmation.

Thanks,
elein
================================================== ==========
el***@varlena.com Varlena, LLC www.varlena.com

PostgreSQL Consulting, Support & Training

PostgreSQL General Bits http://www.varlena.com/GeneralBits/
================================================== ===========
I have always depended on the [QA] of strangers.
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 23 '05 #1
2 1817
elein wrote:
When creating a new data type, what are
the operators absolutely necessary for that
type to particpate in a btree index?

I know you need a "compare" that says = < or >=
so does that mean that those three operators
are the ones required?


I don't remember the details, but here is a link to the pgsql-committers
post from when I submitted a patch to do the same for bytea.

http://archives.postgresql.org/pgsql...8/msg00108.php
--------------------------------------------------------------------
CVSROOT: /home/projects/pgsql/cvsroot
Module name: pgsql
Changes by: tgl ( at ) hub ( dot ) org 01/08/13 14:45:36

Modified files:
src/backend/utils/adt: selfuncs.c varlena.c
src/include/catalog: catversion.h pg_amop.h pg_amproc.h
pg_opclass.h pg_operator.h pg_proc.h
src/include/utils: builtins.h

Log message:
Add comparison operators and btree indexing support for type
bytea. From Joe Conway.
--------------------------------------------------------------------

You could go through cvs web to find the actual diffs, given the date
(13 Aug 2001):
http://developer.postgresql.org/cvsw.../pgsql-server/

Joe

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 23 '05 #2
elein <el***@varlena.com> writes:
When creating a new data type, what are
the operators absolutely necessary for that
type to particpate in a btree index?


You must supply all the operators described in the standard strategy
set:
http://www.postgresql.org/docs/7.4/s...DEX-STRATEGIES
plus the support function(s):
http://www.postgresql.org/docs/7.4/s...XINDEX-SUPPORT

The system is not designed to cope with an incomplete opclass, and I'm
not sure it would work if you tried.

BTW, although <> isn't part of a btree opclass it is a good idea to
provide it (and link it to the opclass by making it the negator of =).
There's at least one place in the system that knows about using this.

The way I prefer to handle this stuff for btree is to write a single
three-way comparison function (compare a to b, return +1/0/-1). This
can be used directly as the btree support function, and then the six
comparison-operator functions are one-line wrappers around it.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Jane Austine | last post: by
4 posts views Thread by Mike Hodkin | last post: by
5 posts views Thread by Nobody | last post: by
2 posts views Thread by Nobody | last post: by
4 posts views Thread by Eloff | last post: by
4 posts views Thread by Spam Me Please | last post: by
6 posts views Thread by bearophileHUGS | last post: by
2 posts views Thread by Steve Summit | last post: by
1 post views Thread by Brian Maguire | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.