----- 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.htmlhttp://www.postgresql.org/docs/8.0/interactive/sql-altertable.html