What does your data look like? If you have a lot of duplicate id's, a sequential scan may be better than an index scan. If you are not sure if this is the case, try: SELECT id, count(*) AS count FROM test GROUP BY id ORDER BY count DESC LIMIT 50; This should show you the top 50 most duplicated records in your table. -r At 08:52 PM 9/4/01 +0200, Norbert Zoltan Toth wrote: >I have experienced the following problem, maybe they are related: > >I create a table with > create table test (id int, name char(10)); > >then I create an index on it with > create index test_idx on test (id); > >After populating my table, the query > select id from test where id='1'; > >uses index scan. > >However when I only create the index AFTER inserting rows into the table, >the index is not being used for the evaluation, >even if I run vacuum / vaccum analyze on test; > >I would also appreciate some help with this. > >Thank you, >Norbert > > >---------------------------(end of broadcast)--------------------------- >TIP 6: Have you searched our list archives? > >http://www.postgresql.org/search.mpl > > > >--- >Incoming mail is certified Virus Free. >Checked by AVG anti-virus system (http://www.grisoft.com). >Version: 6.0.251 / Virus Database: 124 - Release Date: 4/26/01
--- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.251 / Virus Database: 124 - Release Date: 4/26/01
---------------------------(end of broadcast)--------------------------- TIP 4: Don't 'kill -9' the postmaster