I have this query in access and it is slow to return the result.
I added some index but I could notice that its performance was not satisfactory.
CESTPAL has 880 rows
CADPAL has 7500 rows
Is there another way to do it where I can improve the result speed?
SELECT COUNT(*) AS TOTAL
FROM CADPAL AS A
WHERE A.CP_CODIGO IS NOT NULL
AND (A.CP_CODUSO="SI" OR A.CP_CODUSO='20')
AND EXISTS (Select C.CS_CODPAL FROM CESTPAL C
Where (C.CS_CODUSO="SI" or C.CS_CODUSO='20')
and A.CP_CODIGO = C.CS_CODPAL