Re: Slow Query

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Wendell Frohwein wrote:

<snip>

So I rewrote my script to do the follow:
The client submits a property for an appraisal.
Based on the appraisal type and property zip code, It does a radius
search of 2 miles from the property zip. If no matches are found, it
does a 5 mile radius search. For every zip code returned by each radius
search, It searches the database for agents / appraisers with the zip
code in question (zip codes from radius search) in there coverage.

This is the most stressful part I am assuming. This works fine for 1 -
10 orders. But when I import 30 or more, the script pretty much hangs as
well as mysql. I have to kill mysql with signal 9, start mysql it up
again. Then all is back to normal. I would paste the code in here but it
is really long and complicated.

<snip>

there was/is a thread going on at php-generals regarding zipcode-long/lat issues (you may have seen it).

one of the things that came up is doing the joins on the tables in question (and/or doin the maths) is heavy work. I would imagine that the results for a given calculation (i.e. get postcodes with certain radius) stays the same, if they do then it may be an idea to do the calculation before hand and store the results in a way that its very fast to access e.g. writing out PHP arrays into files for later inclusion as required (possibly because new postcodes are occasionally added you may want that to trigger a recalculation - e.g. when a new postcode is added do the calculation then for all postcodes found do a recalculation for those as well!).

so...It doesn't sound like you can get round the ammount of processing that needs to be done but maybe you can do it 'offline' and store the results for quick access when you need it?

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux