J'ai une req sql qui dure environ 13 sec, j'ai tout un tas de paramètres qui sont aléatoires (pas de logique ou sélectioné par l'utilisateur). les paramètres sont tous les "or".
Ma question est :
Quand j'ai 50 paramètres --> 1sec
Quand j'ai 200 paramètres --> 12sec
Quand j'ai 1000 paramètres --> 10min
le problème c'est que ce n'est pas du tout linéaire.
j'ai essayer avec des in (mais on est limité a 1000 et c'était + lent)
j'ai essayer avec une table tempo (mais c'était + lent)
j'ai essayer en remaniant ma req (mais elle faisait 7000 lignes et c'était encor + lent)
la req est
Le plan estCode:
1
2
3
4
5
6
7
8
9
10
11 select doc_detail_nomenclature.id|| ',' ||doc_detail_nomenclature.sens || ',' || nelement from doc_detail_nomenclature,doc_detail_sens, doc_detail where doc_detail_nomenclature.sens=doc_detail_sens.sens and doc_detail_nomenclature.id=doc_detail_sens.id and doc_detail.id=doc_detail_sens.id and ( (doc_detail.id = 412406 or doc_detail.id =484099 or doc_detail.id =502826 or doc_detail.id =505618 or doc_detail.id =512470 or doc_detail.id =524879 or doc_detail.id =527549 ... ) and n_reseau<>8) or ((doc_detail.id = 412406 or doc_detail.id =484099 or doc_detail.id =502826 or doc_detail.id =505618 or doc_detail.id =512470 ...) and n_reseau=8 and n_type_prod_etab=7)
La j'ai mis une requete avec 200 param soit 12 sec, le cost est de 193,661,550 comment est il possible qu'il prenne si peu de temps alors qu'il y a autant de cost ? Et surtout comment peut on optimisé cela ?Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 Plan SELECT STATEMENT CHOOSECost: 193,661,550 Bytes: 10,011,063,097,623 Cardinality: 476,717,290,363 15 CONCATENATION 8 MERGE JOIN CARTESIAN Cost: 227 Bytes: 7,755,540 Cardinality: 517,036 5 MERGE JOIN CARTESIAN Bytes: 5,382,150 Cardinality: 538,215 2 INLIST ITERATOR 1 INDEX RANGE SCAN NON-UNIQUE ADV_DEV_CDE.IDX2_DOC_DETAIL Cost: 4 Bytes: 1,236 Cardinality: 206 4 BUFFER SORT Bytes: 5,382,150 Cardinality: 538,215 3 INDEX FAST FULL SCAN NON-UNIQUE ADV_DEV_CDE.IDX8_DOC_DETAIL_NOMENCLATURE Cost: 227 Bytes: 5,382,150 Cardinality: 538,215 7 BUFFER SORT Bytes: 5 Cardinality: 1 6 INDEX FAST FULL SCAN UNIQUE ADV_DEV_CDE.PK_ID_SENS Bytes: 5 Cardinality: 1 14 HASH JOIN Cost: 233 Bytes: 22,428 Cardinality: 1,068 10 INLIST ITERATOR 9 INDEX RANGE SCAN NON-UNIQUE ADV_DEV_CDE.IDX2_DOC_DETAIL Cost: 4 Bytes: 1,236 Cardinality: 206 13 NESTED LOOPS Cost: 227 Bytes: 7,755,540 Cardinality: 517,036 11 INDEX FAST FULL SCAN NON-UNIQUE ADV_DEV_CDE.IDX8_DOC_DETAIL_NOMENCLATURE Cost: 227 Bytes: 5,382,150 Cardinality: 538,215 12 INDEX UNIQUE SCAN UNIQUE ADV_DEV_CDE.PK_ID_SENS Bytes: 5 Cardinality: 1
ps : Je suis sur une base oracle 9i