Re: index not being used. Why?

From: gherzig(at)fmed(dot)uba(dot)ar
To: "Scott Marlowe" <smarlowe(at)g2switchworks(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: index not being used. Why?
Date: 2007-03-09 20:35:11
Message-ID: 27676.190.55.116.36.1173472511.squirrel@www.webmail.fmed.uba.ar
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin pgsql-sql

Thanks all you guys. Indeed, populating the tables with 10.000 entrys make
the things different, and now it uses all the indexes as i spect. It was
just a matter of being pacient and loading more data to test it out and
see.

And, yes, i need to upgrade psql now. Actually the real server has an
8.2.0 engine.

Thanks all you guys!
Gerardo
> On Fri, 2007-03-09 at 09:01, Gerardo Herzig wrote:
>> Hi all. I have this 2 relations
>>
>
> SNIP
>
>> Index Cond: ((upper((word)::text) ~>=~ 'TEST'::character
>> varying) AND (upper((word)::text) ~<~'TESU'::character
>> varying))
>> -> Hash (cost=9.08..9.08 rows=408 width=55)
>> -> Seq Scan on pages (cost=0.00..9.08 rows=408 width=55)
>>
>> (8 rows)
>>
>>
>> Watch the last row of the explain command. It makes a sequential scan
>> on the pages table, like it is not using the index on the "id" field.
>>
>> The result itself is OK, but i will populate the tables so i think
>> that later that sequential scan would be a problem.
>
> Welcome to the world of tomorrow! hehe. PostgreSQL uses a cost based
> planner. It decided that an index would cost more than a seq scan, so
> it chose the seq scan. As mentioned in other posts, you'll need to do
> an analyze. Also, look up things like vacuum / autovacuum as well.
>
>> Im using postgres 8.1.3
>
> You need to upgrade to 8.1.8 or whatever the latest version is by the
> time this email gets to you :) 8.1.3 is about a year out of date.
>
>
>

--
Gerardo Herzig
Direccion General de Organizacion y Sistemas
Facultad de Medicina
U.B.A.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Greg Sabino Mullane 2007-03-09 20:51:44 Re: problem upgrading from 8.1.6 to 8.1.8 --- relation <tablename> does not exist
Previous Message Glen W. Mabey 2007-03-09 20:34:20 Re: problem upgrading from 8.1.6 to 8.1.8 --- relation <tablename> does not exist

Browse pgsql-sql by date

  From Date Subject
Next Message Phillip Smith 2007-03-09 22:44:49 Re: [Re: PRIMARY KEY]
Previous Message Scott Marlowe 2007-03-09 19:58:31 Re: index not being used. Why?