Mohit Sindhwani <ml3p@...> writes: > However, since these are points that are stored in the table, x1=x2 and > y1=y2 when we do the insertion. As a former embedded systems engineer, > this feels like a waste since I can see that we are inserting exactly > the same value into the table. > > INSERT into data_rtree(1000, 10, 5, 10, 5); > INSERT into data_rtree(1000, 17, 1, 17, 1); > and so on. > > Is there a way that we could optimize the module so that we don't need > to store the same value twice?
Not sure why you think you have to store those point coordinates twice. This works: sqlite> CREATE VIRTUAL TABLE abc USING rtree(id,x,y); sqlite> INSERT INTO abc VALUES(1,20,30); sqlite> SELECT id FROM abc WHERE x>=10 AND x<=30 AND y >=20 AND y<=40; 1 sqlite> SELECT id FROM abc WHERE x>=40 AND x<=50 AND y >=40 AND y<=50; sqlite> HTH, Wolfgang _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

