[Débutant] optimiser une requète
Bonjour,
je dois faire une optimisation de ma requète car elle atteint une durée de traitement de 11s en étant loin de la charge qu'il faudra supporter en prod.
j'avoue ne pas être un pro de sql et encore moins sous oracle donc si il y avait une ou plusieurs ames charitables.
donc ma requête affiche pour chaque interface et type le nombre d'entité en attente de traitement, en erreur, archivé et traité le tout selon un statut.
voici ma requête actuelle :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
/* Formatted on 2009/01/27 15:04 (Formatter Plus v4.8.8) */
SELECT entite.INTERFACE, TRIM (entite.type_entite) AS expr1,
tab_wait.nb_wait, tab_send.nb_send, tab_err.nb_err, tab_arc.nb_arc,
MAX (entite.creation) AS LAST
FROM entite
FULL OUTER JOIN
(SELECT COUNT (DISTINCT id_entite) AS nb_wait,
TRIM (type_entite) AS typetrim, INTERFACE
FROM entite entite_3
WHERE (INTERFACE LIKE 'NG%') AND (statut = 0)
GROUP BY INTERFACE, TRIM (type_entite)) tab_wait
ON TRIM (entite.type_entite) = TRIM (tab_wait.typetrim)
AND entite.INTERFACE = tab_wait.INTERFACE
FULL OUTER JOIN
(SELECT COUNT (DISTINCT id_entite) AS nb_send,
TRIM (type_entite) AS typetrim, INTERFACE
FROM entite entite_2
WHERE (INTERFACE LIKE 'NG%') AND (statut = 9)
GROUP BY INTERFACE, TRIM (type_entite)) tab_send
ON TRIM (entite.type_entite) = tab_send.typetrim
AND entite.INTERFACE = tab_send.INTERFACE
FULL OUTER JOIN
(SELECT COUNT (DISTINCT id_entite) AS nb_err,
TRIM (type_entite) AS typetrim, INTERFACE
FROM entite entite_1
WHERE (INTERFACE LIKE 'NG%') AND (statut = 1)
GROUP BY INTERFACE, TRIM (type_entite)) tab_err
ON TRIM (entite.type_entite) = tab_err.typetrim
AND entite.INTERFACE = tab_err.INTERFACE
FULL OUTER JOIN
(SELECT COUNT (DISTINCT id_entite) AS nb_arc,
TRIM (type_entite) AS typetrim, INTERFACE
FROM entite entite_1
WHERE (INTERFACE LIKE 'NG%') AND (statut = 8)
GROUP BY INTERFACE, TRIM (type_entite)) tab_arc
ON TRIM (entite.type_entite) = tab_arc.typetrim
AND entite.INTERFACE = tab_arc.INTERFACE
GROUP BY entite.INTERFACE,
TRIM (entite.type_entite),
tab_wait.nb_wait,
tab_send.nb_send,
tab_err.nb_err,
tab_arc.nb_arc
ORDER BY entite.INTERFACE |
merci d'avance