I want to fix some performance issue with the following query.
- Tbl_A has 65 million rows
- Tbl_B has 2 rows
I need to filter Tbl_A with the values of Tbl_b
SELECT COUNT(*)
FROM Tbl_A R1 WITH (NOLOCK)
INNER JOIN Tbl_B PBD
ON PBD.Indicators = CASE R1.Indicator WHEN 'Y' THEN 'B'
WHEN 'N' THEN 'D'
WHEN '1' THEN 'B'
WHEN '0' THEN 'D'
ELSE R1.Indicator
END
I have tried using in & exists instead of join, but I cant find any performance benefits. Please assist.