This is my SQL query:
SELECT B.TransactionId
FROM BillingInfo B
INNER JOIN OfficeCustomers OC ON B.CustomerId = OC.Id
INNER JOIN CustomerContact CC ON CC.Id = OC.ContactId
WHERE CC.FirstName + ' ' + CC.LastName LIKE '%yog%'
ORDER BY B.TransactionId
OFFSET (0) ROWS FETCH NEXT (50) ROWS ONLY
This query takes around 6 seconds to complete. What can be done to improve the performance?
1条答案
按热度按时间rggaifut1#
The two comments are accurate.
If possible, replace
LIKE '%yog%
byLIKE 'yog%
.You can also try the following query:
You can also create the following index: