Add index for selecting active agent tokens
What does this MR do and why?
Adds a new index to cluster_agent_tokens
to optimise querying the recently added status
field.
Screenshots or screen recordings
== 20220111023852 IndexClusterAgentTokensOnStatus: migrating ==================
-- transaction_open?()
-> 0.0000s
-- index_exists?(:cluster_agent_tokens, "agent_id, status, last_used_at DESC NULLS LAST", {:name=>"index_cluster_agent_tokens_on_agent_id_status_last_used_at", :algorithm=>:concurrently})
-> 0.0160s
-- execute("SET statement_timeout TO 0")
-> 0.0009s
-- add_index(:cluster_agent_tokens, "agent_id, status, last_used_at DESC NULLS LAST", {:name=>"index_cluster_agent_tokens_on_agent_id_status_last_used_at", :algorithm=>:concurrently})
-> 0.0057s
-- execute("RESET statement_timeout")
-> 0.0007s
== 20220111023852 IndexClusterAgentTokensOnStatus: migrated (0.0257s) =========
== 20220111023852 IndexClusterAgentTokensOnStatus: reverting ==================
-- transaction_open?()
-> 0.0000s
-- indexes(:cluster_agent_tokens)
-> 0.0041s
-- execute("SET statement_timeout TO 0")
-> 0.0007s
-- remove_index(:cluster_agent_tokens, {:algorithm=>:concurrently, :name=>"index_cluster_agent_tokens_on_agent_id_status_last_used_at"})
-> 0.0071s
-- execute("RESET statement_timeout")
-> 0.0008s
== 20220111023852 IndexClusterAgentTokensOnStatus: reverted (0.0151s) =========
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
- [-] I have evaluated the MR acceptance checklist for this MR.
Merge request reports
Activity
assigned to @tigerwnz
mentioned in merge request !77735 (merged)
- A deleted user
added database databasereview pending labels
removed database databasereview pending labels
changed milestone to %14.7
added database databasereview pending groupconfigure [DEPRECATED] labels
added featureenhancement label
added typefeature label
1 Warning You've made some app changes, but didn't add any tests.
That's OK as long as you're refactoring existing code,
but please consider adding any of the ~"type::tooling", ~"tooling::pipelines", ~"tooling::workflow", documentation, QA labels.Reviewer roulette
Changes that require review have been detected!
Please refer to the table below for assigning reviewers and maintainers suggested by Danger in the specified category:
Category Reviewer Maintainer database Mehmet Emin Inac ( @minac
) (UTC+3, 8 hours behind@tigerwnz
)Andreas Brandl ( @abrandl
) (UTC+1, 10 hours behind@tigerwnz
)~migration No reviewer available No maintainer available To spread load more evenly across eligible reviewers, Danger has picked a candidate for each review slot, based on their timezone. Feel free to override these selections if you think someone else would be better-suited or use the GitLab Review Workload Dashboard to find other available reviewers.
To read more on how to use the reviewer roulette, please take a look at the Engineering workflow and code review guidelines. Please consider assigning a reviewer or maintainer who is a domain expert in the area of the merge request.
Once you've decided who will review this merge request, assign them as a reviewer! Danger does not automatically notify them for you.
If needed, you can retry the
danger-review
job that generated this comment.Generated by
Dangeradded typemaintenance label and removed featureenhancement typefeature labels
- Resolved by Mayra Cabrera
@minac can you please review?
requested review from @minac
- Resolved by Mayra Cabrera
mentioned in issue #348386 (closed)
added databasereviewed label and removed databasereview pending label
requested review from @mayra-cabrera and removed review request for @minac
@minac
, thanks for approving this merge request.This is the first time the merge request is approved. To ensure full test coverage, a new pipeline has been started.
For more info, please refer to the following links:
Setting label(s) ~"devops::configure" sectionops based on ~"group::configure".
added devopsconfigure [DEPRECATED] sectionops labels
Database migrations
Migrations included in this change have been executed on gitlab.com data for testing purposes. For details, please see the migration testing pipeline (limited access).
Migration Type Total runtime Result DB size change 20220111023852 - IndexClusterAgentTokensOnStatus Post deploy 1.8 s +104.00 KiB Runtime Histogram for all migrations
Query Runtime Count 0 seconds - 0.01 seconds 0 0.01 seconds - 0.1 seconds 3 0.1 seconds - 1 second 0 1 second - 5 minutes 0 5 minutes + 0 Migration: 20220111023852 - IndexClusterAgentTokensOnStatus
- Type: Post deploy
- Duration: 1.8 s
- Database size change: +104.00 KiB
Query Calls Total Time Max Time Mean Time Rows CREATE INDEX CONCURRENTLY "index_cluster_agent_tokens_on_agent_id_status_last_used_at" ON "cluster_agent_tokens" (agent_id, status, last_used_at DESC NULLS LAST) /*application:test,db_config_name:main*/
1 11.2 ms 11.2 ms 11.2 ms 0 SELECT "feature_gates".*
FROM "feature_gates"
WHERE "feature_gates"."feature_key" = $1 /*application:test,db_config_name:main*/1 1.7 ms 1.7 ms 1.7 ms 1 SELECT "postgres_async_indexes".*
FROM "postgres_async_indexes"
WHERE "postgres_async_indexes"."name" = $1
LIMIT $2 /*application:test,db_config_name:main*/1 0.1 ms 0.1 ms 0.1 ms 0 Histogram for IndexClusterAgentTokensOnStatus
Query Runtime Count 0 seconds - 0.01 seconds 0 0.01 seconds - 0.1 seconds 3 0.1 seconds - 1 second 0 1 second - 5 minutes 0 5 minutes + 0
Other migrations pending on GitLab.com
Migration Type Total runtime Result DB size change Clone Details
Clone ID Clone Created At Clone Data Timestamp Expected Removal Time database-testing-984646
2022-01-12 21:53:51 UTC 2022-01-12 19:25:43 UTC 2022-01-13 09:54:55 +0000 Artifacts
Brought to you by gitlab-org/database-team/gitlab-com-database-testing. Epic
enabled an automatic merge when the pipeline for 89b341bf succeeds
added databaseapproved label and removed databasereviewed label
mentioned in commit 9eddfadc
- A deleted user
added database-testing-automation label
added workflowstaging-canary label
added workflowstaging label and removed workflowstaging-canary label
added workflowcanary label and removed workflowstaging label
added workflowproduction label and removed workflowcanary label
mentioned in merge request !78348 (merged)
added releasedcandidate label
added releasedpublished label and removed releasedcandidate label
mentioned in merge request kubitus-project/kubitus-installer!562 (merged)
added groupenvironments label and removed groupconfigure [DEPRECATED] label