Re: Key Vs Index - Mailing list pgsql-general

From Scott Marlowe
Subject Re: Key Vs Index
Date
Msg-id dcc563d10902102332oaf329e6i50b63e693e2d5b0d@mail.gmail.com
Whole thread Raw
In response to Key Vs Index  (Abdul Rahman <abr_ora@yahoo.com>)
Responses Re: Key Vs Index  (Craig Ringer <craig@postnewspapers.com.au>)
List pgsql-general
On Wed, Feb 11, 2009 at 12:09 AM, Abdul Rahman <abr_ora@yahoo.com> wrote:
> In Oracle, the index is automatically created during the creation of Primary
> Key. But in PostgreSQL either index is implicitly created of the user hast
> create it explicitly. I don't find any index against Primary Key and have to
> create index on this key.

Let's look:
smarlowe=# create table test (id int primary key, info text);
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index
"test_pkey" for table "test"
CREATE TABLE
smarlowe=# \d test
     Table "public.test"
 Column |  Type   | Modifiers
--------+---------+-----------
 id     | integer | not null
 info   | text    |
Indexes:
    "test_pkey" PRIMARY KEY, btree (id)

See where it says btree(id) under Indexes:?  That's telling you it's
got an index.

Note that the index on the FK side isn't auto created.

pgsql-general by date:

Previous
From: Craig Ringer
Date:
Subject: Re: Key Vs Index
Next
From: Abdul Rahman
Date:
Subject: Re: Key Vs Index