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

From: Deepa <kdeepa(at)midascomm(dot)com>
To: Shridhar Daithankar <shridhar_daithankar(at)persistent(dot)co(dot)in>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Creating index does not make any change in query plan.
Date: 2003-02-17 09:44:07
Message-ID: Pine.LNX.4.33.0302171511290.10413-100000@ws1154.midascomm.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, 17 Feb 2003, Shridhar Daithankar wrote:

> when you say id=2, it uses default int type which is smallint, AFAIK. So
> smallint != bigint and hence planner does not consider using index.

But even when a number that has a value of 4 bytes is set in the where
condition, the planner is not uses indexed scan. In this case how come
this will take the number as small int. Is their any other reason for
that.

>
> When it is a string, conversion takes place which is to bigint because of field
> you are comparing against. Now bigint == bigint and hence planner uses the
> index.
>
> With field promotion, planner would convert smallint to bigint and hence will
> use the index if appropriate.
>
> Please correct me if I am wrong. This is what my impressions are from listening
> to list.
>

--

Bye,
Deepa. K

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Веретенников Алексей 2003-02-17 09:52:23 continuous data from stdin
Previous Message Shridhar Daithankar 2003-02-17 09:32:47 Re: Creating index does not make any change in query plan.