2012/12/14 Martin Schafran <[email protected]> > use ssd, > cluster nodes on spatial index, > perform vacuum > and show us your query. >
Thanks a lot for the advice. The query as I previously mentioned it would be as simple as a "SELECT * FROM db WHERE X=X AND DISTANCE<5km". There wouldn't be more type of queries. 2012/12/14 Christian Vetter <[email protected]> > Hi, > > If the only thing you are interested in is asking for the amount of points > within a given radius, I would strongly advise not to use a database, but > quickly implement a dedicated data structure for that. That can usually be > an order of magnitude faster than a general purpose database. > > E.g. consider a simple KD-Tree [1]: > > When doing you query you can simply stop recursion if the current block is > completely within the given circle. > You can implement a KD-Tree in a really lightweight manner, completely > implicitly. Just storing the coordinates, the KD-Tree structure is encoded > in the ordering of them. You can have a look at an example [2]: Have a look > at the function NearNeighbors, it could easily be modified to count the > amount of points instead of returning them. > > The only reason I could think of for using a database is, that you have to > handle much more data than fits into memory. However, even in that case a > specialized data structure should perform better - it's only more effort to > implement :-) > > Best regards, > > Christian Vetter > > [1]: http://en.wikipedia.org/wiki/K-d_tree > [2]: > http://code.google.com/p/monav/source/browse/plugins/osmimporter/statickdtree.h > > > Hmmm, didn't thought about this. I don't know about K-D trees but I will search for information about it. Thank you very much.
_______________________________________________ dev mailing list [email protected] http://lists.openstreetmap.org/listinfo/dev

