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 `table3` ADD INDEX `table3_idx_subid` (`subid`);
SELECT
t1.id,
t1.name,
t2.subname,
t2.refvalue
FROM
table1 AS t1 CROSS APPLY (SELECT
TOP 1 t2.subid,
t2.subname,
t3.refvalue
FROM
table2 AS t2
INNER JOIN
table3 AS t3
ON t2.subid = t3.subid
ORDER BY
lastupdated DESC) AS t2