473,702 Members | 2,508 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.c om 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 1928
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*******@postg resql.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
1254
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 compare callback, set_bt_compare. It even seems like got into pybsddb patch list (http://sourceforge.net/tracker/index.php?func=detail&aid=532308&group_id=13900&atid=313900). However, the current Python source tree (cvs) doesn't include the patch.
4
2484
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 used in hardware programming. Are they used very often in routine C/C++ programming, and what for? thanks, MJH
5
2053
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, class ARG_TYPE = const TYPE&> class CBTree : public CObject {
2
3282
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 <class TYPE, class ARG_TYPE = const TYPE&> class CBTree : public CObject { // Constructors public: CBTree();
4
5247
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 the domain and then finding the matching document. What do you think would be better? And do you have any implementation you recommend? Thanks, and merry Christmas folks. -Dan
4
2185
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
1974
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 |= t s ^ t s ^= t My suggestion is to remove them, and keep them only as explicit non-operator versions (.symmetric_difference(), .update(),
2
3466
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 with 2's complement, 1's complement, or sign-magnitude arithmetic. But the followup remark is sometimes also made that the choice of arithmetic isn't completely unconstrained, since the bitwise operators seem to presume a base-2 machine.
1
3132
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
0
8738
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
8652
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8939
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5907
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4412
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4667
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3104
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2399
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2036
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.