I’ve a table which has lots of inserts and deletes (400 inserts/second) and  where primary key is something  like this:

 

CREATE TABLE  WORK2 (

SM_ID INT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),

MID VARCHAR(32),

(…)

);

 

With this kind of primary key definition I know that will be a time when the column SM_ID will reach the maximum value that a Java int value  can have- 2147483647 (java.lang.Integer.MAX_VALUE) .

So how can I resolve this problem?

 

I know that this table , WORK2, from time to time will be totally empty, so my first  idea was to reset the counter that SM_ID column is using back to 1 when the table has no lines. This way, next new line to be inserted on WORK2 will have SM_ID = 1…. But I don’t know how to do this via JDBC.

 

Many thanks,

P.Dinis.

 

 

 

 

 

Reply via email to