Bonjour, j'aimerai savoir si existe une autre methode que le "not in" pour exclure certaines données.

Pour le moment ma requête est comme ceci, mais le Not in consomme beaucoup trop de ressource :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
 
SELECT 'B' AS TYPE, 
           'Total des RAL non définis' AS NOM, 
           '' AS LIB, 
           COUNT(PCH_CODE) TOTAL 
  FROM PCH 
 WHERE PCH_ETAT = 20 
     AND TRUNC(PCH_DATE) < TRUNC(SYSDATE)  
     AND pch_code not in (SELECT PCH_CODE 
                                   FROM RAL_GRP_MAG,PCH 
                                  where RGM_GRP_CODE=0  
                                     and RGM_MAG_CODE=PCH_MAG  
                                     and pch_etat=20  
                                     and trunc(pch_date)=trunc(sysdate-1)              
                                 UNION 
                                SELECT PCH_CODE  
                                  FROM RAL_GRP_MAG,PCH  
                                 where RGM_GRP_CODE<>0                            
                                    and RGM_MAG_CODE=PCH_MAG  
                                    and pch_etat=20  
                                    and trunc(pch_date)<trunc(sysdate))

Merci