Re: Should I CLUSTER on PRIMARY KEY - Mailing list pgsql-general

From Chris
Subject Re: Should I CLUSTER on PRIMARY KEY
Date
Msg-id 4A63B898.8080700@gmail.com
Whole thread Raw
In response to Should I CLUSTER on PRIMARY KEY  (Robert James <srobertjames@gmail.com>)
Responses Re: Should I CLUSTER on PRIMARY KEY
List 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 by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: timestamp with time zone tutorial
Next
From: Chris
Date:
Subject: Re: PostgreSQL Databse Migration to the Latest Version and Help for Database Replication.