Hi !
I have a big problem using Indexes which slows my database.
I have a table with lot of data (> 500 000):
CREATE TABLE accord_editeur
(
id_regie int8 not null,
num_campagne int8 not null,
num_publicite int8 not null,
num_editeur int8 not null,
num_site int8 not null,
num_emplacement int8 not null,
num_periode int8,
par_id_technologie int8 not null,
affichage_possible int2 default 0,
ponderation_calculee int8,
date_pilotage timestamp NULL,
id_ct1 int8,
PRIMARY KEY(id_regie,num_campagne,num_publicite
,num_editeur,num_site,num_emplacement)
);
And an Index :
CREATE INDEX ae_tracking_idx ON accord_editeur(id_regie, num_editeur,
num_site, num_emplacement);
If I do an EXPLAIN on this :
SELECT ae.id_regie,
ae.num_campagne,
ae.num_publicite,
ae.ponderation_calculee,
ae.num_periode
FROM accord_editeur ae
WHERE ae.id_regie = 1
AND ae.num_editeur = 1494
AND ae.num_site = 1
AND ae.num_emplacement = 1
AND ae.affichage_possible = 1
I get :
Seq Scan on accord_editeur ae (cost=0.00..19349.71 rows=1 width=40)
but I expected an Index Scan, what's the matter with this Index ??
Thanx
Guillaume Lémery