diff --git a/docker/mariadb/init.sql b/docker/mariadb/init.sql index 084fdc93a3717a..c4132575cf442c 100644 --- a/docker/mariadb/init.sql +++ b/docker/mariadb/init.sql @@ -11,6 +11,8 @@ create table metadata_aspect_v2 ( constraint pk_metadata_aspect_v2 primary key (urn,aspect,version) ); +create index timeIndex ON metadata_aspect_v2 (createdon); + insert into metadata_aspect_v2 (urn, aspect, version, metadata, createdon, createdby) values( 'urn:li:corpuser:datahub', 'corpUserInfo', diff --git a/docker/mysql-setup/init.sql b/docker/mysql-setup/init.sql index 6bd7133a359a89..78098af4648bce 100644 --- a/docker/mysql-setup/init.sql +++ b/docker/mysql-setup/init.sql @@ -12,7 +12,8 @@ create table if not exists metadata_aspect_v2 ( createdon datetime(6) not null, createdby varchar(255) not null, createdfor varchar(255), - constraint pk_metadata_aspect_v2 primary key (urn,aspect,version) + constraint pk_metadata_aspect_v2 primary key (urn,aspect,version), + INDEX timeIndex (createdon) ); -- create default records for datahub user if not exists diff --git a/docker/mysql/init.sql b/docker/mysql/init.sql index fa9d856f499e4e..97ae3ea1467445 100644 --- a/docker/mysql/init.sql +++ b/docker/mysql/init.sql @@ -8,7 +8,8 @@ CREATE TABLE metadata_aspect_v2 ( createdon datetime(6) NOT NULL, createdby VARCHAR(255) NOT NULL, createdfor VARCHAR(255), - CONSTRAINT pk_metadata_aspect_v2 PRIMARY KEY (urn,aspect,version) + constraint pk_metadata_aspect_v2 primary key (urn,aspect,version), + INDEX timeIndex (createdon) ) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; INSERT INTO metadata_aspect_v2 (urn, aspect, version, metadata, createdon, createdby) VALUES( diff --git a/docker/postgres-setup/init.sql b/docker/postgres-setup/init.sql index e7c515e7385acc..12fff7aec7fe6f 100644 --- a/docker/postgres-setup/init.sql +++ b/docker/postgres-setup/init.sql @@ -11,6 +11,8 @@ CREATE TABLE IF NOT EXISTS metadata_aspect_v2 ( CONSTRAINT pk_metadata_aspect_v2 PRIMARY KEY (urn, aspect, version) ); +create index timeIndex ON metadata_aspect_v2 (createdon); + -- create default records for datahub user if not exists CREATE TEMP TABLE temp_metadata_aspect_v2 AS TABLE metadata_aspect_v2; INSERT INTO temp_metadata_aspect_v2 (urn, aspect, version, metadata, createdon, createdby) VALUES( diff --git a/docker/postgres/init.sql b/docker/postgres/init.sql index 72298ed4b6726d..4da8adaf8a6da0 100644 --- a/docker/postgres/init.sql +++ b/docker/postgres/init.sql @@ -11,6 +11,8 @@ create table metadata_aspect_v2 ( constraint pk_metadata_aspect_v2 primary key (urn,aspect,version) ); +create index timeIndex ON metadata_aspect_v2 (createdon); + insert into metadata_aspect_v2 (urn, aspect, version, metadata, createdon, createdby) values( 'urn:li:corpuser:datahub', 'corpUserInfo',