Update SQLServer DDL script to use sequences instead of tables

Emulating sequences with tables causes deadlocks when running
multiple jobs at the same time. Sequences have been supported
in SQL Server since version 2012.

This commit replaces the usage of tables to emulate sequences
with real sequences. It also adds a new incrementer that is
based on sequences instead of tables.

Resolves #1448
This commit is contained in:
Mahmoud Ben Hassine
2021-09-17 20:22:54 +02:00
parent a2ea8bad4a
commit fe911c8456
5 changed files with 97 additions and 7 deletions

View File

@@ -76,6 +76,6 @@ CREATE TABLE BATCH_JOB_EXECUTION_CONTEXT (
references BATCH_JOB_EXECUTION(JOB_EXECUTION_ID)
) ;
CREATE TABLE BATCH_STEP_EXECUTION_SEQ (ID BIGINT IDENTITY);
CREATE TABLE BATCH_JOB_EXECUTION_SEQ (ID BIGINT IDENTITY);
CREATE TABLE BATCH_JOB_SEQ (ID BIGINT IDENTITY);
CREATE SEQUENCE BATCH_STEP_EXECUTION_SEQ START WITH 0 MINVALUE 0 MAXVALUE 9223372036854775807 NO CACHE NO CYCLE;
CREATE SEQUENCE BATCH_JOB_EXECUTION_SEQ START WITH 0 MINVALUE 0 MAXVALUE 9223372036854775807 NO CACHE NO CYCLE;
CREATE SEQUENCE BATCH_JOB_SEQ START WITH 0 MINVALUE 0 MAXVALUE 9223372036854775807 NO CACHE NO CYCLE;