An index
on cp and effectif would help your first query. An index on naf, cp and effectif would help your second
query. Something
like this: CREATE INDEX base_aveugle_cp_key2 ON
base_aveugle USING btree (cp, effectif); Another thing, why include “distinct cp”
when you are only selecting “cp=’201A’”?
You will only retrieve one record regardless of how many may contain cp=’201A’. If you could make these UNIQUE indexes that
would help also but it’s not a requirement. Good luck, Duane -----Original
Message----- Hello, I
have a dedicated server for my posgresql database : P4
2.4 GHZ HDD
IDE 7200 rpm 512
DDR 2700 I
have a problem whith one table of my database : CREATE
SEQUENCE "base_aveugle_seq" START 1; This
table contains 5 000 000 records I
have a PHP application which often makes queries on this table (especially on
the "cp","naf","effectif" fields) Querries
are like :
select (distint cp) from base_aveugle where cp='201A' and effectif between 1
and 150
select (*) from base_aveugle where naf in ('721A','213F','421K') and cp in
('54210','21459','201A') and effectif < 150 I
think it is possible to optimize the performance of this queries before
changing the hardware (I now I will...) but I don't know how, even after
having read lot of things about postgresql ... Thanks
;)
|
- [PERFORM] General performance problem! olivier HARO
- Re: [PERFORM] General performance problem! Gaetano Mendola
- Re: [PERFORM] General performance problem! Richard Huxton
- Re: [PERFORM] General performance problem! Leeuw van der, Tim
- Re: [PERFORM] General performance problem! olivier HARO
- Duane Lee - EGOVX