Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 2D7B94768CC for ; Tue, 7 Jan 2003 06:56:34 -0500 (EST) Received: from serwer.skawsoft.com.pl (serwer.skawsoft.com.pl [213.25.37.66]) by postgresql.org (Postfix) with ESMTP id 8778B476745 for ; Tue, 7 Jan 2003 06:56:33 -0500 (EST) Received: from klaster.net (pe241.krakow.cvx.ppp.tpnet.pl [213.76.40.241]) by serwer.skawsoft.com.pl (Postfix) with ESMTP id 7DDA02B21C; Tue, 7 Jan 2003 12:54:53 +0100 (CET) Message-ID: <3E1AC14C.7010104@klaster.net> Date: Tue, 07 Jan 2003 13:00:12 +0100 From: Tomasz Myrta User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.2b) Gecko/20021016 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Achilleus Mantzios Cc: pgsql-performance@postgresql.org Subject: Re: [SQL] 7.3.1 index use / performance References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200301/35 X-Sequence-Number: 682 Achilleus Mantzios wrote: > it has indexes: > Indexes: noonf_date btree (report_date), > noonf_logno btree (log_no), > noonf_rotation btree (rotation text_ops), > noonf_vcode btree (v_code), > noonf_voyageno btree (voyage_no) > > > ------------------------------------------------------------------------------------------------------------------- > Index Scan using noonf_date on noon (cost=0.00..4.46 rows=1 width=39) > (actual time=0.27..52.89 rows=259 loops=1) > Index Cond: ((report_date >= '2002-01-07'::date) AND (report_date <= > '2003-01-07'::date)) > Filter: ((v_code = '4500'::character varying) AND (rotation = 'NOON > '::character varying)) > Total runtime: 53.98 msec > (4 rows) Maybe it is not an answer to your question, but why don't you help Postgres by yourself? For this kind of queries it's better to drop index on report_date - your report period is one year and answer to this condition is 10% records (I suppose) It would be better to change 2 indexes on v_code and rotation into one index based on both fields. What kind of queries do you have? How many records returns each "where" condition? Use indexes on fields, on which condition result in smallest amount of rows. Regards, Tomasz Myrta