Re: Should I CLUSTER on PRIMARY KEY

Поиск
Список
Период
Сортировка
От Chris
Тема Re: Should I CLUSTER on PRIMARY KEY
Дата
Msg-id 4A63B898.8080700@gmail.com
обсуждение исходный текст
Ответ на Should I CLUSTER on PRIMARY KEY  (Robert James <srobertjames@gmail.com>)
Ответы Re: Should I CLUSTER on PRIMARY KEY
Список pgsql-general
Robert James wrote:
> I would like to CLUSTER a table on its PRIMARY KEY.  Now, I haven't
> explicitly defined and named an index for this table - but the primary
> key defines one.   How can I tell Postgres to CLUSTER on it?

Get the index name:

\d tablename

Right at the bottom it will have the index names:

Indexes:
     "a_pkey" PRIMARY KEY, btree (a)


then cluster:

# cluster tablename using a_pkey;
CLUSTER


> Also: If I define an index on a PK, will Postgres make a second one, or
> realize its redundnant?

Depends how you define it (I think). What's your create table statement
look like?

--
Postgresql & php tutorials
http://www.designmagick.com/


В списке pgsql-general по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: timestamp with time zone tutorial
Следующее
От: Chris
Дата:
Сообщение: Re: PostgreSQL Databse Migration to the Latest Version and Help for Database Replication.