From: | Robert James <srobertjames(at)gmail(dot)com> |
---|---|
To: | Chris <dmagick(at)gmail(dot)com> |
Cc: | Postgres General <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Should I CLUSTER on PRIMARY KEY |
Date: | 2009-07-20 00:56:08 |
Message-ID: | e09785e00907191756q74114720x298cb2d684e4054d@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Thanks, Chris. Is there a way to do this deterministically, or at least
programatically? I have code to create the tables and cluster them
automatically?
On Sun, Jul 19, 2009 at 8:21 PM, Chris <dmagick(at)gmail(dot)com> wrote:
> 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/
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Robert James | 2009-07-20 00:58:05 | Re: Understanding sequential versus index scans. |
Previous Message | Chris | 2009-07-20 00:29:41 | Re: PostgreSQL Databse Migration to the Latest Version and Help for Database Replication. |