Skip site navigation (1) Skip section navigation (2)

Strange indexing

From: Uros Gruber <uros(at)sir-mag(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Strange indexing
Date: 2002-04-29 16:34:04
Message-ID: 18366267307.20020429183404@sir-mag.com (view raw or flat)
Thread:
Lists: pgsql-general
Hi!

is this OK.

CREATE TABLE test (
id int primary key,
name varchar(255),
parent varchar(32)
);


If i write

explain select * from test where id=1;

This is output of 1st table:
Index Scan using test_pkey on test  (cost=0.00..4.82 rows=1 width=183)


but the i create index on parent like this

create index tt on test (parent);

And when i execute query

explain select * from test where parent = '1';

Seq Scan on test  (cost=0.00..1.07 rows=1 width=17)

Why i there no index scan if i create index. I also run
vacuum on this table.


both queryes return only 1 row.



-- 
bye,
 Uros                          mailto:uros(at)sir-mag(dot)com


Responses

pgsql-general by date

Next:From: Lincoln YeohDate: 2002-04-29 16:36:25
Subject: Re: What popular, large commercial websites run PostgreSQL?
Previous:From: Jean-Michel POUREDate: 2002-04-29 15:45:08
Subject: Performance HOWTO - pseudo counter example

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group