Search Postgresql Archives

Re: PRIMARY KEY and indexes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




----- Original Message ----- From: "Craig Bryden" <postgresql@xxxxxxxxxxxx>
To: "pgsql" <pgsql-general@xxxxxxxxxxxxxx>
Sent: Saturday, April 23, 2005 5:45 AM
Subject: 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



---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux