-
Notifications
You must be signed in to change notification settings - Fork 204
Add index to CompletedAt #3388
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
Add index to CompletedAt #3388
Conversation
|
Code coverage for golang is
|
|
|
||
| -- index on `CompletedAt` ASC | ||
| ALTER TABLE Deployment ADD COLUMN CompletedAt INT(11) GENERATED ALWAYS AS (data->>"$.completed_at") VIRTUAL NULL; | ||
| CREATE INDEX deployment_completed_at ON Deployment (CompletedAt); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nits, I don't think we need this index, instead of making this, maybe multiple columns index on CompletedAt and Id column is better, since this CompletedAt column is not be referred independently but in query with other columns. Should use explain query and check it out on MySQL cli.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, I'll check it.
|
I fixed it. PTAL. |
|
Nice work, thanks 🙌 |
|
/approve cancel |
| ALTER TABLE Deployment ADD COLUMN PipedId VARCHAR(36) GENERATED ALWAYS AS (data->>"$.piped_id") VIRTUAL NOT NULL; | ||
| CREATE INDEX deployment_piped_id ON Deployment (PipedId); | ||
|
|
||
| -- index on `CompletedAt` DESC |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nits, this should be on CompletedAt and Id
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. I updated, PTAL
|
Code coverage for golang is
|
|
Thanks 🙌 |
What this PR does / why we need it:
Currently, completedAt does not exists on mysql column, and so order by completedAt will be failed.
To fix this, this PR create generated column of completedAt and add index to it. CompletedAt is nullable.
Which issue(s) this PR fixes:
Fixes #
Does this PR introduce a user-facing change?: