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 `docs` ADD INDEX `docs_idx_superceded_name_effective` (`superceded_by`,`name`,`effective_on`);
SELECT
docs.`value`
FROM
docs
WHERE
docs.superceded_by IS NULL
AND docs.name = 'p1'
AND docs.effective_on = (
SELECT
max(docs.effective_on)
FROM
docs
WHERE
docs.superceded_by IS NULL
AND docs.effective_on <= '2017-01-01'
AND docs.name = 'p1'
)