Re: PRIMARY KEY and indexes

Поиск
Список
Период
Сортировка
От Sean Davis
Тема Re: PRIMARY KEY and indexes
Дата
Msg-id 001101c547fe$fc7d9100$5179f345@WATSON
обсуждение исходный текст
Ответ на PRIMARY KEY and indexes  ("Craig Bryden" <postgresql@bryden.co.za>)
Список 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 по дате отправления:

Предыдущее
От: William Yu
Дата:
Сообщение: Re: UltraSPARC versus AMD
Следующее
От: Typing80wpm@aol.com
Дата:
Сообщение: Article on PostgreSQL V8 release