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:
ALTER TABLE `vw_LeadTime` ADD INDEX `vw_leadtime_idx_dateended` (`dateEnded`);
ALTER TABLE `vw_LeadTime` ADD INDEX `vw_leadtime_idx_datecreated` (`dateCreated`);
SELECT
vw.dateCreated,
vw.dateEnded,
(SELECT
COUNT(*)
FROM
vw_LeadTime vw2
WHERE
vw2.dateCreated >= vw.dateCreated
AND vw2.dateCreated <= vw.dateEnded) AS CountInTimePeriod
FROM
vw_LeadTime vw
WHERE
vw.dateEnded IS NOT NULL
AND vw.dateCreated > '5/17/2011'