X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 441F8D1B507 for ; Wed, 17 Sep 2003 21:55:14 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 09049-07 for ; Wed, 17 Sep 2003 18:54:44 -0300 (ADT) Received: from pns.mm.eutelsat.org (pns.mm.eutelsat.org [194.214.173.227]) by svr1.postgresql.org (Postfix) with ESMTP id A47BED1B4EC for ; Wed, 17 Sep 2003 18:54:41 -0300 (ADT) Received: from nts-03.mm.eutelsat.org (localhost [127.0.0.1]) by pns.mm.eutelsat.org (8.11.6/linuxconf) with ESMTP id h8HKuHT12611; Wed, 17 Sep 2003 22:56:18 +0200 Received: from bigfoot.com (accesspoint.mm.eutelsat.org [194.214.173.4]) by nts-03.mm.eutelsat.org (8.11.6/linuxconf) with ESMTP id h8HLmHR05811; Wed, 17 Sep 2003 23:48:17 +0200 Message-ID: <3F68D81A.2030801@bigfoot.com> Date: Wed, 17 Sep 2003 23:54:34 +0200 From: Gaetano Mendola User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5b) Gecko/20030901 Thunderbird/0.2 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Rhaoni Chiu Pereira , "pgsql-admin@postgresql.org" Subject: Re: How can I make PosgreSQL use an Index ? References: <1063831482.3f68c7bab4b1a@sistemica.info> In-Reply-To: <1063831482.3f68c7bab4b1a@sistemica.info> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/300 X-Sequence-Number: 10388 Rhaoni Chiu Pereira wrote: > Hi list, > > I have a table like this: > > CREATE TABLE "gsames00" ( > "ano_mes" varchar(6) NOT NULL, > "descricao" varchar(30), > PRIMARY KEY ("ano_mes") > ); > > and an index like this: > > CREATE INDEX GSAMES01 ON GSAMES00 (ANO_MES); > > When I run a explain analyze with this where clause: > > ... gsames00.ano_mes = to_char(ftnfco00.data_emissao,'YYYYMM') AND ... > > ftnfco00.data_emissao is a timestamp. When I run the explain analyze it says: > > ... > -> Seq Scan on gsames00 (cost=100000000.00..100000006.72 rows=372 width=10) > (actual time=0.01..0.96 rows=372 loops=19923) > ... looking at the cost I guess that you never run vacuum analyze on your table, do it and let us know. Regards Gaetano Mendola