Best Database for this, NOSQL vs MySQL
I have an App based around Events and Branches. I have two events ones
with Branches and ones Without.
Both Events and Branches have a latitude and longitude.
An Event can have Multiple Branches. I want to sort these Events by
Distance from another geo-coordinate.
For the Events with Branches it should use the location of its branches to
work out how close it is and for the Events without it should use the
location of the event itself.
Is this possible to do in MySQL without a performance hit ? Or am I using
the wrong kind of Database ? Should I use another NOSQL database with a
script to export the current MySQL and Pods data to it.
This is the basic query I'm using ATM with this Framework which adds a
small bit of sugar (Obviously this wouldn't work in plain MySQL), Events
without Branches don't seem to appear in the correct order.
SELECT t.*, DISTANCE(\"$latitude\", \"$longitude\",
IF(t.branches.latitude, t.branches.latitude, t.latitude),
IF(t.branches.longitude, t.branches.longitude, t.longitude)) as distance
FROM table as t ORDER BY distance.
No comments:
Post a Comment