In Is there a way to hint to query optimizer to MySQL which constraints should be done first? I created a subquery.
The subquery is often not optimized.
I think a better way is to create a temporary table and then query that temporary table.
The problem is say I create a temporary table and name that "BusinessesWithinABox" table, which are businesses in the area I am interested in, say 10 by 10 km squares.
Say I have 300 users.
All of which create this temporary tables named BusinessWithinABox. Yes I know that the tables are temporary.
Then when I do query, which tables go which?
Actually some tutorial detail on how to create temporary tables and run and use that in PhP would be fine.