query:
SELECT A.USER_ID, A.ROLE_ID, C.SUBGROUP, MAX(A.STATUS_ID)
FROM USER_ROLE A, USER B, ROLE C
WHERE A.ROLE_ID = C.ROLE_ID
AND C.GROUP_ID = 3
AND A.USER_ID = B.USER_ID
AND B.TEMPLATE_IND = 'N'
AND B.ONAP_PARTCODE IS NULL
AND A.PARTCODE ='005'
GROUP BY A.PARTCODE,
A.USER_ID,
A.ROLE_ID,
C.SUBGROUP;
Explain plan:
--------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Co
--------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 1 | 74 |
| 1 | HASH GROUP BY | | 1 | 74 |
| 2 | NESTED LOOPS | | 1 | 74 |
| 3 | NESTED LOOPS | | 56 | 3024 |
| 4 | TABLE ACCESS BY INDEX ROWID| ROLE | 8 | 240 |
|* 5 | INDEX RANGE SCAN | N_ROLE_IDX2 | 8 | |
| 6 | TABLE ACCESS BY INDEX ROWID| USER_ROLE | 7 | 168 |
|* 7 | INDEX RANGE SCAN | N_USER_ROLE_IDX6 | 7 | |
| 8 | REMOTE | MV_PT_USER | 1 | 20 |
--------------------------------------------------------------------------------