php - How to join multiple tables faster -


i'm dealing old structure , bad design database loose , complicated. sadly, have it. :(

the old method used php query each info table. re-coded join. big problem occured. takes minute query these info (sometimes more).

here's code:

select *, car_db.id cid, tbl_province.province_name prov_name, config_car_color.color_title clr_title,  config_car_color.description clr_desc,  car_viewer.vwr_id viewers  car_db  inner join tbl_province on tbl_province.province_code=car_db.prov  inner join config_car_color on config_car_color.id=car_db.color  inner join car_viewer on car_viewer.vwr_cid=car_db.id  car_db.tid='$_tid' 

from latest query of code took 3.37 secs. takes @ least 30 secs run code.

the question please suggest me best way process these lines faster.

create following indexes:

car_db (tid) tbl_province (province_code) -- might pk config_car_color (id) -- might pk car_viewer (vwr_cid) 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -