|
|
|
@ -22,8 +22,6 @@ CREATE INDEX IF NOT EXISTS idx_alarm_tenant_created_time ON alarm(tenant_id, cre |
|
|
|
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_alarm_tenant_alarm_type_created_time ON alarm(tenant_id, type, created_time DESC); |
|
|
|
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_event_type_entity_id ON event(tenant_id, event_type, entity_type, entity_id); |
|
|
|
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_relation_to_id ON relation(relation_type_group, to_type, to_id); |
|
|
|
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_relation_from_id ON relation(relation_type_group, from_type, from_id); |
|
|
|
@ -47,3 +45,19 @@ CREATE INDEX IF NOT EXISTS idx_attribute_kv_by_key_and_last_update_ts ON attribu |
|
|
|
CREATE INDEX IF NOT EXISTS idx_audit_log_tenant_id_and_created_time ON audit_log(tenant_id, created_time); |
|
|
|
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_rpc_tenant_id_device_id ON rpc(tenant_id, device_id); |
|
|
|
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_event_ts |
|
|
|
ON public.event USING btree |
|
|
|
(ts DESC NULLS LAST) |
|
|
|
WITH (FILLFACTOR=95); |
|
|
|
|
|
|
|
COMMENT ON INDEX public.idx_event_ts |
|
|
|
IS 'This index helps to delete events by TTL using timestamp'; |
|
|
|
|
|
|
|
CREATE INDEX IF NOT EXISTS idx_event_tenant_entity_type_entity_event_type_created_time_des |
|
|
|
ON public.event USING btree |
|
|
|
(tenant_id ASC NULLS LAST, entity_type ASC NULLS LAST, entity_id ASC NULLS LAST, event_type ASC NULLS LAST, created_time DESC NULLS LAST) |
|
|
|
WITH (FILLFACTOR=95); |
|
|
|
|
|
|
|
COMMENT ON INDEX public.idx_event_tenant_entity_type_entity_event_type_created_time_des |
|
|
|
IS 'This index helps to open latest events on UI fast'; |