我有一个events这样的表:
create table events
(
correlation_id char(26) not null,
user_id bigint,
task_id bigint not null,
location_id bigint,
type bigint not null,
created_at timestamp(6) with time zone not null,
constraint events_correlation_id_created_at_user_id_unique
unique (correlation_id, created_at, user_id)
);
Run Code Online (Sandbox Code Playgroud)
Run Code Online (Sandbox Code Playgroud)CREATE TABLE
该表保存正在执行的任务的记录,如下所示:
insert into events (correlation_id, user_id, task_id, location_id, type, created_at)
values ('01CN4HP4AN0000000000000001', 4, 58, 30, 0, '2018-08-17 18:17:15.348629+00'),
('01CN4HP4AN0000000000000001', 4, 58, 30, 1, '2018-08-17 18:17:22.852299+00'),
('01CN4HP4AN0000000000000001', 4, 58, 30, 99, '2018-08-17 18:17:25.535593+00'),
('01CN4J9SZ80000000000000003', 4, 97, 30, 0, '2018-08-17 18:28:00.104093+00'),
('01CN4J9SZ80000000000000003', 4, …Run Code Online (Sandbox Code Playgroud)