Re: Better search algorithm?
Date: 23 Jul 2001 22:25:44 -0700
Message-ID: <57da7b56.0107232125.218c0529_at_posting.google.com>
newsgroups_at_makethematch.com (Jason Chancellor) wrote in message news:<a19c9a2e.0107231155.7f3c4dd8_at_posting.google.com>...
> Hello, I am working on a project which is beginning to show some
> performance issues, and I have been trying some different techniques
> with no better results....so I thought I would ask around for some
> advice.
[ snip ]
> So here I am, totally out of ideas... Can anyone think of a better
> way to perform the search I am trying to do, or can anyone point me
> to a book or a URL of some info that might be of help?
Use a DBMS that implements a spatial access method. PostgresSQL, for example, supports a R-Tree that reduces your query to something like:
SELECT H1.Stuff
FROM Lonely_Hearts H1, Lonely_Hearts H2
WHERE H1.Still_Lonely = 'TRUE'
AND Within ( H2.Location, Circle ( H1.Location, 0.3)) AND H1.Chemistry MATCHES H2.Chemistry;
This kind of query will perform a lot better than the nested loop operation you're probably doing now. You might also Google (R-Tree, Database) for other DBMS products that implement a spatial access method. Plus it will give you a segue into the "location based services" when the location is to be found on the cell phone and "zip code" ain't gonna cut it.
It might come as a shock, but DBMS products are not inter-changeable commodities. They possess overlapping, but still quite different functionality.
Hope this helps.
KR
Pb Received on Tue Jul 24 2001 - 07:25:44 CEST