Précédent   Forum du club des développeurs et IT Pro > Bases de données > PostgreSQL
PostgreSQL Forum PostgreSQL. Avant de poster -> F.A.Q PostGreSQL Tutoriels PostGreSQL
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse
 
Outils de la discussion
Publicité
'
Vieux 21/11/2012, 15h03   #1
nabil.brarou
Membre à l'essai
 
Homme
Étudiant
Inscription : juin 2012
Messages : 116
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France

Informations professionnelles :
Activité : Étudiant
Secteur : High Tech - Matériel informatique

Informations forums :
Inscription : juin 2012
Messages : 116
Points : 20
Points : 20
Par défaut minimiser le temps d'exécution de la requête

Bonjour,
La requete ci dessous a un problème, elle met beaucoup de temps pour s'exécuter, est ce qu'il y 'aura un moyen d'optimiser la requete, pour réduire le temps d’exécution de la requete ?

Voici le script SQL:
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
 
SELECT 	
max(O.ota_date_debut) AS "année de dernière observation",
T.tax_nom_vern AS "nom vernaculaire",
T.tax_nom_complet AS "nom scientifique",
R.tae_url_inpn AS "lien vers les textes législatifs",
C.tlo_nom_type_localisation AS "précision de la donnée",
W.gta_nom_groupe_taxonomique AS "groupe d'espèce",
X.sgt_nom_sous_groupe_taxonomique AS "sous groupe d'espèce",
Q.tst_nom_type_statut AS "menace",
Q.tst_nom_type_statut AS "statut biologique",
A.str_nom_structure AS "expert régional à contacter",
M.sta_nom_statut AS "protection national ou régional"
 
FROM   	t_taxref T,
		t_taxref_reglementation R,
		t_observation_taxon O,
		t_taxon_observe P, 
		tv_taxon_protection N,
		t_localisation B,
		tr_type_localisation C,
		tj_taxon_a_statut_new D,
		tr_statut_new S, 
		tr_type_statut_new Q,
		tr_groupe_taxonomique W,
		tr_sous_groupe_taxonomique X,
		t_structure A,
		t_referentiel E,
		tj_taxref_protection L,
		t_lot_donnees K,	
		t_contributeur V,	
		tv_taxon_protection M,
		tv_taxon_observe_commune H
 
WHERE   T.tax_id_taxref = L.tax_id_taxref
AND 	L.tae_cd_protection = R.tae_cd_protection
AND 	T.ref_id_referentiel = E.ref_id_referentiel
AND 	E.ref_id_referentiel = P.ref_id_referentiel
AND	O.tao_id_taxon = P.tao_id_taxon
AND 	O.ota_id_obs_taxon = B.ota_id_obs_taxon
AND 	B.tlo_id_type_localisation = C.tlo_id_type_localisation
AND 	P.tao_id_taxon = D.tao_id_taxon
AND 	D.sta_id_statut = S.sta_id_statut 
AND 	Q.tst_id_type_statut = S.tst_id_type_statut
AND	O.ldo_id_lot_donnees = K.ldo_id_lot_donnees
AND	K.con_id_contributeur = V.con_id_contributeur
AND 	V.str_id_structure = A.str_id_structure
AND	P.tao_id_taxon = N.tao_id_taxon 
AND	Q.tst_id_type_statut IN (33 , 45)
AND	M.tao_id_taxon = P.tao_id_taxon
AND 	P.tao_id_taxon = H.tao_id_taxon 
AND 	H.gez_id_geom_zonage = 217715		 
 
GROUP BY "nom vernaculaire",
		"nom scientifique",
		"lien vers les textes législatifs",
		"précision de la donnée",
		"groupe d'espèce",
		"sous groupe d'espèce",
		"menace",
		"statut biologique",
		"expert régional à contacter",
		"protection national ou régional"
nabil.brarou est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 21/11/2012, 17h48   #2
SQLpro
Rédacteur

 
Avatar de SQLpro
 
Homme Frédéric BROUARD
Expert SGBDR & SQL
Inscription : mai 2002
Messages : 12 080
Détails du profil
Informations personnelles :
Nom : Homme Frédéric BROUARD
Localisation : France

Informations professionnelles :
Activité : Expert SGBDR & SQL
Secteur : Conseil

Informations forums :
Inscription : mai 2002
Messages : 12 080
Points : 21 678
Points : 21 678
Sans les description intégrale de vos tables avec contraintes et index (sous forme DDL), il est impossible de vous aider... C'est comme si je vous demandais quelle est la recette ?

A +
__________________
Frédéric Brouard - SQLpro - ARCHITECTE DE DONNÉES - expert SGBDR et langage SQL
Site sur les SGBD relationnels et le langage SQL: http://sqlpro.developpez.com/
Expert Microsoft SQL Server - M.V.P. (Most valuable Professional) MS Corp.
Blog SQL, SQL Server, modélisation données : http://blog.developpez.com/sqlpro
http://www.sqlspot.com : modélisation, conseils, audit, optimisation, formation
* * * * * Enseignant CNAM PACA - ISEN Toulon - CESI Aix en Provence * * * * *
SQLpro est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 21/11/2012, 17h57   #3
nabil.brarou
Membre à l'essai
 
Homme
Étudiant
Inscription : juin 2012
Messages : 116
Détails du profil
Informations personnelles :
Sexe : Homme
Localisation : France

Informations professionnelles :
Activité : Étudiant
Secteur : High Tech - Matériel informatique

Informations forums :
Inscription : juin 2012
Messages : 116
Points : 20
Points : 20
Oulaa je ne peux pas vous écrire la structure DDL de mes tables, parce que ce n'est pas moi qui les a (créé et/ou modifié).
nabil.brarou est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse
Outils de la discussion

Navigation rapide


Fuseau horaire GMT +2. Il est actuellement 23h04.


 
 
 
 
Partenaires

Hébergement Web