From: | justin <justin(at)emproshunts(dot)com> |
---|---|
To: | Rui Carvalho <rui(dot)hmcarvalho(at)gmail(dot)com> |
Cc: | "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org> |
Subject: | Re: - Slow Query |
Date: | 2009-07-01 16:41:15 |
Message-ID: | 4A4B91AB.4060805@emproshunts.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
Rui Carvalho wrote:
> SELECT distinct on (bien.uid) bien.uid , bien.date_creation ,
> bien.date_modification , bien.nom , bien.numero_voie , bien.mer ,
> bien.proximite , bien.nom_voie , bien.type_voie , bien.lieudit ,
> bien.arrondissement , bien.montagne , bien.complement_adresse ,
> bien.xy_geo , bien.ref_type_avancement , bien.ref_agence ,
> bien.acces_handicape , bien.surface_totale , bien.ref_type_transaction
> , bien.reference_bien ,
> bien.ref_type_bien , bien.bien_exception ,
> bien.video_online , bien.geom , habitation.nombre_de_chambres,
> habitation.nombre_de_wc ,
> prix.montant , ville.nom ,ville.abreviation ,
> ville.code_insee , ville.code_postal ,
> freguesia_ville.code_insee ,
> freguesia_ville.code_postal , freguesia_ville.ref_freguesia ,
> freguesia_ville.ref_ville ,
> freguesia.nom , freguesia.numero , departement.nom
> , departement.numero , region.nom ,region.numero , zone.zone_public ,
> type_transaction.nom, mandat.numero_mandat_pt
> FROM bien
> LEFT outer JOIN prix ON prix.ref_bien = bien.uid AND
> prix.ref_type_prix in (2,9) and prix.montant !=0 LEFT outer JOIN
> habitation on habitation.uid = bien.uid
> LEFT outer JOIN ville ON ville.uid = bien.ref_ville LEFT outer JOIN
> freguesia_ville ON freguesia_ville.ref_ville =ville.uid
> LEFT outer JOIN freguesia ON freguesia.uid = freguesia_ville.ref_freguesia
> LEFT outer JOIN departement ON departement.uid =ville.ref_departement
> LEFT outer JOIN region ON region.uid = departement.ref_region
> LEFT outer JOIN zone ON zone.ref_bien = bien.uid JOIN imagebien ON
> imagebien.ref_bien = bien.uid left outer join mandat on
> mandat.ref_bien=bien.uid
> LEFT outer JOIN type_transaction ON type_transaction.uid =
> bien.ref_type_transaction
> LEFT OUTER JOIN agence on agence.uid = bien.ref_agence
> WHERE imagebien.uid IS NOT NULL AND bien.statut = 0 and
> bien.visible_internet = 1 and bien.ref_agence = XXXXXXX
>
You need to run explain analyze on the query, and post the results
This will tell us where the time is getting eaten up and other problems
that might be in the query.
Also need to know the version of Postgresql???
From | Date | Subject | |
---|---|---|---|
Next Message | Mike Ivanov | 2009-07-01 17:12:23 | Re: - Slow Query |
Previous Message | Mike Ivanov | 2009-07-01 16:39:05 | Re: - Slow Query |