-
Notifications
You must be signed in to change notification settings - Fork 641
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
Added index on ([SemVerLevelKey], [IsLatest], [Deleted]) on Packages table #3934
Conversation
Please make sure we add a step the deployment issue about running this migration. |
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.
✋ this PR is duplicate of #3867, which already exists in the feature/semver2
branch.
Why not cherry pick that change and make our lives easier by avoiding merge conflicts? Can you rollback this change on dev please?
public override void Up() | ||
{ | ||
Sql($"IF NOT EXISTS(SELECT * FROM sys.indexes WHERE name = '{IndexName}' AND object_id = OBJECT_ID('Packages')) " + | ||
$"CREATE NONCLUSTERED INDEX [{IndexName}] ON [dbo].[Packages]([SemVerLevelKey], [IsLatest], [Deleted]) "); |
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.
Misses WITH (ONLINE = ON)
. You don't want the query to time-out when creating this index on PROD, and instead want to create this index online on the db server.
If you revert this change and cherry pick from feature/semver2
, you'll get this for free ;)
https://github.com/NuGet/NuGetGallery/pull/3867/files#diff-a713b5aadf42ca59c0c90263d6d72100R10
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.
WITH(ONLINE=ON)
does not work with SQL Express Local DB...
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.
True, which is why, in the past, we always removed that part after applying this migration to PROD.
The
query now tops as the worst performing query, following the Azure's performance recommendation, creating an index for that query.