pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gaetano Mendola <mendola@bigfoot.com>
To: Rhaoni Chiu Pereira <rhaoni@sistemica.info>
To: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Subject: Re: How can I make PosgreSQL use an Index ?
Date: Wed, 17 Sep 2003 23:54:34 +0200
Message-ID: <3F68D81A.2030801@bigfoot.com> (raw)
In-Reply-To: <1063831482.3f68c7bab4b1a@sistemica.info>
References: <1063831482.3f68c7bab4b1a@sistemica.info>

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




view thread (5+ messages)  latest in thread

Message-ID: <3F68D81A.2030801@bigfoot.com>
Permalink:  ../3F68D81A.2030801@bigfoot.com/
Also on:    postgresql.org/message-id/3F68D81A.2030801@bigfoot.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: mendola@bigfoot.com, rhaoni@sistemica.info
  Subject: Re: How can I make PosgreSQL use an Index ?
  In-Reply-To: <3F68D81A.2030801@bigfoot.com>
  References: <1063831482.3f68c7bab4b1a@sistemica.info> <3F68D81A.2030801@bigfoot.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox