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.