简体   繁体   中英

Is creating a large volume table without a primary key problematic - Oracle 11g?

In Oracle 11g I was thinking of creating a table that looks like this:

CREATE TABLE SOME_TABLE (
  MACHINE_ID      NUMBER(10,0) NOT NULL ENABLE,
  CYCLE_ID        NUMBER NOT NULL ENABLE,
  START_TIME      TIMESTAMP (6) NOT NULL ENABLE,
  DATA            VARCHAR2(255),
  CONSTRAINT "PK_SOME_TABLE" PRIMARY KEY ("MACHINE_ID", "CYCLE_ID")
)

This table will receive approximately 2.5 million records per day.

The CYCLE_ID is taken from a sequence, and is part of the primary key.

I am worried that using a sequence for the CYCLE_ID for this amount of data is a bad idea because the sequence will restart at 0 at some point in time, thus resulting in duplicate key errors.

Would it be better to remove the CYCLE_ID from the table, thus leaving the table without a unique key ? What problems can I expect from having such a large volume table without a unique primary key ?

Thank you very much.

As per my opiniion don't remove sequence from your table rather alter your sequence. Remove the cycle clause from your sequence. This will solve your problem because then the sequence will never turn to 0 and your table will always have a primary key.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM