
RML an order of magnitude faster RTL: 11 sec and 330 ms RML: 340 ms and 50 ms RML output attached On 10/21/05, Arkadiy Vertleyb <vertleyb@hotmail.com> wrote:
"Calum Grant" <calum@visula.org> wrote
I frankly have no idea how I would implement that problem in SQL, but then this was a problem you chose to be very difficult to solve using a SQL notation.
I am not an SQL expert, but should be something like this (if I remember correctly):
SELECT number, name, city, COUNT(*) AS cnt FROM mytable a, mytable b WHERE [the long condition based on coordinates] GROUP BY a.number ORDER BY cnt DESC;
Then you hope that the optimizer figures out how to not compare every possible pair ;-)
This exact statement I modeled in RTL, but RTL also specifies HOW to do things in addition to WHAT to do, so I was able to do a smartrer (range-based) query.
I am thrilled with your performance results, though (although I consider them the results of a by-hand solution). Did you completely avoid calculating the distance? If so, I think any such solution would provide only approximate result (although it might happen to be a pretty good approximation).
Regards, Arkadiy
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost