PHP code seems too slow for the database? Any ideas?
Moderator: General Moderators
Re: PHP code seems too slow for the database? Any ideas?
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?
can you send php script as a file?
Re: PHP code seems too slow for the database? Any ideas?
distances are calculated by long and lat and it is a script in itself.
-
JoeCommodore
- Forum Newbie
- Posts: 15
- Joined: Fri Oct 01, 2010 10:16 pm
Re: PHP code seems too slow for the database? Any ideas?
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.tloftis wrote:distances are calculated by long and lat and it is a script in itself.
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
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: PHP code seems too slow for the database? Any ideas?
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.
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?
how can I test the speed of the server to see if that is what it is?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.
Re: PHP code seems too slow for the database? Any ideas?
the lat and long are done in the SQL database.JoeCommodore wrote: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.tloftis wrote:distances are calculated by long and lat and it is a script in itself.
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?
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'Re: PHP code seems too slow for the database? Any ideas?
I think that code is what you wanted.
Re: PHP code seems too slow for the database? Any ideas?
Post the db schema and the slow query(s).
Re: PHP code seems too slow for the database? Any ideas?
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?
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.