Search code examples
databaseindexingderbycreate-table

Do I need to create separate index for primary key of relational database table


If I create table with primary key is index automatically created for the table or does that need doing separately.

i.e if this is the table ddl

 CREATE TABLE release(guid varchar(36) NOT NULL PRIMARY KEY,
name varchar(255),xmldata  CLOB(512 K))

do I also need to do

CREATE INDEX release_idx ON release(guid)

or not

(I'm using Derby a database that comes with Java)


Solution

  • You don't need to. The primary key is already an index.