I am writing a web page to find the closest retail stores to a given zip code by cross referencing a zip code db with lat and long coordinates.
The calculation to find the distance between 2 zip codes is not trivial and I want to minimize the number of queries on the MySQL database.
I need to know how many total stores there are that meet the criteria and bring back only x number at a time. I am using a navigator to go to the next page of records when the total exceeds the limit per screen I have set.
Currently I am doing this in 2 queries, 1 to get the total number of records that meet the criteria, and then another to bring back the subset of records I want out of the list.
The other way I have considered doing this is to bring back all of the records and store the results into an array so I only do one query.
But there is a lot of data poetentially to bring back.
Is there a rule of thumb or guideline for determining an acceptable amount of data I can store in an array before I use up too much server memory?
Any other thoughts?
Thanks.