Browse Source

Add id indexes on new partitioned tables

pull/7722/head
Igor Kulikov 4 years ago
parent
commit
7dd9a491b9
  1. 1
      application/src/main/data/upgrade/3.4.1/schema_update.sql
  2. 2
      dao/src/main/resources/sql/schema-entities-idx.sql

1
application/src/main/data/upgrade/3.4.1/schema_update.sql

@ -112,6 +112,7 @@ CREATE TABLE IF NOT EXISTS edge_event (
ts bigint NOT NULL
) PARTITION BY RANGE (created_time);
CREATE INDEX IF NOT EXISTS idx_edge_event_tenant_id_and_created_time ON edge_event(tenant_id, created_time DESC);
CREATE INDEX IF NOT EXISTS idx_edge_event_id ON edge_event(id);
CREATE OR REPLACE PROCEDURE migrate_edge_event(IN start_time_ms BIGINT, IN end_time_ms BIGINT, IN partition_size_ms BIGINT)
LANGUAGE plpgsql AS

2
dao/src/main/resources/sql/schema-entities-idx.sql

@ -54,6 +54,8 @@ CREATE INDEX IF NOT EXISTS idx_audit_log_id ON audit_log(id);
CREATE INDEX IF NOT EXISTS idx_edge_event_tenant_id_and_created_time ON edge_event(tenant_id, created_time DESC);
CREATE INDEX IF NOT EXISTS idx_edge_event_id ON edge_event(id);
CREATE INDEX IF NOT EXISTS idx_rpc_tenant_id_device_id ON rpc(tenant_id, device_id);
CREATE INDEX IF NOT EXISTS idx_device_external_id ON device(tenant_id, external_id);

Loading…
Cancel
Save