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 `HDR` ADD INDEX `hdr_idx_printedbilltrustflag` (`PrintedBillTrustFlag`);
ALTER TABLE `LedgerLogEvent` ADD INDEX `ledgerlogevent_idx_ledgerid_genid_eventid` (`LedgerID`,`GenID`,`EventID`);
SELECT
HDR.PrintedBillTrustFlag
FROM
HDR
WHERE
EXISTS (
SELECT
1
FROM
USESIDW_FastAccess.dbo.LedgerLogEvent LLE
WHERE
HDR.LedgerID = LLE.LedgerID
AND HDR.GenID = LLE.GenID
AND LLE.EventID IN (
25, 53, 54
)
)
AND HDR.PrintedBillTrustFlag = 0