Jump to content

Is it possible to create indexes in mysql across two tables?


stubarny

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.