Use CURRENT_TIMESTAMP instead of CURTIME

In MariaDB, `UNIX_TIMESTAMP(CURTIME(4))` yields `NULL`, not a meaningful value. It's better to work with `TIMESTAMP` anyway, than with `TIME` types, just in case the benchmark is run at midnight
This commit is contained in:
Lukas Eder 2021-10-25 09:24:10 +02:00 committed by GitHub
parent 00622b5be3
commit 3f38845132
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,7 +35,7 @@ BEGIN
SET r = 0;
REPEAT
SET v_ts = ROUND(UNIX_TIMESTAMP(CURTIME(4)) * 1000);
SET v_ts = ROUND(UNIX_TIMESTAMP(CURRENT_TIMESTAMP(4)) * 1000);
SET c = 0;
REPEAT
OPEN cur1;
@ -51,9 +51,9 @@ BEGIN
SET c = c + 1;
UNTIL c >= v_repeat END REPEAT;
INSERT INTO print VALUES (CONCAT('Run ', r, ', Statement 1 : ', ROUND(UNIX_TIMESTAMP(CURTIME(4)) * 1000) - v_ts));
INSERT INTO print VALUES (CONCAT('Run ', r, ', Statement 1 : ', ROUND(UNIX_TIMESTAMP(CURRENT_TIMESTAMP(4)) * 1000) - v_ts));
SET v_ts = ROUND(UNIX_TIMESTAMP(CURTIME(4)) * 1000);
SET v_ts = ROUND(UNIX_TIMESTAMP(CURRENT_TIMESTAMP(4)) * 1000);
SET c = 0;
REPEAT
OPEN cur2;
@ -69,7 +69,7 @@ BEGIN
SET c = c + 1;
UNTIL c >= v_repeat END REPEAT;
INSERT INTO print VALUES (CONCAT('Run ', r, ', Statement 2 : ', ROUND(UNIX_TIMESTAMP(CURTIME(4)) * 1000) - v_ts));
INSERT INTO print VALUES (CONCAT('Run ', r, ', Statement 2 : ', ROUND(UNIX_TIMESTAMP(CURRENT_TIMESTAMP(4)) * 1000) - v_ts));
SET r = r + 1;
UNTIL r >= 5 END REPEAT;
@ -90,4 +90,4 @@ SELECT 'https://www.jooq.org/benchmark';
DROP PROCEDURE benchmark;
DROP TABLE print;
DROP TABLE print;