CREATE TABLE IF NOT EXISTS public.udc_statistic ( id_user integer NOT NULL, key text NOT NULL, value text NOT NULL, PRIMARY KEY (key, id_user) ); CREATE TABLE IF NOT EXISTS public.udc_event ( id_user integer NOT NULL, timestamp bigint NOT NULL, type text NOT NULL, payload text ); CREATE INDEX id_user_type_timestamp_idx ON public.udc_event (id_user, type, timestamp);