Page is a not externally linkable
- Code, Content, and Presentation
-- Databases
---- Simple mysql select query very slow


ferly_man - 4:28 pm on Sep 16, 2010 (gmt 0)


^precisely.

There is a good, scratch that, great chance that I do not have *every* city/region/location on the map, so I do offer the opportunity for a user to submit a location for inquiry. I then manually reference that location to confirm, and input into the db if it's legit.

I made the mistake several years ago of allowing users to enter their own city by way of text-field. I ended up with 20 different variations to each city. It was a nightmare.

In the meantime (while working locally on implementing a new structure), I placed a few indexes in place and the system seems to be working much better.

My only issue with the proposed structure is, how does the system know - based on the location in the URL (for SEO reasons) - where to draw listings from? For example...

url: /united-states/california/los-angeles-county/los-angeles/

That is an example url. Cuurently, I query the db based on the last location in the URL (los-angeles). I use a PHP function that breaks apart the URL to give me an array of all the locations in the URL, with los-angeles in this case, being the last entry in the array. Very simple way of querying the db (... WHERE `region_x_slug` = 'los-angeles' ...) is an example where clause.

How would I now, without changing the URL structure whatsoever, work with a new db structure consisting of numeric values only (as I would no longer be querying based on text-values).

I hope all that makes sense ;)

Thanks for all the replies!


Thread source:: http://www.webmasterworld.com/databases_sql_mysql/4201327.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com