R-Tree vs Quadtree

Oracle database version : 11gR2
While trying some experiments on R-Tree vs Quadtree performance, I encountered a situation where the query on Quadtree did not complete.
Setup;
CREATE TABLE SHAPES (ID NUMBER, SHAPE_RTREE SDO_GEOMETRY, SHAPE_QUAD SDO_GEOMETRY);
Quadtree creation generates error on 11gR2, therefore while create the index I have mentioned the parameters 'SDO_LEVEL=4 GEODETIC=FALSE'
Please note the data in SHAPE_RTREE column and SHAPE_QUAD column are the same.
Query:
SELECT ID FROM SHAPES WHERE SDO_ANYINTERACT(SHAPE_RTREE,<input point>) = 'TRUE';  --> Returns 13 rows in 8 secs (5800 gets)
SELECT ID FROM SHAPES WHERE SDO_ANYINTERACT(SHAPE_QUAD,<input point>)  = 'TRUE';   --> Query did not complete even after 15 mins (Ctrl+c at one point showed 48,000 rows returned).
SHAPE_RTREE and SHAPE_QUAD largely contain complex polygons with/without holes.
I can paste the results after I am done with my tests. Just wanted to check if anyone has faced similar problems with Quadtree indexes.
Rgds,
Gokul

Gokul Gopal wrote:
Oracle database version : 11gR2
Just wanted to check if anyone has faced similar problems with Quadtree indexes.
On 11R2? I don't think so, because I don't think anybody uses Quadtree's still. And you shouldn't, R-Tree's are noticeably faster, they require less work, and since 11 Oracle maintains them for you so there is no noticeable degradation. Plus (but I'm not sure of this one) AFAIK you cannot partition your table and use partitioned spatial indexes with quad trees, but as said, I'm not sure about that one.
Out of curiosity, where did you find out about Quadtrees? They're not mentioned anymore in 11R2 Docs. I know them because back in 7 and 8 you didn't have any other option, but since R-Tree's came along I've used them. As I remember they were a nightmare to maintain with all the tile size estimates and all that baloney...

Similar Messages

  • Discuss the componet of Oracle "Oracle Spatial "

    Hi,Everyone!
    I'm studing the spatial index with the oracle spatial,cause the oracle have two index methods: R-tree and Quadtree.The index I have completed!
    Now,I have some problem whit performance test.I didn't kown how complete the performance test(such as:need some space when it index,time with query.)

    Hi,Everyone!
    I'm studing the spatial index with the oracle spatial,cause the oracle have two index methods: R-tree and Quadtree.The index I have completed!
    Now,I have some problem whit performance test.I didn't kown how complete the performance test(such as:need some space when it index,time with query.)

  • R-Tree Index v's Quadtree Index

    Hi,
    In the 8.1.7 spatial documentation it says that R-Tree index may not be a good choice for a geometry table that has heavy update activity.
    Can anyone define and quantify what heavy update is?
    Thanks

    There hasn't been a formal analysis of R-tree update performance. Some things that are known:
    The spatial index create statement includes a percent free specification that allows free space to remain in the R-tree to accomodate future inserts.
    If the data doesn't need to be kept on-line all the time, then the R-tree index can be rebuilt.
    The performance associated with both R-tree index updates and quadtree index updates is dependent on the data being inserted. Updating point data seems to be faster with quadtrees. Updating simple geometries also seems to be faster with quadtrees. There is a point though where tiling complicated geometries dominates the quadtree index update time, and at some point of complexity it becomes faster to update R-tree indexes.
    If anyone has info to add here it would be quite useful.
    Hope this helps,
    dan

  • Right way to build / use quad tree?

    Hi, the quadtree data stucture seems so simple, and fits alot of problems, but coding it properly is a problem.
    The purpose of the tree is to find which objects are with in a visible area.
    So each node has dimensions x,y,width, height. And child a,b,c,d. Plus a object list.
    The main method to build the tree is the nodeSplit(), which needs to find the mid points on each edge and the center point, and create the child nodes, continuing to split until a min size is reached.
    Sounds simple, its just not working for me!
    The other part of the question is how should each node hold the objects in its bounds. Should an object be only in the smallest node that contains it. Or should the root node contain all objects, with each level having less and less objects?
    Objects will move around, so should each node contain a int[] of object indexes, instead of the actual objects?
    Id really appreciate any help!
    Thanks, Harley.

    Sounds simple, its just not working for me!Can you post your code?
    The other part of the question is how should each node hold the objects in its boundsI wouldn't use either of your suggestions. Instead, I'd have separate rules for a leaf node and a branch node. A leaf node holds any object it overlaps. A branch node holds objects which contain it but don't contain its parent.
    Objects will move around, so should each node contain a int[] of object indexes, instead of the actual objects?Of course not. You're storing a reference to the object, which takes up the same amount of memory as an int. And I'd use a Set rather than an array.

  • Quadtree index error

    Hi,
    I was trying to create a quadtree index and it kept returning the following error message:
    SQL> CREATE INDEX R_INDEX ON ROADS(ROAD)
    2 INDEXTYPE IS MDSYS.SPATIAL_INDEX
    3 PARAMETERS('SDO_LEVEL=4');
    CREATE INDEX R_INDEX ON ROADS(ROAD)
    ERROR at line 1:
    ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
    ORA-13203: failed to read USER_SDO_GEOM_METADATA table
    ORA-13203: failed to read USER_SDO_GEOM_METADATA table
    ORA-06512: at "MDSYS.SDO_INDEX_METHOD_9I", line 7
    ORA-06512: at line 1
    I have made sure that data has been put into user_sdO_geom_metadata view from the created spatial layer but the error remains the same.
    What could be the problem here?
    Thnx in advance

    Hi,
    Oracle recommends r-tree indexes in 9i and beyond in nearly all cases.
    But this error is not related to the spatial index type.
    Can you post the user_sdo_geom_metadata entry for this table?
    Thanks

  • There are problems with quadtree indexing in Oracle 8.1.7.4 for Linux

    I have patched my 8.1.7 database on Linux to 8.1.7.4.
    All my spatial data were indexed using quadtree indexing mechanizm.
    After the patch is proceeded, I'v rebuilt all spatial indexes (because all they became invalid).
    When I use window query type, the spatial query does not give right results!
    There are no errors, but not all geometries following in the query rectangle are selected.
    My spatial data does not use projection (the SRDIDs are 262148).
    If there is layer with other srid - there are no transformation between projections query rectngle and layer geometries (the query rectangle is with SRID = null).
    When I change indexing mechanizm to R-tree - there are no problems.
    What is the problem?

    I don't understand:
    My spatial data does not use projection (the SRIDs are 262148).
    What is 262148? It is an SRID that isn't in the 8.1.7.4 database.
    If the SRID isn't an issue, you might want to make sure the coordinate
    system bounds of the geometries match if your data is coming from two
    different tables and they both have quadtree indexes built on them.
    If the coordinate system bounds don't match, then you can see this kind of problem.
    Hope this helps,
    Dan

  • How to store R-tree in Orace?

    Hi,every bady!
    Who knows that how to store R-tree in Orace?In other words,R-Tree is the order stored in memory or a random store?
    any help would be appriciated
    lgs

    from a quick google:
    (Dictionary of Algorithms and Data Structures):
    http://www.itl.nist.gov/div897/sqg/dads/HTML/rtree.html
    Looks Spatial related, ... Indexing of Spatial Data:
    http://download.oracle.com/docs/html/A88805_01/sdo_intr.htm
    "Oracle Spatial lets you use R-tree indexing (the default) or quadtree indexing, or both. Each index type is appropriate in different situations."

  • PAYPAL $5: Debugging a runtime problem in my QuadTree inplementation...

    The following is a QuadTree implementation. It splits a map into four quadrants (and nodes) determined by a split point. The split point is the middle of two points clicked by the user. If a sub-quadrant (child node) already has a point, and you've selected another point in that quadrant, that quadrant is split into four quadrants (the kids on the tree).
    Almost Everything works fine except every once in a while you have to click twice to split a quadrant already containing a point (totally 3 points).
    I cannot figure out why it is skipping over a node that already contains a point, as if it doesn't exist. any help is appreciated, the one who helps me lose this headache/problem gets $5 cash through paypal.
    The insert method is the meat of what I'm doing. TIA.
    public class QuadTree {
        public QuadTree(Rectangle range) {
            mRoot = new QTNode(range);
         * insert the point into the tree
         * assume all inseted points are distinct
        public void insert(Point point) {
            mRoot.insert(point);
        } // insert()
    private QTNode  mRoot;
    } // class QuadTree
    class QTNode {
         * constructor
        QTNode() {
            mParent = null;
            mKids   = new QTNode[4];
            mDataPoint  = null;
            mRange      = null;
            mSplitPoint = null;
         * the constructor used by the QuadTree class
        QTNode(Rectangle range) {
            this();
            mRange = range;
         * inser the point to the subtree rooted at "this" node
         * @param  point the point to be inserted
        void insert(Point point) {
            int j;
            System.out.println(point);
            if ( mSplitPoint != null ) {
                 if ((point.getX()) >= (mSplitPoint.getX())){
                      if ((point.getY()) >= (mSplitPoint.getY())){ j=3; }
                      else { j=1; }
                 else {
                      if ((point.getY()) < (mSplitPoint.getY())){ j=0; }
                      else { j=2; }
                   mKids[j].insert(point);
                   System.out.println("Point inserted in" + j);
              else {
                   if ( mDataPoint != null ){
                      //sets the split point of the next layer of nodes    
                      Point tempSplit = new Point();
                      tempSplit.setLocation(((mDataPoint.getX()+(point.getX()))/2),((mDataPoint.getY()+point.getY())/2));              
                             setSplitPoint(tempSplit);
                      for (int k=0; k<4 ; k++){
                           mKids[k] = new QTNode();
                           mKids[k].setParent(this);
                           Rectangle tempRange = (getRange());
                           Rectangle tempRect = new Rectangle();
                           if (k == 0) {
                           tempRect.setRect(tempRange.getX(),tempRange.getY(),(mSplitPoint.getX()-tempRange.getX()),(mSplitPoint.getY()-tempRange.getY()));
                           mKids[k].setRange(tempRect);
                           System.out.println("rect0" + tempRect);
                           if (k == 1) {
                           tempRect.setRect(mSplitPoint.getX(),tempRange.getY(),(tempRange.getWidth()-(mSplitPoint.getX()-tempRange.getX())),(mSplitPoint.getY()-tempRange.getY()));
                           mKids[k].setRange(tempRect);
                           System.out.println("rect1" + tempRect);
                           if (k == 2) {
                           tempRect.setRect(tempRange.getX(),mSplitPoint.getY(),(mSplitPoint.getX()-tempRange.getX()),(tempRange.getHeight()-(mSplitPoint.getY()-tempRange.getY())));
                           mKids[k].setRange(tempRect);
                           System.out.println("rect2" + tempRect);
                           if (k == 3) {
                           tempRect.setRect(mSplitPoint.getX(),mSplitPoint.getY(),(tempRange.getWidth()-(mSplitPoint.getX()-tempRange.getX())),(tempRange.getHeight()-(mSplitPoint.getY()-tempRange.getY())));
                           mKids[k].setRange(tempRect);
                           System.out.println("rect3" + tempRect);
                           if ((mKids[k].getRange().contains(point)) == true){
                                     mKids[k].setDataPoint(point);
                   else { mDataPoint = point; }
        // FILL ANY METHOD AS NEEDED
        private void setSplitPoint(Point split) {
            mSplitPoint = split;
        private void setParent(QTNode parent) {
            mParent = parent;
        private void setRange(Rectangle range) {
            mRange = range;
        private void setDataPoint(Point point) {
            mDataPoint = point;
        QTNode getParent() {
            return mParent;
        QTNode getChild(int pick) {
            return mKids[pick];
        Point getDataPoint() {
            return mDataPoint;
        Rectangle getRange() {
            return mRange;
        private final int eTR = 0;  // index of the Top    Right  region/kid
        private final int eTL = 1;  // index of the Top    Left   region/kid
        private final int eBR = 2;  // index of the Buttom Right  region/kid
        private final int eBL = 3;  // index of the Buttom Left   region/kid
         * All the point data are stored in the leaf nodes of the quadtree.
         * That is, after a node splitted (then it has four kids)
         * the point data originally stored has been moved to one of its kid
         * whose range covers the point.
        QTNode    mParent;      // reference to the parent
        QTNode    mKids[];      // reference to the 4 kids
        Point     mDataPoint;   // the point data if any
        Rectangle mRange;       // the range covered by this node
        Point     mSplitPoint;  // where the vertical and horizontal
                                //   split lines meet
    } // class QTNodeThe area is question is in bold, it has been coded by myself.

    selfbump, please hellp me :-)

  • Engineering simulations and quadtree

    Hi all, i want to make an engineering simulation about heat transfer and i need to learn how to realize this king of applications. I stuid about computer graphics, game development, bsp tree but this is not enough to make solid shapes so i can implement temperature scale on shape by coloring that shapes. I think this is relevant to quadtree. What i want to do;
    to create a skeleton algorithm.
    Am i right in this way? If so, how can find tutorial, ebook, code examples about quadtrees. Or is there any way to make that sort of applications? Where can start from? What ways shall i follow?

    Please, do not create double posts. That is not appreciated at all.

  • Implementing a quadTree in labVIEW

    I am trying to use a quadTree to efficiently store a 2-D map of data but have been having trouble figuring out how to go about it. I have written an implementation for a quadTree in Java and have been having some issues with the logistics for a labVIEW version. Has anyone else gotten something like this to work? I think it might be possible is I create a generic bundle for the quad nodes but I am unsure how to create it if the node would store its 4 children nodes inside of it. I am also a bit confused about how to deal with an empty node and how or if LabVIEW is able to deal with the concept of a "null" node. Thank you very much for your help.

    The "nodes" i am refering to are the individual elements in the tree so in the case of a quad tree each "node" would store some data as well have space for 4 references to "nodes" ie the nodes children. I have used clustering before and I thought it might be a good place to start I am just unsure how to create a new insance of a cluster, the "node", dynamicaly so I would not have to create a set number of "nodes" before the program starts. How the quadTree works in say java, is that if a new piece of data is added to a node that already has data, the node will split itself into 4 equal sized children and store the data which creates new nodes as the program is running. 
    With that in mind, I am looking to implement this quadTree functionality in labVIEW to store data about a 2-D environment efficiently with the ability to say find all objects inside a given search area. The data I want to store about each point will be minimul, probably just a char or single number, but the bounds of the 2-D environment will be defined at runtime. The data structure will be holding a lot of points, on the order of at least several hundered points, and also needs to be able to scale with out being bogged down to much. 
    Thanks again for the informantion. I have done a good amount of LabVIEW programming just not when dealing with creating advanced data structures. 

  • Question regarding quadtree creation

    Hi experts,
    I know that the use of quadtree is discouraged but I am wanted to create one on an sdo_geometry column, but it failed.
    I don't quite understand why.
    Does it need a particular entry in user_sdo_geom_metadata that is different from r-tree?
    here is the error:
    SQL> create index test_qtidx
    2 on test(POINTS)
    3 indextype is mdsys.spatial_index
    4 parameters('sdo_level=8');
    create index test_qtidx
    ERROR at line 1:
    ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
    ORA-13249: internal error in Spatial index: [mdidxrbd]
    ORA-13249: Error in Spatial index: index build failed
    ORA-13206: internal error [Tessellate] while creating the spatial index
    ORA-13249: Error in spatial index: [mdpridxtessellate]
    ORA-06512: at "MDSYS.SDO_INDEX_METHOD_10I", line 10
    Any ideas?
    Thanks very much for taking the time to read this post.
    Cheers,
    F.

    Hi Siva,
    thanks for your answer.
    I have the following enrty in user_sdo-geom_metadata:
    SQL> select * from user_sdo_geom_metadata where table_name='LIDAR_SUB100';
    TABLE_NAME
    COLUMN_NAME
    DIMINFO(SDO_DIMNAME, SDO_LB, SDO_UB, SDO_TOLERANCE)
    SRID
    LIDAR_SUB100
    POINTS
    SDO_DIM_ARRAY(SDO_DIM_ELEMENT('Longitude', 315262, 315264, .0000015), SDO_DIM_EL
    EMENT('Latitude', 233388, 234360, .0000015), SDO_DIM_ELEMENT('Elevation', -49, 7
    8, .00015))
    TABLE_NAME
    COLUMN_NAME
    DIMINFO(SDO_DIMNAME, SDO_LB, SDO_UB, SDO_TOLERANCE)
    SRID
    29903
    Also, I have read that it is possible to maintain different indexes on the same column. If the user_sdo_geom_metadata table has to be changed in order to accommodate quadtree, how can two indexes be maintained at the same time?
    Cheers,
    F.

  • R-Tree Indexing

    Hi.
    Is it possible to direct in which tablespace the R-tree index table will go.
    I know that you have a tablespace parameter in creating a quadtree index but I can't find one when creating the R-tree index.
    I'm using Oracle 8.1.7
    Johan

    An index entry is created in the SYSTEM tablespace but the spatial indices are created in the tablespace you specify. To verify it execute the following:
    select table_name,tablespace_name
    from user_tables
    where table_name like 'spatial_table%';
    It will return your table_name plus the spatial index table created for it.
    The table_name will look something like this:
    spatial_table_SX_FL10$ for fixed quad tree and spatial_table_RT$ for rtree.
    You can query the same for the indexes built on that previous table.
    select index_name,tablespace_name
    from user_indexes
    where table_name = 'SPATIAL_TABLE_SX_FL10$';
    The two index names would look like:
    spatial_table_sx_fl10$B1
    spatial_table_sx_fl10$B2
    They should be created in the tablespace specified in the tablespace parameter when creating the spatial index.
    Does that help any?
    Dave
    null

  • Problem with trees and memory handling.

    Hi there, I just want to know if, when I create a large binary tree, and I re-"pointed" the root pointer to another node somewhere below in that same tree (say, a terminal node), will the "upper" parts of the tree (starting from the new root node) be removed/deleted from memory? Please explain your answers.
    Thank you.

    f I changed the root to B, will A and its children be
    deleted from memory?If you do root = B, AND if nothing else is referring to A or C or anything else beneath them, then A, C, and all of C's children will become eligible for garbage collection.
    Whether the memory actually gets cleaned up is something you can't really predict or control, but it doesn't really matter. If it's needed, it will get cleaned up. If it's not needed, it may or may not get cleaned up, but your program won't care.
    So, in short, yes, for all intents and purposes, A's, C's, and C's descendants' memory is released when you re-root to B.

  • How to blick tree view few specific nodes

    here i got a code which show how to blink tree view node but i am confuse that how to blink few node.
    Answered by:
    Avatar of Tamer Oz
    20,185
    Points
    Top 0.5
    Tamer Oz
    Partner Joined Sep 2009
    2
    8
    17
    Tamer Oz's threads
    Show activity
    Treeview control - How to make a node blink?
    Visual Studio Languages
    .NET Framework
    >
    Visual C#
    Question
    Alert me
    Question
    Vote as helpful
    0
    Vote
    Hi,
    Is there a "elegant" way to make blink a treeview node?
    I am thinking to use a timer with the collection of nodes that I want to make the blink effect, and update the icon ...
    Friday, November 06, 2009 6:19 PM
    Reply
    |
    Quote
    |
    Report as abuse
    Avatar of Kikeman
    Kikeman
    R. BOSCH
    105 Points
    All replies
    Question
    Vote as helpful
    0
    Vote
    Hi,
    You can develop your custom control for this purpose. The logic you mentioned was correct. Here is a sample control that I developed by the logic you mentioned.
    public class BlinkingTreeView : TreeView
    private Timer t = new Timer();
    private List<TreeNode> blinkingNodes = new List<TreeNode>();
    public BlinkingTreeView()
    t.Interval = 1000;
    t.Tick += new EventHandler(t_Tick);
    bool isNodeBlinked = false;
    void t_Tick(object sender, EventArgs e)
    foreach (TreeNode tn in blinkingNodes)
    if (isNodeBlinked)
    //update Icon
    tn.Text = tn.Text.Substring(0, tn.Text.Length - 1);//to test
    isNodeBlinked = false;
    else
    //update Icon
    tn.Text = tn.Text + "*";//to test
    isNodeBlinked = true;
    public void AddBlinkNode(TreeNode n)
    blinkingNodes.Add(n);
    public void RemoveBlinkNode(TreeNode n)
    blinkingNodes.Remove(n);
    public void ClearBlinkNodes()
    blinkingNodes.Clear();
    public List<TreeNode> BlinkingNodes
    get { return blinkingNodes; }
    public int BlinkInterval
    get { return t.Interval; }
    set { t.Interval = value; }
    public void StartBlinking()
    isNodeBlinked = false;
    t.Enabled = true;
    public void StopBlinking()
    t.Enabled = false;
    just show me how to use BlinkingTreeView class. i will have tree view which will have few node and few nodes may have few child nodes. now how to achieve by this class BlinkingTreeView and show me how to blink few specific node not all. thanks

    better to come with code. first populate tree view with some dummy node this way
    Root
           Child1
                    Child1-sub1
                    Child1-sub2
           Child2
                    Child2-sub1
                    Child2-sub2
    now blink Child1-sub2 & Child2-sub1. please come with code. thanks

  • Follow up Tree Question

    Hey,
    Using the arrows, when I open one tree node, I want other
    tree nodes to close. I saw a sample that sepiroth had done, but I
    don't want to click on the whole bar. I just want to use the arrows
    to expand and contract. Any help would be great. I have attached
    the code

    If you just wish to make a duplicate of one hard drive to another hard drive in the same G5, then do this:
    Clone using Restore Option of Disk Utility
    Open Disk Utility from the Utilities folder.
    Select the destination volume from the left side list.
    Click on the Restore tab in the DU main window.
    Check the box labeled Erase destination.
    Select the destination volume from the left side list and drag it to the Destination entry field.
    Select the source volume from the left side list and drag it to the Source entry field.
    Double-check you got it right, then click on the Restore button.
    Destination means the second internal drive. Source means the internal startup drive.

Maybe you are looking for

  • File --- to--- Soap(web service)

    Hi all, i am doing  File ->to->Soap(web service) scenario. my requiremenmt would be 1.Can we able to re-trigger failed & successful messages 2.Can we we able send the consolidated XML for the day irrespective of individual xml's 3.we able to send the

  • SAP ABAP Client proxy Errror occured when determining the Business system.

    Dear Friends    I am trying to push data from ECC to PI and then MS-SQL Server. My SAP scenario is ABAP Proxy to JDBC   I have created on Enhancement Implementation for AS01 ( Asset Master creation). Here I am calling my ABAP proxy and uploading ANLA

  • HTTP POST to PHP server problem

    Hi, im trying post a long string to php from a MIDLET, but i have some problems. When i send the whole String, my php server cant receive the request (i have not any response), but, if the string that i send is 1/5 from the original, the process is s

  • Error 6030 caused by Display Miniport

    I was getting the 6030 error over the weekend, and found that it was happening whenever I was connecting my laptop to TV using the display miniport (a square-ish port on my laptop similar to USB that is apparently commonly used on Apple products), bu

  • My store is not working

    I tried to open my store put it's not opening it's says"the store is not available in ur town"