Re: changing column from int4 to int8, what happens with indexes?

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: David Teran <david(dot)teran(at)cluster9(dot)com>
Cc: PgSQL General List <pgsql-general(at)postgresql(dot)org>
Subject: Re: changing column from int4 to int8, what happens with indexes?
Date: 2005-01-04 16:36:25
Message-ID: 20050104163625.GB91843@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Jan 04, 2005 at 09:08:51AM -0700, Michael Fuhr wrote:
> On Tue, Jan 04, 2005 at 09:47:30AM +0100, David Teran wrote:
>
> > well, i think the answer is simple 'it works' but i am not sure. When i
> > change the column type from int4 to int8, are the indexes still usable
> > or do i have to drop the indexes and create them again?
>
> What happened when you tried it? You can use EXPLAIN or EXPLAIN
> ANALYZE to see if the planner will use an index.

I forgot to mention that with versions of PostgreSQL prior to 8.0
you might have to use a type cast to get the planner to use an
index. That is, you might have to do something like:

SELECT * FROM foo WHERE x = 12345::INT8;

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Wes 2005-01-04 16:59:05 Re: hundreds of millions row dBs
Previous Message Michael Fuhr 2005-01-04 16:08:51 Re: changing column from int4 to int8, what happens with indexes?