Re: Creating index does not make any change in query plan.

From: Deepa <kdeepa(at)midascomm(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Creating index does not make any change in query plan.
Date: 2003-02-21 05:28:18
Message-ID: Pine.LNX.4.33.0302211056300.1509-100000@ws1154.midascomm.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)jnrcom(dot)com>
To: pgsql-general(at)postgresql(dot)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

Browse pgsql-general by date

  From Date Subject
Next Message Neil Conway 2003-02-21 06:40:43 Re: reindex vs. drop index , create index
Previous Message Tom Lane 2003-02-21 04:23:33 Re: Dealing with schema in psql utility?