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 `t1` ADD INDEX `t1_idx_date` (`date`);
SELECT
*
FROM
t1
WHERE
(
(
@StartDate IS NULL
AND @EndDate IS NULL
)
OR (
t1.date >= @StartDate
AND t1.date <= @EndDate
)
OR (
t1.date >= @StartDate
AND @EndDate IS NULL
)
OR (
@StartDate IS NULL
AND t1.date <= @EndDate
)
)