Re: PRIMARY KEY and INDEX

Re: PRIMARY KEY and INDEX

am 02.09.2004 15:50:17 von achill

O kyrios Nosyman egrapse stis Sep 2, 2004 :

> It is necessary to define an index for a primary key column?
>
> Let's have an example
> CREATE TABLE users(
> id_user INTEGER PRIMARY KEY,
> user_name VARCHAR(25)
> );
>
> Does PgSQL automatically create an index for id_user (primary key) or it
> must be created by hand?

Yes a unique index is created automatically so as to enforce the
PK constraint.

>
> Thanks
>
>
> ____________________________________________________________ _____
> Message
> sent using ITCNet free webmailer (http://www.easymail.ro)
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>

--
-Achilleus


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster