stubarny Posted March 7, 2012 Share Posted March 7, 2012 Hello, I have the following sql query which joins two tables. Quote SELECT * FROM research_job_searches_results INNER JOIN geocodes ON research_job_searches_results.research_job_searches_results_company_location_description = geocodes.geocode_location WHERE (geocodes.geocode_latitude < '26.090402914763' AND geocodes.geocode_latitude > '25.367567085237' AND geocodes.geocode_longitude < '-79.876001085237' AND geocodes.geocode_longitude > '-80.598836914763') ORDER BY research_job_searches_results.research_job_searches_results_index DESC LIMIT 0, 100 To speed things up I'd like to set up an index made up of all the columns that have conditions specified in the query: research_job_searches_results.research_job_searches_results_company_location_description research_job_searches_results.research_job_searches_results_index geocodes.geocode_latitude geocodes.geocode_location geocodes.geocode_longitude Please could you tell me if it is possible to create an index that covers 2 tables? Or should I create two indexes, i.e. one for each table? ... i.e. one index for: research_job_searches_results.research_job_searches_results_company_location_description research_job_searches_results.research_job_searches_results_index and another index for... geocodes.geocode_latitude geocodes.geocode_location geocodes.geocode_longitude Many thanks, Stu Link to comment https://forums.phpfreaks.com/topic/258486-is-it-possible-to-create-indexes-in-mysql-across-two-tables/ Share on other sites More sharing options...
fenway Posted March 11, 2012 Share Posted March 11, 2012 What does this query do, exactly? Link to comment https://forums.phpfreaks.com/topic/258486-is-it-possible-to-create-indexes-in-mysql-across-two-tables/#findComment-1326249 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.