Unix Technical Forum

Re: Fixing r-tree semantics

This is a discussion on Re: Fixing r-tree semantics within the pgsql Hackers forums, part of the PostgreSQL category; --> Hi Tom, > What needs more discussion is that it seems to me to make sense to extend the ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-11-2008, 05:33 AM
Mark Cave-Ayland
 
Posts: n/a
Default Re: Fixing r-tree semantics

Hi Tom,

> What needs more discussion is that it seems to me to make sense to extend

the standard
> opclasses to handle the four Y-direction operators comparable to the

X-direction
> operators that are already there, that is "above", "below", "overabove",

and
> "overbelow".


As part of PostGIS (http://postgis.refractions.net), I submitted a patch a
while back to add additional Y-direction operators to the code which is a
slightly modified version of rtree_gist (and yes, the PostGIS implementation
will suffer from the same issues you've found with the existing R-tree
implementations).

The operators I went for were as follows:

A &<| B - true if A's bounding box overlaps or is below B's bounding
box
A |&> B - true if B's bounding box overlaps or is above B's bounding
box
A <<| B - true if A's bounding box is strictly below B's bounding
box
A |>> B - true if A's bounding box is strictly above B's bounding
box

Since the rtree_gist implementation and operators were 2D, my thoughts were
to use another op-class only if the indexing were upgraded to 3D. So with
this in mind, I created the following new GiST strategies:

#define RTOverBelowStrategyNumber 9
#define RTBelowStrategyNumber 10
#define RTAboveStrategyNumber 11
#define RTOverAboveStrategyNumber 12

This is basically what you are suggesting but with a | instead of a ^ in the
operator name (my original choice was to try and use } to indicate the
positive sense of the Y-axis but this was not accepted as a valid operator
character which is why I changed to |).

It would be harder for us to change these operators since they already
exist, but then again it would be useful from a maintenance point of view to
keep the strategy numbers and operators the same across both
implementations. Of course strategy numbers are just used internally so
these aren't such a big issue - it's more the choice of operators that would
be useful to agree on.


Kind regards,

Mark.

------------------------
WebBased Ltd
17 Research Way
Tamar Science Park
Plymouth
PL6 8BT

T: +44 (0)1752 797131
F: +44 (0)1752 791023
W: http://www.webbased.co.uk



---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-11-2008, 05:33 AM
Tom Lane
 
Posts: n/a
Default Re: Fixing r-tree semantics

"Mark Cave-Ayland" <m.cave-ayland@webbased.co.uk> writes:
> The operators I went for were as follows:


> A &<| B - true if A's bounding box overlaps or is below B's bounding
> box
> A |&> B - true if B's bounding box overlaps or is above B's bounding
> box
> A <<| B - true if A's bounding box is strictly below B's bounding
> box
> A |>> B - true if A's bounding box is strictly above B's bounding
> box


Well, I was proposing more or less that but with ^ because of the
precedent of the two existing box_above/box_below operator names.
However, I'm quite happy to adopt your names, since that's probably
a more widely used precedent. Sold, unless there are objections.

(BTW, it does look a bit odd that the "|" moves around in your names.
But I don't dislike it enough to not follow the precedent.)

> It would be harder for us to change these operators since they already
> exist, but then again it would be useful from a maintenance point of view to
> keep the strategy numbers and operators the same across both
> implementations.


Agreed, I'll use your strategy number assignments too.

regards, tom lane

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-11-2008, 05:33 AM
Mark Cave-Ayland
 
Posts: n/a
Default Re: Fixing r-tree semantics


> -----Original Message-----
> From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
> Sent: 24 June 2005 14:27
> To: Mark Cave-Ayland (External)
> Cc: bwhite@frognet.net; teodor@sigaev.ru; oleg@sai.msu.su;
> pgsql-hackers@postgresql.org; 'PostGIS Development Discussion'
> Subject: Re: Fixing r-tree semantics


(cut)

> Well, I was proposing more or less that but with ^ because of
> the precedent of the two existing box_above/box_below
> operator names. However, I'm quite happy to adopt your names,
> since that's probably a more widely used precedent. Sold,
> unless there are objections.
>
> (BTW, it does look a bit odd that the "|" moves around in
> your names. But I don't dislike it enough to not follow the
> precedent.)


The thinking behind it was that the | represents the x-axis if you tilt you
head right 90 degrees. In effect, it would allow you to 'read' the operator
without having to go and look up what it does.

> > It would be harder for us to change these operators since they already
> > exist, but then again it would be useful from a maintenance point of
> > view to keep the strategy numbers and operators the same across both
> > implementations.

>
> Agreed, I'll use your strategy number assignments too.


Alright no problems.


Many thanks,

Mark.

------------------------
WebBased Ltd
17 Research Way
Tamar Science Park
Plymouth
PL6 8BT

T: +44 (0)1752 797131
F: +44 (0)1752 791023
W: http://www.webbased.co.uk



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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:50 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com