RĂ©sultat de Explain Analyze
lucrol/ = 19 Avril, 2005 - 14:21
EXPLAIN ANALYZE
SELECT DISTINCT
vehicules.*,
compagnies.nomassur,
compagnies.contactassur,
employes.prenom_nom,
experts.nomexpert,
experts.cabinetexpert,
marques.nommarque,
soustraitants.nomst,
soustraitants.contactst
FROM soustraitants
RIGHT JOIN (marques
RIGHT JOIN (experts
RIGHT JOIN (employes
RIGHT JOIN (compagnies
RIGHT JOIN vehicules ON compagnies.codeassur::text = vehicules.codeassur::text) ON employes.codeemploye::text = vehicules.codechauffeur::text) ON experts.codeexpert::text = vehicules.codeexpert::text) ON marques.codemarque = vehicules.codemarque) ON soustraitants.codest::text = vehicules.codest::text
LEFT JOIN communes ON vehicules.cpgarage = communes.compteur
ORDER BY vehicules.nolp, vehicules.noimmat, vehicules.norecord ;
celĂ donne :
"Unique (cost=35366.09..44744.11 rows=24679 width=2033) (actual time=15594.000..15782.000 rows=24679 loops=1)"
" -> Sort (cost=35366.09..35427.79 rows=24679 width=2033) (actual time=15594.000..15594.000 rows=24679 loops=1)"
" Sort Key: vehicules.nolp, vehicules.noimmat, vehicules.norecord, vehicules.dateaccord, vehicules.codemarque, vehicules.modele, vehicules.kms, vehicules.codeassur, vehicules.proprio, vehicules.codeexpert, vehicules.garage, vehicules.telgarage, vehic (..)"
" -> Hash Left Join (cost=46.98..3850.64 rows=24679 width=2033) (actual time=15.000..15406.000 rows=24679 loops=1)"
" Hash Cond: ("outer".cpgarage = "inner".compteur)"
" -> Hash Left Join (cost=15.29..3448.76 rows=24679 width=2033) (actual time=15.000..12797.000 rows=24679 loops=1)"
" Hash Cond: (("outer".codest)::text = ("inner".codest)::text)"
" -> Hash Left Join (cost=10.39..3132.90 rows=24679 width=1963) (actual time=15.000..10274.000 rows=24679 loops=1)"
" Hash Cond: ("outer".codemarque = "inner".codemarque)"
" -> Hash Left Join (cost=7.79..2848.95 rows=24679 width=1934) (actual time=0.000..7650.000 rows=24679 loops=1)"
" Hash Cond: (("outer".codeexpert)::text = ("inner".codeexpert)::text)"
" -> Hash Left Join (cost=4.70..2615.11 rows=24679 width=1856) (actual time=0.000..4992.000 rows=24679 loops=1)"
" Hash Cond: (("outer".codechauffeur)::text = ("inner".codeemploye)::text)"
" -> Hash Left Join (cost=3.27..2448.33 rows=24679 width=1813) (actual time=0.000..2565.000 rows=24679 loops=1)"
" Hash Cond: (("outer".codeassur)::text = ("inner".codeassur)::text)"
" -> Seq Scan on vehicules (cost=0.00..2195.79 rows=24679 width=1743) (actual time=0.000..30.000 rows=24679 loops=1)"
" -> Hash (cost=3.02..3.02 rows=102 width=84) (actual time=0.000..0.000 rows=0 loops=1)"
" -> Seq Scan on compagnies (cost=0.00..3.02 rows=102 width=84) (actual time=0.000..0.000 rows=102 loops=1)"
" -> Hash (cost=1.34..1.34 rows=34 width=52) (actual time=0.000..0.000 rows=0 loops=1)"
" -> Seq Scan on employes (cost=0.00..1.34 rows=34 width=52) (actual time=0.000..0.000 rows=34 loops=1)"
" -> Hash (cost=2.87..2.87 rows=87 width=92) (actual time=0.000..0.000 rows=0 loops=1)"
" -> Seq Scan on experts (cost=0.00..2.87 rows=87 width=92) (actual time=0.000..0.000 rows=87 loops=1)"
" -> Hash (cost=2.28..2.28 rows=128 width=33) (actual time=15.000..15.000 rows=0 loops=1)"
" -> Seq Scan on marques (cost=0.00..2.28 rows=128 width=33) (actual time=0.000..15.000 rows=128 loops=1)"
" -> Hash (cost=4.52..4.52 rows=152 width=84) (actual time=0.000..0.000 rows=0 loops=1)"
" -> Seq Scan on soustraitants (cost=0.00..4.52 rows=152 width=84) (actual time=0.000..0.000 rows=152 loops=1)"
" -> Hash (cost=27.95..27.95 rows=1495 width=4) (actual time=0.000..0.000 rows=0 loops=1)"
" -> Seq Scan on communes (cost=0.00..27.95 rows=1495 width=4) (actual time=0.000..0.000 rows=1495 loops=1)"
"Total runtime: 15828.000 ms"
Il est annoncé 15828 ms et pourtant lors de l'éxécution SANS EXPLAIN ANALYSE ça prend 32016+719 ms (si seulement 200 lignes extraites).
Il me semble que la lenteur soit dûe au nombre de champs de vehicules (143).
Existe-t-il une solution ?
D'avance merci...
Luc
[ Vous devez
vous connecter pour poster des commentaires ]