Optimize querry sql - Mailing list pgsql-sql

From Stanislas de Larocque
Subject Optimize querry sql
Date
Msg-id bc40d0a30709140131u3f23c6e1h17b8bf1f96235a91@mail.gmail.com
Whole thread Raw
Responses Re: Optimize querry sql
List pgsql-sql
Hi,

I want to optimize my qerry sql (execution time : 2448 ms) :

SELECT b.idxreseller, sum(a.nbrq), b.namereseller from stat a
,reseller b where b.asp=6 and a.idxreseller=b.reseller and
a.month=date_part('month',now() - interval '1 month') and
a.year=date_part('year',now() - interval '1 month') GROUP BY
b.idxreseller,b.namereseller limit 15;



dns=> \d stat_dns_domaine;                           Table «public.stat_dns_domaine»
idxdxreseller | integer | not nullidxdo   | integer | not nullidxd       | integer | not nullnbrq         | integer |
default0month         | integer | default date_part('month'::text, (now() - 
'1 mon'::interval))year        | integer | default date_part('year'::text, (now() - '1
mon'::interval))

Index :   «stat_dns_domaine_idx_idxr_idxrevendeur» btree (idxrevendeur)   «stat_dns_domaine_idx_mois_annee_idxrev»
btree(mois, annee, idxrevendeur) 




\d revendeur limit 20;                                       Table «public.revendeur»
idxreseller    | integer | not null default
nextval(('idxrevendeur_seq'::text)::regclass)namereseller     | text    |asp              | integer |
Index :   «reseller_pkey» PRIMARY KEY, btree (idxreseller)


Thank you

STan


pgsql-sql by date:

Previous
From: Gregory Stark
Date:
Subject: Re: Index usage in bitwise operation context
Next
From: "Stanislas de Larocque"
Date:
Subject: Optimize querry sql