473,378 Members | 1,400 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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 1918
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Jane Austine | last post by:
Hello. How do I change the BTree sorting order with bsddb, instead of the default lexicographical order? After studying sleepycat's document, I found there is a function call for setting the...
4
by: Mike Hodkin | last post by:
As a beginning student of C++, books reference "bitwise operators" and give brief examples, but I have not read a good explanation of what they are used for. One reference mentioned that they are...
5
by: Nobody | last post by:
I am trying to write a BTree class, just wondering if I missed any useful methods. This is my class definition so far (excuse the MFC portions, its a project requirement): template <class TYPE,...
2
by: Nobody | last post by:
I took the advice from the group and got rid of the node accessor functions and arrived at this definition. I have not added the copy constructor/assignment operators to this class yet. template...
4
by: Eloff | last post by:
I've got 100MB of urls organized by domain and then by document. I thought that a hastable of hastables or a btree of btrees would be a good way to lookup a specific url quickly by first finding...
4
by: Spam Me Please | last post by:
I have a tree like this struct BTree{ int left; char c; int right; }; #define END -1 int main(int argc, char *argv)
6
by: bearophileHUGS | last post by:
Sometimes I suggest to add things to the language (like adding some set methods to dicts), but I've seen that I tend to forget the meaning of six set/frozenset operators: s & t s &= t s | t s...
2
by: Steve Summit | last post by:
-----BEGIN PGP SIGNED MESSAGE----- It's often explained that the reason for some of the imprecision in C's definition is so that C can be implemented on different kinds of machines -- say, those...
1
by: Brian Maguire | last post by:
Can too many btree indexes cause page level locking? I read this... http://www.postgresql.org/docs/7.4/static/locking-indexes.html
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.