Good Morning,
I am rather confused about the default value CURRENT_TIMESTAMP. Here is what I have so far:
RECREATE TABLE TABLE1
(
F1 INTEGER NOT NULL,
CUR_TIME TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE UNIQUE ASC INDEX IDX_TABLE1 ON TABLE1(F1);
ALTER TABLE TABLE1 ADD CONSTRAINT PK_TABLE1 PRIMARY KEY(F1);
Then from Basic I call the follow code:
EXECUTE BLOCK AS
DECLARE I INT = 0;
BEGIN
DELETE FROM TABLE1 WHERE F1 IS NOT NULL;
EXECUTE STATEMENT 'ALTER TABLE TABLE1 DROP CONSTRAINT PK_TABLE1';
EXECUTE STATEMENT 'DROP INDEX IDX_TABLE1';
WHILE (I < 1000000) DO
BEGIN
INSERT INTO TABLE1(F1) VALUES (:I);
I = I + 1;
END
EXECUTE STATEMENT 'CREATE UNIQUE ASC INDEX IDX_TABLE1 ON TABLE1(F1)';
EXECUTE STATEMENT 'ALTER TABLE TABLE1 ADD CONSTRAINT PK_TABLE1 PRIMARY KEY(F1)';
END
The time takes a little bit under a minute to execute.The SQL I use to get my metric is:
SELECT MIN( "F1" ), MAX( "F1" ), MIN( "CUR_TIME" ), MAX( "CUR_TIME" ) FROM "TABLE1"
having MIN( "CUR_TIME" )<MAX( "CUR_TIME" )
And the result is empty, which implies that every value in the CUR_TIME column is the same. This doesn’t make sense since the total time for the insert takes under a minute. So what does CURRENT_TIMESTAMP indicate? Is there a way to get the proper time stamp?