29

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)

Brian Tompsett - 汤莱恩
  • 5,438
  • 68
  • 55
  • 126
Paul Taylor
  • 12,989
  • 37
  • 170
  • 321

1 Answers1

57

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

Jon
  • 413,451
  • 75
  • 717
  • 787