Page 2 of 2
Re: PHP code seems too slow for the database? Any ideas?
Posted: Mon Oct 04, 2010 2:10 pm
by tloftis
I am working on getting the code sorted so I can get some answers. thanks for the input so far. It may get the programmer thinking about something new.
Re: PHP code seems too slow for the database? Any ideas?
Posted: Mon Oct 04, 2010 4:15 pm
by tloftis
can you send php script as a file?
Re: PHP code seems too slow for the database? Any ideas?
Posted: Mon Oct 04, 2010 4:16 pm
by tloftis
distances are calculated by long and lat and it is a script in itself.
Re: PHP code seems too slow for the database? Any ideas?
Posted: Mon Oct 04, 2010 4:57 pm
by JoeCommodore
tloftis wrote:distances are calculated by long and lat and it is a script in itself.
I'm not a math wiz but such queries with lat/longitude have been done in SQL.. Maybe someone can provide the resources on doing it.
A quick search found this discussion on zip code proximity searches - which looks promising:
http://forums.mysql.com/read.php?23,3868,3868#msg-3868
Re: PHP code seems too slow for the database? Any ideas?
Posted: Mon Oct 04, 2010 8:17 pm
by John Cartwright
Your not going to get very far with us until you post some code! Theory is only as good as it's implementation.
I'm not saying you need to post your code, but it would certainly allow us to suggest practical improvements.
To each his own though.
Re: PHP code seems too slow for the database? Any ideas?
Posted: Wed Oct 20, 2010 10:29 am
by tloftis
Jonah Bron wrote:I believe it could be either way. It could be a grossly inefficient search mechanism, or the server could be really really wimpy. In fact, thinking about it, the former seems like it would be the most likely.
The speed advantage of using Java would be negligible.
how can I test the speed of the server to see if that is what it is?
Re: PHP code seems too slow for the database? Any ideas?
Posted: Wed Oct 20, 2010 10:31 am
by tloftis
JoeCommodore wrote:tloftis wrote:distances are calculated by long and lat and it is a script in itself.
I'm not a math wiz but such queries with lat/longitude have been done in SQL.. Maybe someone can provide the resources on doing it.
A quick search found this discussion on zip code proximity searches - which looks promising:
http://forums.mysql.com/read.php?23,3868,3868#msg-3868
the lat and long are done in the SQL database.
Re: PHP code seems too slow for the database? Any ideas?
Posted: Fri Dec 03, 2010 12:06 pm
by tloftis
Code: Select all
SELECT a.*, u.user_status, u.user_active, u.zip, t.distance, tp.photo, (SELECT make_title FROM make_master m WHERE m.make_id = a.make_id) AS make_title, (SELECT model_title FROM model_master mo WHERE mo.model_id = a.model_id) AS model_title, (SELECT graphic_tile FROM order_master om WHERE om.user_id = a.user_id) AS graphic_tile FROM ad_master a LEFT JOIN user_master u ON u.user_id = a.user_id LEFT JOIN temp_distance_calculation t ON t.car_id = a.ad_ms_id LEFT JOIN temp_photo_calculation tp ON tp.car_id = a.ad_ms_id LEFT JOIN photo_master p ON p.vin = a.vin WHERE a.ad_ms_id IN ('15889','16174','16501','1670'22214','22215','22216','22217','22218','22219','22220') AND a.user_id != 0 AND u.user_status = 'p' AND u.user_active = '1' AND u.zip != '' AND ROUND(t.distance) <= '10'
I cut out about half of the zip-codes because this was too long. This is what is happening now when you try to search on
http://nabacar.com.
Re: PHP code seems too slow for the database? Any ideas?
Posted: Fri Dec 03, 2010 12:16 pm
by tloftis
I think that code is what you wanted.
Re: PHP code seems too slow for the database? Any ideas?
Posted: Fri Dec 03, 2010 2:04 pm
by Benjamin
Post the db schema and the slow query(s).
Re: PHP code seems too slow for the database? Any ideas?
Posted: Fri Dec 03, 2010 6:47 pm
by tloftis
I will have to find out where to get those. sigh.... lol let me browse around in the schema.
Re: PHP code seems too slow for the database? Any ideas?
Posted: Fri Dec 03, 2010 6:48 pm
by tloftis
I wish I personally knew someone on this site and I would just let them go and get it for me. then I could learn what I need to do.