Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
Reducing data loading time (PHP/MySQL)
Old 09-24-2006, 09:59 PM Reducing data loading time (PHP/MySQL)
Junior Talker

Posts: 2
Trades: 0
Hi All

At present i am working with a database that contains all countries and their cities. My database is in mysql. The city table contains 3079703 cities.

When a user selects a country i need to populate the city dropdown for that country. I use Ajax technology to retrieve city from database based on the selected country.

But I am facing a problem with the speed as it takes a long time to retrieve city data and return generated dropdown control from server using php.


I have already tried to use filebased caching (transferring all the city data into separate files for each state and country) and then tried to load from these files but didn't gain any significant speed improvement. I also then tried using indexing in city table on country code and state code but it still takes time to load.

Could someone please give me any suggestions, techniques or optimisation tips so that i can load the cities within a short time.

Thanks in advance.
nikster is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-25-2006, 06:17 AM Re: Reducing data loading time (PHP/MySQL)
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
you need to optimise the queries, but without knowing the data structures it's impossible to be precise.

One quick way would be to redesign any queries using "SELECT * FROM ..." to use a fieldlist instead.

I doubt that using AJAX is the most efficient way either as it is obviously very dependent on the client browser for the operational speed.
Some things are best done with a round trip to the server.
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 09-25-2006, 08:15 PM Re: Reducing data loading time (PHP/MySQL)
Junior Talker

Posts: 2
Trades: 0
Hi

Thanks for your reply, I managed to resolve the speed issue by creating separate tables for all the city data and it now loads quite quickly.

Thanks again for your suggestion.
nikster is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Reducing data loading time (PHP/MySQL)
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.07669 seconds with 12 queries