[Solved] mysql date query, can find date between two dates, but not date =

How to optimize this SQL query?

In case you have your own slow SQL query, you can optimize it automatically here.

For the query above, the following recommendations will be helpful as part of the SQL tuning process.
You'll find 3 sections below:

  1. Description of the steps you can take to speed up the query.
  2. The optimal indexes for this query, which you can copy and create in your database.
  3. An automatically re-written query you can copy and execute in your database.
The optimization process and recommendations:
  1. Create Optimal Indexes (modified query below): The recommended indexes are an integral part of this optimization effort and should be created before testing the execution duration of the optimized query.
Optimal indexes for this query:
ALTER TABLE `tls_active_applicants` ADD INDEX `tls_applicants_idx_first_name_gwf` (`first_name`,`gwf`);
ALTER TABLE `tls_connect_stage_timer` ADD INDEX `tls_stage_idx_event_start` (`event_start`);
The optimized query:
SELECT
        kpi.id,
        kpi.event_start,
        kpi.gwf,
        aa.first_name,
        aa.last_name,
        kpi.visa_type,
        aa.date_scheduled,
        kpi.stage 
    FROM
        tls_connect_stage_timer kpi 
    INNER JOIN
        tls_active_applicants aa 
            ON aa.gwf = kpi.gwf 
            AND kpi.event_start = '2014-2-19' 
            AND aa.first_name = 'Todd'

Related Articles



* original question posted on StackOverflow here.