SELECT COUNT(*)
FROM EMPLOYEES
WHERE DEPARTMENT_ID = DEPARTMENTs.DEPARTMENT_ID AND rownum < 2
Although the advantages are tha twe do not have more VO for the calculation, but
the problem is that this select is performed for every row and so if it has a count(*) like above it will break performance.
So if performance is a must try to refactor (depending on the rest requirements) your query like
SELECT 1
FROM EMPLOYEES
WHERE DEPARTMENT_ID = DEPARTMENTs.DEPARTMENT_ID AND rownum = 1
and even create a separate Read-only SQL based VO with it.
No comments:
Post a Comment