Re: Creating index does not make any change in query plan. - Mailing list pgsql-general

From Deepa
Subject Re: Creating index does not make any change in query plan.
Date
Msg-id Pine.LNX.4.33.0302211056300.1509-100000@ws1154.midascomm.com
Whole thread Raw
In response to Creating index does not make any change in query plan.  (Deepa <kdeepa@midascomm.com>)
List pgsql-general
I too did the similar type of test and got the same result. Will any one
tell me what could be possible solution for this.

--

Bye,
Deepa. K

--
Engineer,
Network Management System,
Midas Communication Technologies private Ltd,
Chennai.

---------- Forwarded message ----------
Date: Mon, 17 Feb 2003 13:45:21 -0800
From: John Edstrom <edstrom@jnrcom.com>
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Creating index does not make any change in query
    plan.

I don't think that this will solve the problem.  I've uncovered a
similar problem recently.  Vacuuming invalidates indexes, at
least as far as I can tell.  Here is an example:
----------------------------------------------------------------------
web=# create table t1 ( i int primary key );
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index
't1_pkey' for table 't1'
CREATE
web=# explain select * from t1 where i = 10;
NOTICE:  QUERY PLAN:

Index Scan using t1_pkey on t1  (cost=0.00..4.82 rows=1 width=4)

EXPLAIN
web=# vacuum analyze t1;
VACUUM
web=# explain select * from t1 where i = 10;
NOTICE:  QUERY PLAN:

Seq Scan on t1  (cost=0.00..0.00 rows=1 width=4)

EXPLAIN
web=# reindex table t1;
REINDEX
web=# explain select * from t1 where i = 10;
NOTICE:  QUERY PLAN:

Index Scan using t1_pkey on t1  (cost=0.00..4.82 rows=1 width=4)

EXPLAIN
--------------------------------------------------------------------

That is not what I expected to happen.

> Hope this helps,


--
John Edstrom



---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster



pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Dealing with schema in psql utility?
Next
From: Neil Conway
Date:
Subject: Re: reindex vs. drop index , create index