Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sql): Add SQL index on createdon field #6522

Merged
merged 3 commits into from
Dec 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docker/mariadb/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
3 changes: 2 additions & 1 deletion docker/mysql-setup/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion docker/mysql/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 2 additions & 0 deletions docker/postgres-setup/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 2 additions & 0 deletions docker/postgres/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down