-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path001-event.sql
More file actions
27 lines (25 loc) · 907 Bytes
/
001-event.sql
File metadata and controls
27 lines (25 loc) · 907 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
--001-event.sql
-----------------------------------------------------------------------
-- agent.event
create table agent.event
( id int8 not null primary key generated by default as identity
, event_ts timestamptz not null default now()
, attempts int4 not null default 0
, vt timestamptz not null default now() -- visibility threshold
, claimed timestamptz[] not null default array[]::timestamptz[]
, event jsonb
);
create index on agent.event (vt, attempts);
-----------------------------------------------------------------------
-- agent.event_hist
create table if not exists agent.event_hist
( id int8 not null
, event_ts timestamptz not null default now()
, attempts int4 not null default 0
, vt timestamptz not null default now() -- visibility threshold
, claimed timestamptz[] not null default array[]::timestamptz[]
, event jsonb
) with (
tsdb.hypertable,
tsdb.partition_column='event_ts'
);