Re: PRIMARY KEY and indexes - Mailing list pgsql-general

From Sean Davis
Subject Re: PRIMARY KEY and indexes
Date
Msg-id 001101c547fe$fc7d9100$5179f345@WATSON
Whole thread Raw
In response to PRIMARY KEY and indexes  ("Craig Bryden" <postgresql@bryden.co.za>)
List pgsql-general
----- Original Message -----
From: "Craig Bryden" <postgresql@bryden.co.za>
To: "pgsql" <pgsql-general@postgresql.org>
Sent: Saturday, April 23, 2005 5:45 AM
Subject: [GENERAL] PRIMARY KEY and indexes


> Hi
>
> I come from a MS-SQL background and I'm trying to get some clarity on
> indexes in Postgres. If anyone can help with the following questions it
> would be much appreciated:
>
> 1. When creating a primary key contraint on a table, is an equivalent
> index
> automatically created for you, or would I have to create an index
> manually?

I think if you try it:

CREATE TABLE pk_idx_test (
 id INT PRIMARY KEY
);

You will get:

NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index
"pk_idx_test_pkey" for table "pk_idx_test"

Query returned successfully with no result in 266 ms.

> 2. How do I create a clustered index in postgres?

See the manual here:
http://www.postgresql.org/docs/8.0/interactive/index.html
and specifically here:
http://www.postgresql.org/docs/8.0/interactive/sql-cluster.html
http://www.postgresql.org/docs/8.0/interactive/sql-altertable.html



pgsql-general by date:

Previous
From: William Yu
Date:
Subject: Re: UltraSPARC versus AMD
Next
From: Typing80wpm@aol.com
Date:
Subject: Article on PostgreSQL V8 release