Replace foreign keys to use the partitioned table - V2
What does this MR do and why?
This reintroduces the migrations that we no-oped from !121718 (merged).
This changes them to automatically skip the ones that would not be possible to run because of the wraparound autovacuum process.
Related to #414396 (closed)
Screenshots or screen recordings
Output when there is a wraparound vacuum going on ci_builds
:
$ RAILS_ENV=test bin/rails db:migrate:ci
ci: == [advisory_lock_connection] object_id: 224340, pg_backend_pid: 82744
ci: == 20230612075608 ReplaceCiJobArtifactsForeignKeyV2: migrating ================
ci: -- Wraparound prevention vacuum detected, skipping migration
ci: == 20230612075608 ReplaceCiJobArtifactsForeignKeyV2: migrated (0.0673s) =======
ci: == 20230612083337 ReplaceCiRunningBuildsForeignKeyV2: migrating ===============
ci: -- Wraparound prevention vacuum detected, skipping migration
ci: == 20230612083337 ReplaceCiRunningBuildsForeignKeyV2: migrated (0.0100s) ======
ci: == 20230612083655 ReplaceCiJobVariablesForeignKeyV2: migrating ================
ci: -- Wraparound prevention vacuum detected, skipping migration
ci: == 20230612083655 ReplaceCiJobVariablesForeignKeyV2: migrated (0.0091s) =======
ci: == 20230612083810 ReplacePCiBuildsMetadataForeignKeyV2: migrating =============
ci: -- Wraparound prevention vacuum detected, skipping migration
ci: == 20230612083810 ReplacePCiBuildsMetadataForeignKeyV2: migrated (0.0096s) ====
ci: == 20230612084013 ReplacePCiRunnerMachineBuildsForeignKeyV2: migrating ========
ci: -- Wraparound prevention vacuum detected, skipping migration
ci: == 20230612084013 ReplacePCiRunnerMachineBuildsForeignKeyV2: migrated (0.0110s)
ci: == [advisory_lock_connection] object_id: 224340, pg_backend_pid: 82744
Output when there is a wraparound vacuum going on other table, say ci_job_variables
:
$ RAILS_ENV=test bin/rails db:migrate:ci
ci: == [advisory_lock_connection] object_id: 224340, pg_backend_pid: 86982
ci: == 20230612075608 ReplaceCiJobArtifactsForeignKeyV2: migrating ================
ci: -- transaction_open?()
ci: -> 0.0000s
ci: -- transaction_open?()
ci: -> 0.0000s
ci: -- execute("LOCK TABLE p_ci_builds, ci_job_artifacts IN SHARE ROW EXCLUSIVE MODE")
ci: -> 0.0005s
ci: -- execute("ALTER TABLE ci_job_artifacts ADD CONSTRAINT temp_fk_rails_c5137cb2c1_p FOREIGN KEY (partition_id, job_id) REFERENCES p_ci_builds (partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;")
ci: -> 0.0011s
ci: == 20230612075608 ReplaceCiJobArtifactsForeignKeyV2: migrated (0.0970s) =======
ci: == 20230612083337 ReplaceCiRunningBuildsForeignKeyV2: migrating ===============
ci: -- transaction_open?()
ci: -> 0.0000s
ci: -- transaction_open?()
ci: -> 0.0000s
ci: -- execute("LOCK TABLE p_ci_builds, ci_running_builds IN SHARE ROW EXCLUSIVE MODE")
ci: -> 0.0003s
ci: -- execute("ALTER TABLE ci_running_builds ADD CONSTRAINT temp_fk_rails_da45cfa165_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds (partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;")
ci: -> 0.0006s
ci: == 20230612083337 ReplaceCiRunningBuildsForeignKeyV2: migrated (0.0246s) ======
ci: == 20230612083655 ReplaceCiJobVariablesForeignKeyV2: migrating ================
ci: -- Wraparound prevention vacuum detected, skipping migration
ci: == 20230612083655 ReplaceCiJobVariablesForeignKeyV2: migrated (0.0090s) =======
ci: == 20230612083810 ReplacePCiBuildsMetadataForeignKeyV2: migrating =============
ci: -- transaction_open?()
ci: -> 0.0000s
ci: -- transaction_open?()
ci: -> 0.0000s
ci: -- transaction_open?()
ci: -> 0.0000s
ci: -- execute("LOCK TABLE p_ci_builds, public.ci_builds_metadata IN SHARE ROW EXCLUSIVE MODE")
ci: -> 0.0003s
ci: -- execute("ALTER TABLE public.ci_builds_metadata ADD CONSTRAINT temp_fk_e20479742e_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds (partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;")
ci: -> 0.0006s
ci: == 20230612083810 ReplacePCiBuildsMetadataForeignKeyV2: migrated (0.0374s) ====
ci: == 20230612084013 ReplacePCiRunnerMachineBuildsForeignKeyV2: migrating ========
ci: -- transaction_open?()
ci: -> 0.0000s
ci: -- transaction_open?()
ci: -> 0.0000s
ci: -- transaction_open?()
ci: -> 0.0000s
ci: -- execute("LOCK TABLE p_ci_builds, gitlab_partitions_dynamic.ci_runner_machine_builds_100 IN SHARE ROW EXCLUSIVE MODE")
ci: -> 0.0003s
ci: -- execute("ALTER TABLE gitlab_partitions_dynamic.ci_runner_machine_builds_100 ADD CONSTRAINT temp_fk_bb490f12fe_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds (partition_id, id) ON UPDATE CASCADE ON DELETE CASCADE NOT VALID;")
ci: -> 0.0006s
ci: == 20230612084013 ReplacePCiRunnerMachineBuildsForeignKeyV2: migrated (0.0346s)
ci: == [advisory_lock_connection] object_id: 224340, pg_backend_pid: 86982
How to set up and validate locally
While it is possible to trigger wraparound prevention autovacuum on a thin clone, it's hard to do it on a development/test database and it's duration will not be enough to test the migrations, but these steps can be used locally:
$ bin/rails c -e test
# we're using this to replace the view with a table and have the option to insert data into it:
require_relative 'spec/support/helpers/database/database_helpers.rb'
include Database::DatabaseHelpers
swapout_view_for_table(:postgres_autovacuum_activity, connection: Ci::ApplicationRecord.connection)
Gitlab::Database::SharedModel.using_connection(Ci::ApplicationRecord.connection) { Gitlab::Database::PostgresAutovacuumActivity.create(table_identifier: 'public.ci_job_variables', schema: 'public', table: 'ci_job_variables', wraparound_prevention: true) }
To reset after testing:
git checkout db/structure.sql
git checkout master
-
./scripts/regenerate-schema
, make sure to close the rails console before.
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 @mbobin
- A deleted user
added backend database databasereview pending featureaddition typefeature labels
2 Warnings featureaddition and featureenhancement merge requests normally have a documentation change. Consider adding a documentation update or confirming the documentation plan with the Technical Writer counterpart.
For more information, see:
- The Handbook page on merge request types.
- The definition of done documentation.
There were no new or modified feature flag YAML files detected in this MR. If the changes here are already controlled under an existing feature flag, please add
the feature flagexists. Otherwise, if you think the changes here don't need
to be under a feature flag, please add the label feature flagskipped, and
add a short comment about why we skipped the feature flag.For guidance on when to use a feature flag, please see the documentation.
1 Message This merge request adds or changes files that require a review from the Database team. This merge request requires a database review. To make sure these changes are reviewed, take the following steps:
-
Ensure the merge request has database and databasereview pending labels. If the merge request modifies database files, Danger will do this for you.
-
Prepare your MR for database review according to the docs.
-
Assign and mention the database reviewer suggested by Reviewer Roulette.
-
Kick off the
db:gitlabcom-database-testing
manual job. This job can also be used before requesting review to test your migrations against production data.
The following files require a review from the Database team:
db/post_migrate/20230612075608_replace_ci_job_artifacts_foreign_key_v2.rb
db/post_migrate/20230612083337_replace_ci_running_builds_foreign_key_v2.rb
db/post_migrate/20230612083655_replace_ci_job_variables_foreign_key_v2.rb
db/post_migrate/20230612083810_replace_p_ci_builds_metadata_foreign_key_v2.rb
db/post_migrate/20230612084013_replace_p_ci_runner_machine_builds_foreign_key_v2.rb
db/schema_migrations/20230612075608
db/schema_migrations/20230612083337
db/schema_migrations/20230612083655
db/schema_migrations/20230612083810
db/schema_migrations/20230612084013
lib/gitlab/database/migration_helpers/wraparound_autovacuum.rb
db/structure.sql
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 backend Eugie Limpin (
@eugielimpin
) (UTC+8, 5 hours ahead of@mbobin
)Drew Cimino (
@drew
) (UTC+0, 3 hours behind@mbobin
)database Vitali Tatarintev (
@ck3g
) (UTC+2, 1 hour behind@mbobin
)Eulyeon K. (
@euko
) (UTC+9, 6 hours ahead of@mbobin
)~"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
Danger- A deleted user
added Data WarehouseImpact Check label
Allure report
allure-report-publisher
generated test report!e2e-test-on-gdk:
test report for c79e00baexpand test summary
+-----------------------------------------------------------------------+ | suites summary | +------------------+--------+--------+---------+-------+-------+--------+ | | passed | failed | skipped | flaky | total | result | +------------------+--------+--------+---------+-------+-------+--------+ | Create | 8 | 0 | 1 | 0 | 9 | ✅ | | Plan | 4 | 0 | 0 | 0 | 4 | ✅ | | Govern | 2 | 0 | 0 | 0 | 2 | ✅ | | Monitor | 4 | 0 | 0 | 0 | 4 | ✅ | | Data Stores | 2 | 0 | 0 | 1 | 2 | ❗ | | Manage | 1 | 0 | 0 | 0 | 1 | ✅ | | Framework sanity | 0 | 0 | 1 | 0 | 1 | ➖ | +------------------+--------+--------+---------+-------+-------+--------+ | Total | 21 | 0 | 2 | 1 | 23 | ❗ | +------------------+--------+--------+---------+-------+-------+--------+
mentioned in merge request !123353 (merged)
mentioned in issue gitlab-com/gl-infra/production#14888 (closed)
Setting label grouppipeline execution based on
@mbobin
's group.added grouppipeline execution label
- Resolved by Max Orefice
added devopsverify sectionci labels
mentioned in merge request !123212 (merged)
added 434 commits
-
d56bf97e...8a3c26ce - 433 commits from branch
master
- b15c6829 - Replace foreign keys to use the partitioned table
-
d56bf97e...8a3c26ce - 433 commits from branch
changed milestone to %16.1
Started database testing pipeline (limited access). This comment will be updated once the pipeline has finished running.
- Resolved by Steve Abrams
Error: Database testing pipeline failureFailed pipeline ID: 2022709
The database testing pipeline has failed for pipeline ID 2022709. Please reach out in
#database
or to a database maintainer to help troubleshoot.Why aren't details of the failure posted here?
Because migration testing pipelines use production data, and this merge request is public. Production data may contain sensitive information, so we only expose this data in job artifacts and output from the pipeline itself.
Why don't I have access to this pipeline?
Because migration testing pipelines use production data, sensitive information could be leaked in job logs. As a result, the reports are limited to:
- Members of the database group
- Database maintainers
- GitLab team members with an approved access request for Reporter access to https://ops.gitlab.net/gitlab-com/database-team/gitlab-com-database-testing/.
Can I just re-run the pipeline?
Possibly yes, if the errors were caused by an incident (or services being slow) and re-running could fix it. If you're doing something slow, remember:
- Migration testing jobs time out after 10 hours. Synchronous work on a big table can reach this limit, and re-running will mean you wait another 10 hours for it.
- Migration sampling runs 30 minutes per background migration. If you add 20 background migrations, you will hit the timeout. Consider breaking multiple background migrations apart into separate merge requests.
If you think re-running might fix it, re-trigger the pipeline by running the manual job
db:gitlabcom-database-testing
.
- Resolved by Steve Abrams
- Resolved by Steve Abrams
- Resolved by Steve Abrams
requested review from @morefice
- Resolved by Steve Abrams
- Resolved by Steve Abrams
@morefice
, thanks for approving this merge request.This is the first time the merge request is approved. To ensure full test coverage, a new pipeline will be started shortly.
For more info, please refer to the following links:
added pipeline:mr-approved label
added databasereviewed label and removed databasereview pending label
requested review from @sabrams
removed review request for @morefice
Error: Database testing pipeline failureFailed pipeline ID: 2022879
The database testing pipeline has failed for pipeline ID 2022879. Please reach out in
#database
or to a database maintainer to help troubleshoot.Why aren't details of the failure posted here?
Because migration testing pipelines use production data, and this merge request is public. Production data may contain sensitive information, so we only expose this data in job artifacts and output from the pipeline itself.
Why don't I have access to this pipeline?
Because migration testing pipelines use production data, sensitive information could be leaked in job logs. As a result, the reports are limited to:
- Members of the database group
- Database maintainers
- GitLab team members with an approved access request for Reporter access to https://ops.gitlab.net/gitlab-com/database-team/gitlab-com-database-testing/.
Can I just re-run the pipeline?
Possibly yes, if the errors were caused by an incident (or services being slow) and re-running could fix it. If you're doing something slow, remember:
- Migration testing jobs time out after 10 hours. Synchronous work on a big table can reach this limit, and re-running will mean you wait another 10 hours for it.
- Migration sampling runs 30 minutes per background migration. If you add 20 background migrations, you will hit the timeout. Consider breaking multiple background migrations apart into separate merge requests.
If you think re-running might fix it, re-trigger the pipeline by running the manual job
db:gitlabcom-database-testing
.Database migrations (on the main database)
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 20230612075608 - ReplaceCiJobArtifactsForeignKeyV2 Post deploy 2.4 s +0.00 B 20230612083337 - ReplaceCiRunningBuildsForeignKeyV2 Post deploy 2.4 s +0.00 B 20230612083655 - ReplaceCiJobVariablesForeignKeyV2 Post deploy 2.3 s +8.00 KiB 20230612083810 - ReplacePCiBuildsMetadataForeignKeyV2 Post deploy 3.5 s +0.00 B 20230612084013 - ReplacePCiRunnerMachineBuildsForeignKeyV2 Post deploy 2.6 s +0.00 B Runtime Histogram for all migrations
Query Runtime Count 0 seconds - 0.01 seconds 0 0.01 seconds - 0.1 seconds 78 0.1 seconds - 1 second 1 1 second - 5 seconds 0 5 seconds - 15 seconds 0 15 seconds - 5 minutes 0 5 minutes + 0 Migration: 20230612075608 - ReplaceCiJobArtifactsForeignKeyV2
- Type: Post deploy
- Duration: 2.4 s
- Database size change: +0.00 B
Calls Total Time Max Time Mean Time Rows Query 1 4.0 ms 4.0 ms 4.0 ms 0 SELECT "postgres_autovacuum_activity".*
FROM "postgres_autovacuum_activity" WHERE "postgres_autovacuum_activity"."wraparound_prevention" = $1 AND (schema = current_schema()) AND "postgres_autovacuum_activity"."table" IN ($2, $3)1 2.2 ms 2.2 ms 2.2 ms 0 ALTER TABLE ci_job_artifacts ADD CONSTRAINT temp_fk_rails_c5137cb2c1_p FOREIGN KEY (partition_id, job_id) REFERENCES p_ci_builds (partition_id, id) ON
UPDATE CASCADE ON DELETE CASCADE NOT VALID1 1.5 ms 1.5 ms 1.5 ms 1 SELECT $1 AS one
FROM "postgres_foreign_keys" WHERE "postgres_foreign_keys"."constrained_table_name" = $2 AND "postgres_foreign_keys"."name" = $3
LIMIT $41 0.2 ms 0.2 ms 0.2 ms 0 LOCK TABLE p_ci_builds, ci_job_artifacts IN SHARE ROW EXCLUSIVE MODE
2 0.3 ms 0.2 ms 0.2 ms 0 SELECT "postgres_partitioned_tables".*
FROM "postgres_partitioned_tables" WHERE (identifier = concat(current_schema(), $1, $2))
LIMIT $31 0.1 ms 0.1 ms 0.1 ms 1 INSERT INTO "postgres_async_foreign_key_validations" ("created_at", "updated_at", "name", "table_name") VALUES ($1, $2, $3, $4) RETURNING "id"
1 0.0 ms 0.0 ms 0.0 ms 0 SELECT $1 AS one
FROM "postgres_async_foreign_key_validations" WHERE "postgres_async_foreign_key_validations"."name" = $2 AND "postgres_async_foreign_key_validations"."table_name" = $3
LIMIT $41 0.0 ms 0.0 ms 0.0 ms 0 SELECT "postgres_async_foreign_key_validations".*
FROM "postgres_async_foreign_key_validations" WHERE "postgres_async_foreign_key_validations"."constraint_type" = $1 AND "postgres_async_foreign_key_validations"."name" = $2 AND "postgres_async_foreign_key_validations"."table_name" = $3
LIMIT $41 0.0 ms 0.0 ms 0.0 ms 0 SELECT $1 AS one
FROM "postgres_foreign_keys" WHERE "postgres_foreign_keys"."constrained_table_name" = $2 AND "postgres_foreign_keys"."referenced_table_name" = $3 AND "postgres_foreign_keys"."name" = $4 AND "postgres_foreign_keys"."constrained_columns" = $5 AND "postgres_foreign_keys"."referenced_columns" = $6 AND "postgres_foreign_keys"."on_delete_action" = $7
LIMIT $82 0.0 ms 0.0 ms 0.0 ms 2 SELECT pg_backend_pid()
Histogram for ReplaceCiJobArtifactsForeignKeyV2
Query Runtime Count 0 seconds - 0.01 seconds 0 0.01 seconds - 0.1 seconds 11 0.1 seconds - 1 second 1 1 second - 5 seconds 0 5 seconds - 15 seconds 0 15 seconds - 5 minutes 0 5 minutes + 0 Migration: 20230612083337 - ReplaceCiRunningBuildsForeignKeyV2
- Type: Post deploy
- Duration: 2.4 s
- Database size change: +0.00 B
Calls Total Time Max Time Mean Time Rows Query 1 2.0 ms 2.0 ms 2.0 ms 0 ALTER TABLE ci_running_builds ADD CONSTRAINT temp_fk_rails_da45cfa165_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds (partition_id, id) ON
UPDATE CASCADE ON DELETE CASCADE NOT VALID1 1.5 ms 1.5 ms 1.5 ms 1 SELECT $1 AS one
FROM "postgres_foreign_keys" WHERE "postgres_foreign_keys"."constrained_table_name" = $2 AND "postgres_foreign_keys"."name" = $3
LIMIT $41 0.9 ms 0.9 ms 0.9 ms 0 SELECT "postgres_autovacuum_activity".*
FROM "postgres_autovacuum_activity" WHERE "postgres_autovacuum_activity"."wraparound_prevention" = $1 AND (schema = current_schema()) AND "postgres_autovacuum_activity"."table" IN ($2, $3)1 0.2 ms 0.2 ms 0.2 ms 0 LOCK TABLE p_ci_builds, ci_running_builds IN SHARE ROW EXCLUSIVE MODE
2 0.3 ms 0.1 ms 0.1 ms 0 SELECT "postgres_partitioned_tables".*
FROM "postgres_partitioned_tables" WHERE (identifier = concat(current_schema(), $1, $2))
LIMIT $31 0.1 ms 0.1 ms 0.1 ms 1 INSERT INTO "postgres_async_foreign_key_validations" ("created_at", "updated_at", "name", "table_name") VALUES ($1, $2, $3, $4) RETURNING "id"
1 0.0 ms 0.0 ms 0.0 ms 0 SELECT $1 AS one
FROM "postgres_async_foreign_key_validations" WHERE "postgres_async_foreign_key_validations"."name" = $2 AND "postgres_async_foreign_key_validations"."table_name" = $3
LIMIT $41 0.0 ms 0.0 ms 0.0 ms 0 SELECT "postgres_async_foreign_key_validations".*
FROM "postgres_async_foreign_key_validations" WHERE "postgres_async_foreign_key_validations"."constraint_type" = $1 AND "postgres_async_foreign_key_validations"."name" = $2 AND "postgres_async_foreign_key_validations"."table_name" = $3
LIMIT $41 0.0 ms 0.0 ms 0.0 ms 0 SELECT $1 AS one
FROM "postgres_foreign_keys" WHERE "postgres_foreign_keys"."constrained_table_name" = $2 AND "postgres_foreign_keys"."referenced_table_name" = $3 AND "postgres_foreign_keys"."name" = $4 AND "postgres_foreign_keys"."constrained_columns" = $5 AND "postgres_foreign_keys"."referenced_columns" = $6 AND "postgres_foreign_keys"."on_delete_action" = $7
LIMIT $82 0.0 ms 0.0 ms 0.0 ms 2 SELECT pg_backend_pid()
Histogram for ReplaceCiRunningBuildsForeignKeyV2
Query Runtime Count 0 seconds - 0.01 seconds 0 0.01 seconds - 0.1 seconds 12 0.1 seconds - 1 second 0 1 second - 5 seconds 0 5 seconds - 15 seconds 0 15 seconds - 5 minutes 0 5 minutes + 0 Migration: 20230612083655 - ReplaceCiJobVariablesForeignKeyV2
- Type: Post deploy
- Duration: 2.3 s
- Database size change: +8.00 KiB
Calls Total Time Max Time Mean Time Rows Query 1 3.0 ms 3.0 ms 3.0 ms 0 ALTER TABLE ci_job_variables ADD CONSTRAINT temp_fk_rails_fbf3b34792_p FOREIGN KEY (partition_id, job_id) REFERENCES p_ci_builds (partition_id, id) ON
UPDATE CASCADE ON DELETE CASCADE NOT VALID1 1.4 ms 1.4 ms 1.4 ms 1 SELECT $1 AS one
FROM "postgres_foreign_keys" WHERE "postgres_foreign_keys"."constrained_table_name" = $2 AND "postgres_foreign_keys"."name" = $3
LIMIT $41 0.6 ms 0.6 ms 0.6 ms 0 SELECT "postgres_autovacuum_activity".*
FROM "postgres_autovacuum_activity" WHERE "postgres_autovacuum_activity"."wraparound_prevention" = $1 AND (schema = current_schema()) AND "postgres_autovacuum_activity"."table" IN ($2, $3)1 0.2 ms 0.2 ms 0.2 ms 0 LOCK TABLE p_ci_builds, ci_job_variables IN SHARE ROW EXCLUSIVE MODE
2 0.3 ms 0.1 ms 0.1 ms 0 SELECT "postgres_partitioned_tables".*
FROM "postgres_partitioned_tables" WHERE (identifier = concat(current_schema(), $1, $2))
LIMIT $31 0.1 ms 0.1 ms 0.1 ms 1 INSERT INTO "postgres_async_foreign_key_validations" ("created_at", "updated_at", "name", "table_name") VALUES ($1, $2, $3, $4) RETURNING "id"
1 0.0 ms 0.0 ms 0.0 ms 0 SELECT $1 AS one
FROM "postgres_async_foreign_key_validations" WHERE "postgres_async_foreign_key_validations"."name" = $2 AND "postgres_async_foreign_key_validations"."table_name" = $3
LIMIT $41 0.0 ms 0.0 ms 0.0 ms 0 SELECT $1 AS one
FROM "postgres_foreign_keys" WHERE "postgres_foreign_keys"."constrained_table_name" = $2 AND "postgres_foreign_keys"."referenced_table_name" = $3 AND "postgres_foreign_keys"."name" = $4 AND "postgres_foreign_keys"."constrained_columns" = $5 AND "postgres_foreign_keys"."referenced_columns" = $6 AND "postgres_foreign_keys"."on_delete_action" = $7
LIMIT $81 0.0 ms 0.0 ms 0.0 ms 0 SELECT "postgres_async_foreign_key_validations".*
FROM "postgres_async_foreign_key_validations" WHERE "postgres_async_foreign_key_validations"."constraint_type" = $1 AND "postgres_async_foreign_key_validations"."name" = $2 AND "postgres_async_foreign_key_validations"."table_name" = $3
LIMIT $42 0.0 ms 0.0 ms 0.0 ms 2 SELECT pg_backend_pid()
Histogram for ReplaceCiJobVariablesForeignKeyV2
Query Runtime Count 0 seconds - 0.01 seconds 0 0.01 seconds - 0.1 seconds 12 0.1 seconds - 1 second 0 1 second - 5 seconds 0 5 seconds - 15 seconds 0 15 seconds - 5 minutes 0 5 minutes + 0 Migration: 20230612083810 - ReplacePCiBuildsMetadataForeignKeyV2
- Type: Post deploy
- Duration: 3.5 s
- Database size change: +0.00 B
Calls Total Time Max Time Mean Time Rows Query 2 14.2 ms 7.3 ms 7.1 ms 4 SELECT "postgres_partitions".*
FROM "postgres_partitions" WHERE "postgres_partitions"."parent_identifier" = $1
ORDER BY "postgres_partitions"."name" ASC1 2.3 ms 2.3 ms 2.3 ms 0 ALTER TABLE gitlab_partitions_dynamic.ci_builds_metadata_101 ADD CONSTRAINT temp_fk_e20479742e_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds (partition_id, id) ON
UPDATE CASCADE ON DELETE CASCADE NOT VALID1 1.6 ms 1.6 ms 1.6 ms 0 ALTER TABLE public.ci_builds_metadata ADD CONSTRAINT temp_fk_e20479742e_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds (partition_id, id) ON
UPDATE CASCADE ON DELETE CASCADE NOT VALID2 2.9 ms 1.5 ms 1.5 ms 2 SELECT $1 AS one
FROM "postgres_foreign_keys" WHERE "postgres_foreign_keys"."constrained_table_identifier" = $2 AND "postgres_foreign_keys"."name" = $3
LIMIT $41 0.6 ms 0.6 ms 0.6 ms 0 SELECT "postgres_autovacuum_activity".*
FROM "postgres_autovacuum_activity" WHERE "postgres_autovacuum_activity"."wraparound_prevention" = $1 AND (schema = current_schema()) AND "postgres_autovacuum_activity"."table" IN ($2, $3)1 0.4 ms 0.4 ms 0.4 ms 0 LOCK TABLE p_ci_builds, gitlab_partitions_dynamic.ci_builds_metadata_101 IN SHARE ROW EXCLUSIVE MODE
6 1.0 ms 0.3 ms 0.2 ms 2 SELECT "postgres_partitioned_tables".*
FROM "postgres_partitioned_tables" WHERE (identifier = concat(current_schema(), $1, $2))
LIMIT $31 0.1 ms 0.1 ms 0.1 ms 0 LOCK TABLE p_ci_builds, public.ci_builds_metadata IN SHARE ROW EXCLUSIVE MODE
2 0.2 ms 0.1 ms 0.1 ms 0 SELECT $1 AS one
FROM "postgres_foreign_keys" WHERE "postgres_foreign_keys"."constrained_table_identifier" = $2 AND "postgres_foreign_keys"."referenced_table_name" = $3 AND "postgres_foreign_keys"."name" = $4 AND "postgres_foreign_keys"."constrained_columns" = $5 AND "postgres_foreign_keys"."referenced_columns" = $6 AND "postgres_foreign_keys"."on_delete_action" = $7
LIMIT $82 0.1 ms 0.1 ms 0.1 ms 2 INSERT INTO "postgres_async_foreign_key_validations" ("created_at", "updated_at", "name", "table_name") VALUES ($1, $2, $3, $4) RETURNING "id"
2 0.0 ms 0.0 ms 0.0 ms 0 SELECT $1 AS one
FROM "postgres_async_foreign_key_validations" WHERE "postgres_async_foreign_key_validations"."name" = $2 AND "postgres_async_foreign_key_validations"."table_name" = $3
LIMIT $42 0.0 ms 0.0 ms 0.0 ms 0 SELECT "postgres_async_foreign_key_validations".*
FROM "postgres_async_foreign_key_validations" WHERE "postgres_async_foreign_key_validations"."constraint_type" = $1 AND "postgres_async_foreign_key_validations"."name" = $2 AND "postgres_async_foreign_key_validations"."table_name" = $3
LIMIT $41 0.0 ms 0.0 ms 0.0 ms 0 SELECT $1 AS one
FROM "postgres_foreign_keys" WHERE "postgres_foreign_keys"."constrained_table_name" = $2 AND "postgres_foreign_keys"."referenced_table_name" = $3 AND "postgres_foreign_keys"."name" = $4 AND "postgres_foreign_keys"."constrained_columns" = $5 AND "postgres_foreign_keys"."referenced_columns" = $6 AND "postgres_foreign_keys"."on_delete_action" = $7
LIMIT $82 0.0 ms 0.0 ms 0.0 ms 2 SELECT pg_backend_pid()
Histogram for ReplacePCiBuildsMetadataForeignKeyV2
Query Runtime Count 0 seconds - 0.01 seconds 0 0.01 seconds - 0.1 seconds 26 0.1 seconds - 1 second 0 1 second - 5 seconds 0 5 seconds - 15 seconds 0 15 seconds - 5 minutes 0 5 minutes + 0 Migration: 20230612084013 - ReplacePCiRunnerMachineBuildsForeignKeyV2
- Type: Post deploy
- Duration: 2.6 s
- Database size change: +0.00 B
Calls Total Time Max Time Mean Time Rows Query 2 14.1 ms 7.2 ms 7.1 ms 2 SELECT "postgres_partitions".*
FROM "postgres_partitions" WHERE "postgres_partitions"."parent_identifier" = $1
ORDER BY "postgres_partitions"."name" ASC1 1.8 ms 1.8 ms 1.8 ms 0 ALTER TABLE gitlab_partitions_dynamic.ci_runner_machine_builds_100 ADD CONSTRAINT temp_fk_bb490f12fe_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds (partition_id, id) ON
UPDATE CASCADE ON DELETE CASCADE NOT VALID1 1.4 ms 1.4 ms 1.4 ms 1 SELECT $1 AS one
FROM "postgres_foreign_keys" WHERE "postgres_foreign_keys"."constrained_table_identifier" = $2 AND "postgres_foreign_keys"."name" = $3
LIMIT $41 0.8 ms 0.8 ms 0.8 ms 0 SELECT "postgres_autovacuum_activity".*
FROM "postgres_autovacuum_activity" WHERE "postgres_autovacuum_activity"."wraparound_prevention" = $1 AND (schema = current_schema()) AND "postgres_autovacuum_activity"."table" = $21 0.2 ms 0.2 ms 0.2 ms 0 LOCK TABLE p_ci_builds, gitlab_partitions_dynamic.ci_runner_machine_builds_100 IN SHARE ROW EXCLUSIVE MODE
4 0.6 ms 0.2 ms 0.1 ms 2 SELECT "postgres_partitioned_tables".*
FROM "postgres_partitioned_tables" WHERE (identifier = concat(current_schema(), $1, $2))
LIMIT $31 0.1 ms 0.1 ms 0.1 ms 1 INSERT INTO "postgres_async_foreign_key_validations" ("created_at", "updated_at", "name", "table_name") VALUES ($1, $2, $3, $4) RETURNING "id"
1 0.0 ms 0.0 ms 0.0 ms 0 SELECT $1 AS one
FROM "postgres_foreign_keys" WHERE "postgres_foreign_keys"."constrained_table_identifier" = $2 AND "postgres_foreign_keys"."referenced_table_name" = $3 AND "postgres_foreign_keys"."name" = $4 AND "postgres_foreign_keys"."constrained_columns" = $5 AND "postgres_foreign_keys"."referenced_columns" = $6 AND "postgres_foreign_keys"."on_delete_action" = $7
LIMIT $81 0.0 ms 0.0 ms 0.0 ms 0 SELECT $1 AS one
FROM "postgres_foreign_keys" WHERE "postgres_foreign_keys"."constrained_table_name" = $2 AND "postgres_foreign_keys"."referenced_table_name" = $3 AND "postgres_foreign_keys"."name" = $4 AND "postgres_foreign_keys"."constrained_columns" = $5 AND "postgres_foreign_keys"."referenced_columns" = $6 AND "postgres_foreign_keys"."on_delete_action" = $7
LIMIT $81 0.0 ms 0.0 ms 0.0 ms 0 SELECT "postgres_async_foreign_key_validations".*
FROM "postgres_async_foreign_key_validations" WHERE "postgres_async_foreign_key_validations"."constraint_type" = $1 AND "postgres_async_foreign_key_validations"."name" = $2 AND "postgres_async_foreign_key_validations"."table_name" = $3
LIMIT $41 0.0 ms 0.0 ms 0.0 ms 0 SELECT $1 AS one
FROM "postgres_async_foreign_key_validations" WHERE "postgres_async_foreign_key_validations"."name" = $2 AND "postgres_async_foreign_key_validations"."table_name" = $3
LIMIT $42 0.0 ms 0.0 ms 0.0 ms 2 SELECT pg_backend_pid()
Histogram for ReplacePCiRunnerMachineBuildsForeignKeyV2
Query Runtime Count 0 seconds - 0.01 seconds 0 0.01 seconds - 0.1 seconds 17 0.1 seconds - 1 second 0 1 second - 5 seconds 0 5 seconds - 15 seconds 0 15 seconds - 5 minutes 0 5 minutes + 0 Background Migration: CleanupPersonalAccessTokensWithNilExpiresAt
Sampled 1 batches. Estimated Time to complete: 3 hours and 40 minutes
- Interval: 120s
- Total tuple count: 5526473
- Max batch size:
- Estimated seconds to complete: 13200s
- Estimated number of batches: 110
- Average batch time: 0.99s
- Batch size: 50000
- N. of batches sampled: 1
- N. of failed batches: 0
Time estimation is conservative and based on sampling production data in a test environment. It represents the max time that migration could take. The actual time may differ from this estimation.
_Consider changing max_batch_size and interval if this estimate is unacceptable._
Calls Total Time Max Time Mean Time Rows Query 1 37.5 ms 37.5 ms 37.5 ms 0 SELECT "personal_access_tokens"."id" FROM "personal_access_tokens" WHERE "personal_access_tokens"."id" BETWEEN $1 AND $2 AND "personal_access_tokens"."expires_at" IS NULL AND "personal_access_tokens"."id" >= $3
ORDER BY "personal_access_tokens"."id" ASC
LIMIT $4
OFFSET $51 32.5 ms 32.5 ms 32.5 ms 9 UPDATE "personal_access_tokens" SET "expires_at" = $1
WHERE "personal_access_tokens"."id" BETWEEN $2 AND $3 AND "personal_access_tokens"."expires_at" IS NULL AND "personal_access_tokens"."id" >= $42 0.4 ms 0.2 ms 0.2 ms 2 INSERT INTO "batched_background_migration_job_transition_logs" ("batched_background_migration_job_id", "created_at", "updated_at", "previous_status", "next_status") VALUES ($1, $2, $3, $4, $5) RETURNING "id"
1 0.1 ms 0.1 ms 0.1 ms 1 UPDATE "batched_background_migration_jobs" SET "updated_at" = $1, "started_at" = $2, "status" = $3, "attempts" = $4
WHERE "batched_background_migration_jobs"."id" = $51 0.1 ms 0.1 ms 0.1 ms 1 UPDATE "batched_background_migration_jobs" SET "updated_at" = $1, "finished_at" = $2, "status" = $3, "metrics" = $4
WHERE "batched_background_migration_jobs"."id" = $51 0.1 ms 0.1 ms 0.1 ms 1 SELECT SUM("batched_background_migration_jobs"."batch_size")
FROM "batched_background_migration_jobs" WHERE "batched_background_migration_jobs"."batched_background_migration_id" = $1 AND ("batched_background_migration_jobs"."status" IN ($2))2 0.1 ms 0.0 ms 0.0 ms 2 SELECT "batched_background_migration_jobs".*
FROM "batched_background_migration_jobs" WHERE "batched_background_migration_jobs"."id" = $1
LIMIT $21 0.0 ms 0.0 ms 0.0 ms 1 SELECT "batched_background_migrations".*
FROM "batched_background_migrations" WHERE "batched_background_migrations"."id" = $1
LIMIT $21 0.0 ms 0.0 ms 0.0 ms 1 SELECT "personal_access_tokens"."id" FROM "personal_access_tokens" WHERE "personal_access_tokens"."id" BETWEEN $1 AND $2 AND "personal_access_tokens"."expires_at" IS NULL
ORDER BY "personal_access_tokens"."id" ASC
LIMIT $3Histogram of batch runtimes for CleanupPersonalAccessTokensWithNilExpiresAt
Batch Runtime Count 0 seconds - 10 seconds 1 10 seconds - 1 minute 0 1 minute - 2 minutes 0 2 minutes - 3 minutes 0 3 minutes - 5 minutes 0 5 minutes + 0 Histogram across all sampled batches of CleanupPersonalAccessTokensWithNilExpiresAt
Query Runtime Count 0 seconds - 0.1 seconds 11 0.1 seconds - 0.5 seconds 0 0.5 seconds - 1 second 0 1 second - 2 seconds 0 2 seconds - 5 seconds 0 5 seconds + 0 Background Migration: MarkDuplicateNpmPackagesForDestruction
Sampled 3 batches. Estimated Time to complete: 2 days, 20 hours, and 50 minutes
- Interval: 120s
- Total tuple count: 10328546
- Max batch size:
- Estimated seconds to complete: 247800s
- Estimated number of batches: 2065
- Average batch time: 4.81s
- Batch size: 5000
- N. of batches sampled: 3
- N. of failed batches: 0
Time estimation is conservative and based on sampling production data in a test environment. It represents the max time that migration could take. The actual time may differ from this estimation.
_Consider changing max_batch_size and interval if this estimate is unacceptable._
Calls Total Time Max Time Mean Time Rows Query 20 3138.2 ms 383.4 ms 156.9 ms 13 SELECT "packages_packages"."id" FROM "packages_packages" INNER JOIN (
SELECT project_id, name, version, MAX(id) AS max_id
FROM "packages_packages" WHERE "packages_packages"."project_id" IN ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31, $32, $33, $34, $35, $36, $37, $38, $39, $40, $41, $42, $43, $44, $45, $46, $47, $48, $49, $50, $51, $52, $53, $54, $55, $56, $57, $58, $59, $60, $61, $62, $63, $64, $65, $66, $67, $68, $69, $70, $71, $72, $73, $74, $75, $76, $77, $78, $79, $80, $81, $82, $83, $84, $85, $86, $87, $88, $89, $90, $91, $92, $93, $94, $95, $96, $97, $98, $99, $100, $101, $102, $103, $104, $105, $106, $107, $108, $109, $110, $111, $112, $113, $114, $115, $116, $117, $118, $119, $120, $121, $122, $123, $124, $125, $126, $127, $128, $129, $130, $131, $132, $133, $134, $135, $136, $137, $138, $139, $140, $141, $142, $143, $144, $145, $146, $147, $148, $149, $150, $151, $152, $153, $154, $155, $156, $157, $158, $159, $160, $161, $162, $163, $164, $165, $166, $167, $168, $169, $170, $171, $172, $173, $174, $175, $176, $177, $178, $179, $180, $181, $182, $183, $184, $185, $186, $187, $188, $189, $190, $191, $192, $193, $194, $195, $196, $197, $198, $199, $200, $201, $202, $203, $204, $205, $206, $207, $208, $209, $210, $211, $212, $213, $214, $215, $216, $217, $218, $219, $220, $221, $222, $223, $224, $225, $226, $227, $228, $229, $230, $231, $232, $233, $234, $235, $236, $237, $238, $239, $240, $241, $242, $243, $244, $245, $246, $247, $248, $249, $250, $251, $252, $253, $254, $255, $256, $257, $258, $259, $260, $261, $262, $263, $264, $265, $266, $267, $268, $269, $270, $271, $272, $273, $274, $275, $276, $277, $278, $279, $280, $281, $282, $283, $284, $285, $286, $287, $288, $289, $290, $291, $292, $293, $294, $295, $296, $297, $298, $299, $300, $301, $302, $303, $304, $305, $306, $307, $308, $309, $310, $311, $312, $313, $314, $315, $316, $317, $318, $319, $320, $321, $322, $323, $324, $325, $326, $327, $328, $329, $330, $331, $332, $333, $334, $335, $336, $337, $338, $339, $340, $341, $342, $343, $344, $345, $346, $347, $348, $349, $350, $351, $352, $353, $354, $355, $356, $357, $358, $359, $360, $361, $362, $363, $364, $365, $366, $367, $368, $369, $370, $371, $372, $373, $374, $375, $376, $377, $378, $379, $380, $381, $382, $383, $384, $385, $386, $387, $388, $389, $390, $391, $392, $393, $394, $395, $396, $397, $398, $399, $400, $401, $402, $403, $404, $405, $406, $407, $408, $409, $410, $411, $412, $413, $414, $415, $416, $417, $418, $419, $420, $421, $422, $423, $424, $425, $426, $427, $428, $429, $430, $431, $432, $433, $434, $435, $436, $437, $438, $439, $440, $441, $442, $443, $444, $445, $446, $447, $448, $449, $450, $451, $452, $453, $454, $455, $456, $457, $458, $459, $460, $461, $462, $463, $464, $465, $466, $467, $468, $469, $470, $471, $472, $473, $474, $475, $476, $477, $478, $479, $480, $481, $482, $483, $484, $485, $486, $487, $488, $489, $490, $491, $492, $493, $494, $495, $496, $497, $498, $499, $500) AND "packages_packages"."package_type" = $501 AND "packages_packages"."status" != $502
GROUP BY "packages_packages"."project_id", "packages_packages"."name", "packages_packages"."version" HAVING (COUNT(*) > $503)
) AS duplicates ON packages_packages.project_id = duplicates.project_id AND packages_packages.name = duplicates.name AND packages_packages.version = duplicates.version
WHERE NOT (packages_packages.id = duplicates.max_id)
ORDER BY "packages_packages"."id" ASC
LIMIT $50413 929.5 ms 211.4 ms 71.5 ms 291 UPDATE "packages_packages" SET "status" = $1
WHERE "packages_packages"."id" IN (
SELECT "packages_packages"."id" FROM "packages_packages" INNER JOIN (
SELECT project_id, name, version, MAX(id) AS max_id
FROM "packages_packages" WHERE "packages_packages"."project_id" IN ($2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31, $32, $33, $34, $35, $36, $37, $38, $39, $40, $41, $42, $43, $44, $45, $46, $47, $48, $49, $50, $51, $52, $53, $54, $55, $56, $57, $58, $59, $60, $61, $62, $63, $64, $65, $66, $67, $68, $69, $70, $71, $72, $73, $74, $75, $76, $77, $78, $79, $80, $81, $82, $83, $84, $85, $86, $87, $88, $89, $90, $91, $92, $93, $94, $95, $96, $97, $98, $99, $100, $101, $102, $103, $104, $105, $106, $107, $108, $109, $110, $111, $112, $113, $114, $115, $116, $117, $118, $119, $120, $121, $122, $123, $124, $125, $126, $127, $128, $129, $130, $131, $132, $133, $134, $135, $136, $137, $138, $139, $140, $141, $142, $143, $144, $145, $146, $147, $148, $149, $150, $151, $152, $153, $154, $155, $156, $157, $158, $159, $160, $161, $162, $163, $164, $165, $166, $167, $168, $169, $170, $171, $172, $173, $174, $175, $176, $177, $178, $179, $180, $181, $182, $183, $184, $185, $186, $187, $188, $189, $190, $191, $192, $193, $194, $195, $196, $197, $198, $199, $200, $201, $202, $203, $204, $205, $206, $207, $208, $209, $210, $211, $212, $213, $214, $215, $216, $217, $218, $219, $220, $221, $222, $223, $224, $225, $226, $227, $228, $229, $230, $231, $232, $233, $234, $235, $236, $237, $238, $239, $240, $241, $242, $243, $244, $245, $246, $247, $248, $249, $250, $251, $252, $253, $254, $255, $256, $257, $258, $259, $260, $261, $262, $263, $264, $265, $266, $267, $268, $269, $270, $271, $272, $273, $274, $275, $276, $277, $278, $279, $280, $281, $282, $283, $284, $285, $286, $287, $288, $289, $290, $291, $292, $293, $294, $295, $296, $297, $298, $299, $300, $301, $302, $303, $304, $305, $306, $307, $308, $309, $310, $311, $312, $313, $314, $315, $316, $317, $318, $319, $320, $321, $322, $323, $324, $325, $326, $327, $328, $329, $330, $331, $332, $333, $334, $335, $336, $337, $338, $339, $340, $341, $342, $343, $344, $345, $346, $347, $348, $349, $350, $351, $352, $353, $354, $355, $356, $357, $358, $359, $360, $361, $362, $363, $364, $365, $366, $367, $368, $369, $370, $371, $372, $373, $374, $375, $376, $377, $378, $379, $380, $381, $382, $383, $384, $385, $386, $387, $388, $389, $390, $391, $392, $393, $394, $395, $396, $397, $398, $399, $400, $401, $402, $403, $404, $405, $406, $407, $408, $409, $410, $411, $412, $413, $414, $415, $416, $417, $418, $419, $420, $421, $422, $423, $424, $425, $426, $427, $428, $429, $430, $431, $432, $433, $434, $435, $436, $437, $438, $439, $440, $441, $442, $443, $444, $445, $446, $447, $448, $449, $450, $451, $452, $453, $454, $455, $456, $457, $458, $459, $460, $461, $462, $463, $464, $465, $466, $467, $468, $469, $470, $471, $472, $473, $474, $475, $476, $477, $478, $479, $480, $481, $482, $483, $484, $485, $486, $487, $488, $489, $490, $491, $492, $493, $494, $495, $496, $497, $498, $499, $500, $501) AND "packages_packages"."package_type" = $502 AND "packages_packages"."status" != $503
GROUP BY "packages_packages"."project_id", "packages_packages"."name", "packages_packages"."version" HAVING (COUNT(*) > $504)
) AS duplicates ON packages_packages.project_id = duplicates.project_id AND packages_packages.name = duplicates.name AND packages_packages.version = duplicates.version
WHERE NOT (packages_packages.id = duplicates.max_id) AND "packages_packages"."id" >= $505
)13 308.3 ms 48.9 ms 23.7 ms 0 SELECT "packages_packages"."id" FROM "packages_packages" INNER JOIN (
SELECT project_id, name, version, MAX(id) AS max_id
FROM "packages_packages" WHERE "packages_packages"."project_id" IN ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22, $23, $24, $25, $26, $27, $28, $29, $30, $31, $32, $33, $34, $35, $36, $37, $38, $39, $40, $41, $42, $43, $44, $45, $46, $47, $48, $49, $50, $51, $52, $53, $54, $55, $56, $57, $58, $59, $60, $61, $62, $63, $64, $65, $66, $67, $68, $69, $70, $71, $72, $73, $74, $75, $76, $77, $78, $79, $80, $81, $82, $83, $84, $85, $86, $87, $88, $89, $90, $91, $92, $93, $94, $95, $96, $97, $98, $99, $100, $101, $102, $103, $104, $105, $106, $107, $108, $109, $110, $111, $112, $113, $114, $115, $116, $117, $118, $119, $120, $121, $122, $123, $124, $125, $126, $127, $128, $129, $130, $131, $132, $133, $134, $135, $136, $137, $138, $139, $140, $141, $142, $143, $144, $145, $146, $147, $148, $149, $150, $151, $152, $153, $154, $155, $156, $157, $158, $159, $160, $161, $162, $163, $164, $165, $166, $167, $168, $169, $170, $171, $172, $173, $174, $175, $176, $177, $178, $179, $180, $181, $182, $183, $184, $185, $186, $187, $188, $189, $190, $191, $192, $193, $194, $195, $196, $197, $198, $199, $200, $201, $202, $203, $204, $205, $206, $207, $208, $209, $210, $211, $212, $213, $214, $215, $216, $217, $218, $219, $220, $221, $222, $223, $224, $225, $226, $227, $228, $229, $230, $231, $232, $233, $234, $235, $236, $237, $238, $239, $240, $241, $242, $243, $244, $245, $246, $247, $248, $249, $250, $251, $252, $253, $254, $255, $256, $257, $258, $259, $260, $261, $262, $263, $264, $265, $266, $267, $268, $269, $270, $271, $272, $273, $274, $275, $276, $277, $278, $279, $280, $281, $282, $283, $284, $285, $286, $287, $288, $289, $290, $291, $292, $293, $294, $295, $296, $297, $298, $299, $300, $301, $302, $303, $304, $305, $306, $307, $308, $309, $310, $311, $312, $313, $314, $315, $316, $317, $318, $319, $320, $321, $322, $323, $324, $325, $326, $327, $328, $329, $330, $331, $332, $333, $334, $335, $336, $337, $338, $339, $340, $341, $342, $343, $344, $345, $346, $347, $348, $349, $350, $351, $352, $353, $354, $355, $356, $357, $358, $359, $360, $361, $362, $363, $364, $365, $366, $367, $368, $369, $370, $371, $372, $373, $374, $375, $376, $377, $378, $379, $380, $381, $382, $383, $384, $385, $386, $387, $388, $389, $390, $391, $392, $393, $394, $395, $396, $397, $398, $399, $400, $401, $402, $403, $404, $405, $406, $407, $408, $409, $410, $411, $412, $413, $414, $415, $416, $417, $418, $419, $420, $421, $422, $423, $424, $425, $426, $427, $428, $429, $430, $431, $432, $433, $434, $435, $436, $437, $438, $439, $440, $441, $442, $443, $444, $445, $446, $447, $448, $449, $450, $451, $452, $453, $454, $455, $456, $457, $458, $459, $460, $461, $462, $463, $464, $465, $466, $467, $468, $469, $470, $471, $472, $473, $474, $475, $476, $477, $478, $479, $480, $481, $482, $483, $484, $485, $486, $487, $488, $489, $490, $491, $492, $493, $494, $495, $496, $497, $498, $499, $500) AND "packages_packages"."package_type" = $501 AND "packages_packages"."status" != $502
GROUP BY "packages_packages"."project_id", "packages_packages"."name", "packages_packages"."version" HAVING (COUNT(*) > $503)
) AS duplicates ON packages_packages.project_id = duplicates.project_id AND packages_packages.name = duplicates.name AND packages_packages.version = duplicates.version
WHERE NOT (packages_packages.id = duplicates.max_id) AND "packages_packages"."id" >= $504
ORDER BY "packages_packages"."id" ASC
LIMIT $505
OFFSET $50618 93.3 ms 5.7 ms 5.2 ms 9000 WITH RECURSIVE "loose_index_scan_cte" AS ((
SELECT "packages_packages"."project_id" FROM "packages_packages" WHERE "packages_packages"."project_id" BETWEEN $1 AND $2 AND "packages_packages"."project_id" >= $3
ORDER BY "packages_packages"."project_id" ASC
LIMIT $4
) UNION (
SELECT (
SELECT "packages_packages"."project_id" FROM "packages_packages" WHERE "packages_packages"."project_id" BETWEEN $5 AND $6 AND "packages_packages"."project_id" < $7 AND "packages_packages"."project_id" > "loose_index_scan_cte"."project_id" ORDER BY "packages_packages"."project_id" ASC
LIMIT $8
) AS project_id
FROM "loose_index_scan_cte"))
SELECT "project_id" FROM "loose_index_scan_cte" AS "packages_packages" WHERE "packages_packages"."project_id" IS NOT NULL21 100.9 ms 5.6 ms 4.8 ms 18 WITH RECURSIVE "loose_index_scan_cte" AS ((
SELECT "packages_packages"."project_id" FROM "packages_packages" WHERE "packages_packages"."project_id" BETWEEN $1 AND $2 AND "packages_packages"."project_id" >= $3
ORDER BY "packages_packages"."project_id" ASC
LIMIT $4
) UNION (
SELECT (
SELECT "packages_packages"."project_id" FROM "packages_packages" WHERE "packages_packages"."project_id" BETWEEN $5 AND $6 AND "packages_packages"."project_id" > "loose_index_scan_cte"."project_id" ORDER BY "packages_packages"."project_id" ASC
LIMIT $7
) AS project_id
FROM "loose_index_scan_cte"))
SELECT project_id
FROM "loose_index_scan_cte" AS "packages_packages" WHERE "packages_packages"."project_id" IS NOT NULL
LIMIT $8
OFFSET $93 10.2 ms 5.0 ms 3.4 ms 1018 WITH RECURSIVE "loose_index_scan_cte" AS ((
SELECT "packages_packages"."project_id" FROM "packages_packages" WHERE "packages_packages"."project_id" BETWEEN $1 AND $2 AND "packages_packages"."project_id" >= $3
ORDER BY "packages_packages"."project_id" ASC
LIMIT $4
) UNION (
SELECT (
SELECT "packages_packages"."project_id" FROM "packages_packages" WHERE "packages_packages"."project_id" BETWEEN $5 AND $6 AND "packages_packages"."project_id" > "loose_index_scan_cte"."project_id" ORDER BY "packages_packages"."project_id" ASC
LIMIT $7
) AS project_id
FROM "loose_index_scan_cte"))
SELECT "project_id" FROM "loose_index_scan_cte" AS "packages_packages" WHERE "packages_packages"."project_id" IS NOT NULL6 4.9 ms 4.0 ms 0.8 ms 6 INSERT INTO "batched_background_migration_job_transition_logs" ("batched_background_migration_job_id", "created_at", "updated_at", "previous_status", "next_status") VALUES ($1, $2, $3, $4, $5) RETURNING "id"
3 1.3 ms 1.1 ms 0.4 ms 3 UPDATE "batched_background_migration_jobs" SET "updated_at" = $1, "finished_at" = $2, "status" = $3, "metrics" = $4
WHERE "batched_background_migration_jobs"."id" = $51 0.4 ms 0.4 ms 0.4 ms 0 SELECT "packages_packages"."id" FROM "packages_packages" INNER JOIN (
SELECT project_id, name, version, MAX(id) AS max_id
FROM "packages_packages" WHERE "packages_packages"."project_id" IN ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18) AND "packages_packages"."package_type" = $19 AND "packages_packages"."status" != $20
GROUP BY "packages_packages"."project_id", "packages_packages"."name", "packages_packages"."version" HAVING (COUNT(*) > $21)
) AS duplicates ON packages_packages.project_id = duplicates.project_id AND packages_packages.name = duplicates.name AND packages_packages.version = duplicates.version
WHERE NOT (packages_packages.id = duplicates.max_id)
ORDER BY "packages_packages"."id" ASC
LIMIT $223 0.4 ms 0.2 ms 0.1 ms 3 UPDATE "batched_background_migration_jobs" SET "updated_at" = $1, "started_at" = $2, "status" = $3, "attempts" = $4
WHERE "batched_background_migration_jobs"."id" = $56 0.3 ms 0.1 ms 0.1 ms 6 SELECT "batched_background_migration_jobs".*
FROM "batched_background_migration_jobs" WHERE "batched_background_migration_jobs"."id" = $1
LIMIT $23 0.1 ms 0.0 ms 0.0 ms 3 SELECT SUM("batched_background_migration_jobs"."batch_size")
FROM "batched_background_migration_jobs" WHERE "batched_background_migration_jobs"."batched_background_migration_id" = $1 AND ("batched_background_migration_jobs"."status" IN ($2))3 0.1 ms 0.0 ms 0.0 ms 3 SELECT "batched_background_migrations".*
FROM "batched_background_migrations" WHERE "batched_background_migrations"."id" = $1
LIMIT $23 0.1 ms 0.0 ms 0.0 ms 3 SELECT "packages_packages"."project_id" FROM "packages_packages" WHERE "packages_packages"."project_id" BETWEEN $1 AND $2
ORDER BY "packages_packages"."project_id" ASC
LIMIT $3Histogram of batch runtimes for MarkDuplicateNpmPackagesForDestruction
Batch Runtime Count 0 seconds - 10 seconds 3 10 seconds - 1 minute 0 1 minute - 2 minutes 0 2 minutes - 3 minutes 0 3 minutes - 5 minutes 0 5 minutes + 0 Histogram across all sampled batches of MarkDuplicateNpmPackagesForDestruction
Query Runtime Count 0 seconds - 0.1 seconds 83 0.1 seconds - 0.5 seconds 33 0.5 seconds - 1 second 0 1 second - 2 seconds 0 2 seconds - 5 seconds 0 5 seconds + 0 Other information
Other migrations pending on GitLab.com
Migration Type Total runtime Result DB size change 20230522180913 - CreateAbuseEvents Regular 2.4 s +48.00 KiB 20230522181134 - AddForeignKeyConstraintsToAbuseEvents Regular 2.0 s +0.00 B 20230524142655 - AddEnabledZoektToUserPreferences Regular 1.6 s +0.00 B 20230601085810 - CreateProjectComplianceStandardsAdherence Regular 2.3 s +48.00 KiB 20230601085815 - AddFkToProjectsComplianceStandardsAdherenceOnProjectId Regular 1.9 s +0.00 B 20230601085820 - AddFkToProjectsComplianceStandardsAdherenceOnNamespaceId Regular 1.9 s +0.00 B 20230605043258 - AddUnconfirmedCreatedAtIndexToUsers Regular 32.6 s +20.68 MiB 20230605095810 - EnsureDefaultOrganization Regular 1.6 s +0.00 B 20230612072807 - AddVacuumTypeToAutovacuumStatus Regular 1.5 s +0.00 B 20230516123202 - CreateRoutingTableForCiBuilds Post deploy 1.5 s +0.00 B 20230516192543 - AddIssuesWorkItemTypeIdProjectIdIndex Post deploy 3.2 s +0.00 B 20230517005523 - EnsureBackfillBigintIdIsCompleted Post deploy 1.4 s +0.00 B 20230518005523 - AddConcurrentIndexForCiPipelineVariablesBigintId Post deploy 1.7 s +0.00 B 20230522073230 - AddNotNullConstraintToPersonalAccessTokensExpiresAt Post deploy 1.8 s +0.00 B 20230524120241 - AddTempIndexToPackagesOnProjectIdWhenNpmAndNotPendingDestruction Post deploy 9.3 s +42.74 MiB 20230524135543 - ReplaceCiBuildPendingStatesForeignKey Post deploy 2.5 s +8.00 KiB 20230524135555 - ReplaceCiBuildTraceChunksForeignKey Post deploy 2.2 s +0.00 B 20230524135607 - ReplaceCiUnitTestFailuresForeignKey Post deploy 2.3 s +0.00 B 20230524135620 - ReplaceCiSourcesPipelinesForeignKey Post deploy 2.2 s +0.00 B 20230524135632 - ReplaceCiResourcesForeignKey Post deploy 2.2 s +0.00 B 20230524135645 - ReplaceCiBuildReportResultsForeignKey Post deploy 2.2 s +0.00 B 20230524135658 - ReplaceCiBuildNeedsForeignKey Post deploy 2.2 s +0.00 B 20230524135711 - ReplaceCiBuildsRunnerSessionForeignKey Post deploy 2.2 s +0.00 B 20230524135724 - ReplaceCiPendingBuildsForeignKey Post deploy 2.2 s +0.00 B 20230524135737 - ReplaceCiBuildTraceMetadataForeignKey Post deploy 2.3 s +0.00 B 20230524135750 - ReplaceCiJobArtifactsForeignKey Post deploy 1.4 s +0.00 B 20230524135803 - ReplaceCiRunningBuildsForeignKey Post deploy 1.4 s +0.00 B 20230524135815 - ReplaceCiJobVariablesForeignKey Post deploy 1.4 s +0.00 B 20230524135828 - ReplacePCiBuildsMetadataForeignKey Post deploy 1.4 s +0.00 B 20230524135840 - ReplacePCiRunnerMachineBuildsForeignKey Post deploy 1.4 s +0.00 B 20230524201454 - QueueMarkDuplicateNpmPackagesForDestruction Post deploy 2.0 s +0.00 B 20230530140456 - ValidateFkCiBuildPendingStatesPCiBuilds Post deploy 1.6 s +0.00 B 20230530140509 - ValidateFkCiBuildTraceChunksPCiBuilds Post deploy 1.6 s +0.00 B 20230530140521 - ValidateFkCiUnitTestFailuresPCiBuilds Post deploy 1.6 s +0.00 B 20230530140534 - ValidateFkCiSourcesPipelinesPCiBuilds Post deploy 1.6 s +0.00 B 20230530140546 - ValidateFkCiResourcesPCiBuilds Post deploy 1.6 s +0.00 B 20230530140558 - ValidateFkCiBuildReportResultsPCiBuilds Post deploy 1.6 s +0.00 B 20230530140611 - ValidateFkCiBuildNeedsPCiBuilds Post deploy 1.6 s +0.00 B 20230530140623 - ValidateFkCiBuildsRunnerSessionPCiBuilds Post deploy 1.6 s +0.00 B 20230530140634 - ValidateFkCiPendingBuildsPCiBuilds Post deploy 1.6 s +0.00 B 20230530140646 - ValidateFkCiBuildTraceMetadataPCiBuilds Post deploy 1.6 s +0.00 B 20230531165731 - DropIndexIssuesOnWorkItemTypeId Post deploy 3.3 s -1.90 GiB 20230602131429 - ChangeNotifiedOfOwnActivityDefault Post deploy 1.6 s +0.00 B 20230605085936 - AddNewIndexToVsaIssueStageEvents Post deploy 11.3 s +0.00 B 20230605085957 - AddNewIndexToVsaMrStageEvents Post deploy 11.3 s +8.00 KiB 20230605093005 - AddIndexForSbomOccurrencesOnProjectIdSourceId Post deploy 18.1 s +314.13 MiB 20230605192000 - DropTmpIndexOauthAccessTokensOnIdWhereExpiresInNull Post deploy 2.0 s -47.72 MiB 20230606183327 - AddIndexUserDetailsOnEnterpriseGroupId Post deploy 10.4 s +187.13 MiB 20230606193037 - CreateIndexAlertManagementAlertsOnCreatedAtProjectIdWithIssue Post deploy 72.6 s +928.00 KiB 20230607093222 - RemoveWebauthnRegistrationsU2fRegistrationIdColumn Post deploy 1.5 s -1.16 MiB 20230607165632 - RemoveFkOnProjectIdOnProjectWikiRepositoryStates Post deploy 1.8 s +0.00 B 20230607165718 - DropProjectWikiRepositoryStates Post deploy 1.5 s -56.00 KiB 20230608071301 - RequeueCleanupPersonalAccessTokensWithNilExpiresAt Post deploy 2.0 s +0.00 B 20230608231452 - CleanupBigintConversionForTodosForGitlabCom Post deploy 1.6 s +0.00 B 20230608232452 - CleanupBigintConversionForSystemNoteMetadataForGitlabCom Post deploy 1.6 s +0.00 B 20230608233452 - CleanupBigintConversionForEpicUserMentionsForGitlabCom Post deploy 1.6 s +0.00 B 20230608234452 - CleanupBigintConversionForSuggestionsForGitlabCom Post deploy 1.6 s +0.00 B 20230608235452 - CleanupBigintConversionForIssueUserMentionsForGitlabCom Post deploy 1.6 s +0.00 B 20230609000452 - CleanupBigintConversionForNoteDiffFilesForGitlabCom Post deploy 1.6 s +0.00 B 20230609001452 - CleanupBigintConversionForSnippetUserMentionsForGitlabCom Post deploy 1.6 s +0.00 B 20230609002452 - CleanupBigintConversionForDesignUserMentionsForGitlabCom Post deploy 1.6 s +0.00 B 20230609003452 - CleanupBigintConversionForVulnerabilityUserMentionsForGitlabCom Post deploy 1.6 s +0.00 B 20230609004452 - CleanupBigintConversionForCommitUserMentionsForGitlabCom Post deploy 1.6 s +0.00 B 20230609005452 - CleanupBigintConversionForMergeRequestUserMentionsForGitlabCom Post deploy 1.6 s +0.00 B 20230609010452 - CleanupBigintConversionForTimelogsForGitlabCom Post deploy 1.6 s +0.00 B 20230609011452 - CleanupBigintConversionForAwardEmojiForGitlabCom Post deploy 1.6 s +0.00 B Clone details
Clone ID Clone Created At Clone Data Timestamp Expected Removal Time database-testing-2023598-10330914-main
2023-06-14T14:01:33Z 2023-06-08T18:15:49Z 2023-06-15 02:12:43 +0000 database-testing-2023598-10330914-ci
2023-06-14T14:01:34Z 2023-06-13T14:01:16Z 2023-06-15 02:12:43 +0000 Database migrations (on the ci database)
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 20230612075608 - ReplaceCiJobArtifactsForeignKeyV2 Post deploy 3.0 s +8.00 KiB 20230612083337 - ReplaceCiRunningBuildsForeignKeyV2 Post deploy 2.9 s +0.00 B 20230612083655 - ReplaceCiJobVariablesForeignKeyV2 Post deploy 3.0 s +8.00 KiB 20230612083810 - ReplacePCiBuildsMetadataForeignKeyV2 Post deploy 4.1 s +0.00 B 20230612084013 - ReplacePCiRunnerMachineBuildsForeignKeyV2 Post deploy 3.3 s +0.00 B Runtime Histogram for all migrations
Query Runtime Count 0 seconds - 0.01 seconds 0 0.01 seconds - 0.1 seconds 79 0.1 seconds - 1 second 0 1 second - 5 seconds 0 5 seconds - 15 seconds 0 15 seconds - 5 minutes 0 5 minutes + 0 Migration: 20230612075608 - ReplaceCiJobArtifactsForeignKeyV2
- Type: Post deploy
- Duration: 3.0 s
- Database size change: +8.00 KiB
Calls Total Time Max Time Mean Time Rows Query 1 5.8 ms 5.8 ms 5.8 ms 0 ALTER TABLE ci_job_artifacts ADD CONSTRAINT temp_fk_rails_c5137cb2c1_p FOREIGN KEY (partition_id, job_id) REFERENCES p_ci_builds (partition_id, id) ON
UPDATE CASCADE ON DELETE CASCADE NOT VALID1 3.4 ms 3.4 ms 3.4 ms 0 SELECT "postgres_autovacuum_activity".*
FROM "postgres_autovacuum_activity" WHERE "postgres_autovacuum_activity"."wraparound_prevention" = $1 AND (schema = current_schema()) AND "postgres_autovacuum_activity"."table" IN ($2, $3)1 2.0 ms 2.0 ms 2.0 ms 1 INSERT INTO "postgres_async_foreign_key_validations" ("created_at", "updated_at", "name", "table_name") VALUES ($1, $2, $3, $4) RETURNING "id"
1 1.4 ms 1.4 ms 1.4 ms 1 SELECT $1 AS one
FROM "postgres_foreign_keys" WHERE "postgres_foreign_keys"."constrained_table_name" = $2 AND "postgres_foreign_keys"."name" = $3
LIMIT $41 0.5 ms 0.5 ms 0.5 ms 0 LOCK TABLE p_ci_builds, ci_job_artifacts IN SHARE ROW EXCLUSIVE MODE
2 0.5 ms 0.2 ms 0.2 ms 0 SELECT "postgres_partitioned_tables".*
FROM "postgres_partitioned_tables" WHERE (identifier = concat(current_schema(), $1, $2))
LIMIT $31 0.0 ms 0.0 ms 0.0 ms 0 SELECT "postgres_async_foreign_key_validations".*
FROM "postgres_async_foreign_key_validations" WHERE "postgres_async_foreign_key_validations"."constraint_type" = $1 AND "postgres_async_foreign_key_validations"."name" = $2 AND "postgres_async_foreign_key_validations"."table_name" = $3
LIMIT $41 0.0 ms 0.0 ms 0.0 ms 0 SELECT $1 AS one
FROM "postgres_async_foreign_key_validations" WHERE "postgres_async_foreign_key_validations"."name" = $2 AND "postgres_async_foreign_key_validations"."table_name" = $3
LIMIT $41 0.0 ms 0.0 ms 0.0 ms 0 SELECT $1 AS one
FROM "postgres_foreign_keys" WHERE "postgres_foreign_keys"."constrained_table_name" = $2 AND "postgres_foreign_keys"."referenced_table_name" = $3 AND "postgres_foreign_keys"."name" = $4 AND "postgres_foreign_keys"."constrained_columns" = $5 AND "postgres_foreign_keys"."referenced_columns" = $6 AND "postgres_foreign_keys"."on_delete_action" = $7
LIMIT $82 0.0 ms 0.0 ms 0.0 ms 2 SELECT pg_backend_pid()
Histogram for ReplaceCiJobArtifactsForeignKeyV2
Query Runtime Count 0 seconds - 0.01 seconds 0 0.01 seconds - 0.1 seconds 12 0.1 seconds - 1 second 0 1 second - 5 seconds 0 5 seconds - 15 seconds 0 15 seconds - 5 minutes 0 5 minutes + 0 Migration: 20230612083337 - ReplaceCiRunningBuildsForeignKeyV2
- Type: Post deploy
- Duration: 2.9 s
- Database size change: +0.00 B
Calls Total Time Max Time Mean Time Rows Query 1 3.0 ms 3.0 ms 3.0 ms 0 ALTER TABLE ci_running_builds ADD CONSTRAINT temp_fk_rails_da45cfa165_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds (partition_id, id) ON
UPDATE CASCADE ON DELETE CASCADE NOT VALID1 1.4 ms 1.4 ms 1.4 ms 1 SELECT $1 AS one
FROM "postgres_foreign_keys" WHERE "postgres_foreign_keys"."constrained_table_name" = $2 AND "postgres_foreign_keys"."name" = $3
LIMIT $41 0.9 ms 0.9 ms 0.9 ms 0 SELECT "postgres_autovacuum_activity".*
FROM "postgres_autovacuum_activity" WHERE "postgres_autovacuum_activity"."wraparound_prevention" = $1 AND (schema = current_schema()) AND "postgres_autovacuum_activity"."table" IN ($2, $3)1 0.5 ms 0.5 ms 0.5 ms 0 LOCK TABLE p_ci_builds, ci_running_builds IN SHARE ROW EXCLUSIVE MODE
2 0.5 ms 0.2 ms 0.2 ms 0 SELECT "postgres_partitioned_tables".*
FROM "postgres_partitioned_tables" WHERE (identifier = concat(current_schema(), $1, $2))
LIMIT $31 0.1 ms 0.1 ms 0.1 ms 1 INSERT INTO "postgres_async_foreign_key_validations" ("created_at", "updated_at", "name", "table_name") VALUES ($1, $2, $3, $4) RETURNING "id"
1 0.0 ms 0.0 ms 0.0 ms 0 SELECT $1 AS one
FROM "postgres_async_foreign_key_validations" WHERE "postgres_async_foreign_key_validations"."name" = $2 AND "postgres_async_foreign_key_validations"."table_name" = $3
LIMIT $41 0.0 ms 0.0 ms 0.0 ms 0 SELECT $1 AS one
FROM "postgres_foreign_keys" WHERE "postgres_foreign_keys"."constrained_table_name" = $2 AND "postgres_foreign_keys"."referenced_table_name" = $3 AND "postgres_foreign_keys"."name" = $4 AND "postgres_foreign_keys"."constrained_columns" = $5 AND "postgres_foreign_keys"."referenced_columns" = $6 AND "postgres_foreign_keys"."on_delete_action" = $7
LIMIT $81 0.0 ms 0.0 ms 0.0 ms 0 SELECT "postgres_async_foreign_key_validations".*
FROM "postgres_async_foreign_key_validations" WHERE "postgres_async_foreign_key_validations"."constraint_type" = $1 AND "postgres_async_foreign_key_validations"."name" = $2 AND "postgres_async_foreign_key_validations"."table_name" = $3
LIMIT $42 0.0 ms 0.0 ms 0.0 ms 2 SELECT pg_backend_pid()
Histogram for ReplaceCiRunningBuildsForeignKeyV2
Query Runtime Count 0 seconds - 0.01 seconds 0 0.01 seconds - 0.1 seconds 12 0.1 seconds - 1 second 0 1 second - 5 seconds 0 5 seconds - 15 seconds 0 15 seconds - 5 minutes 0 5 minutes + 0 Migration: 20230612083655 - ReplaceCiJobVariablesForeignKeyV2
- Type: Post deploy
- Duration: 3.0 s
- Database size change: +8.00 KiB
Calls Total Time Max Time Mean Time Rows Query 1 2.8 ms 2.8 ms 2.8 ms 0 ALTER TABLE ci_job_variables ADD CONSTRAINT temp_fk_rails_fbf3b34792_p FOREIGN KEY (partition_id, job_id) REFERENCES p_ci_builds (partition_id, id) ON
UPDATE CASCADE ON DELETE CASCADE NOT VALID1 1.4 ms 1.4 ms 1.4 ms 1 SELECT $1 AS one
FROM "postgres_foreign_keys" WHERE "postgres_foreign_keys"."constrained_table_name" = $2 AND "postgres_foreign_keys"."name" = $3
LIMIT $41 0.9 ms 0.9 ms 0.9 ms 0 SELECT "postgres_autovacuum_activity".*
FROM "postgres_autovacuum_activity" WHERE "postgres_autovacuum_activity"."wraparound_prevention" = $1 AND (schema = current_schema()) AND "postgres_autovacuum_activity"."table" IN ($2, $3)1 0.3 ms 0.3 ms 0.3 ms 0 LOCK TABLE p_ci_builds, ci_job_variables IN SHARE ROW EXCLUSIVE MODE
2 0.5 ms 0.2 ms 0.2 ms 0 SELECT "postgres_partitioned_tables".*
FROM "postgres_partitioned_tables" WHERE (identifier = concat(current_schema(), $1, $2))
LIMIT $31 0.1 ms 0.1 ms 0.1 ms 1 INSERT INTO "postgres_async_foreign_key_validations" ("created_at", "updated_at", "name", "table_name") VALUES ($1, $2, $3, $4) RETURNING "id"
1 0.0 ms 0.0 ms 0.0 ms 0 SELECT $1 AS one
FROM "postgres_async_foreign_key_validations" WHERE "postgres_async_foreign_key_validations"."name" = $2 AND "postgres_async_foreign_key_validations"."table_name" = $3
LIMIT $41 0.0 ms 0.0 ms 0.0 ms 0 SELECT "postgres_async_foreign_key_validations".*
FROM "postgres_async_foreign_key_validations" WHERE "postgres_async_foreign_key_validations"."constraint_type" = $1 AND "postgres_async_foreign_key_validations"."name" = $2 AND "postgres_async_foreign_key_validations"."table_name" = $3
LIMIT $41 0.0 ms 0.0 ms 0.0 ms 0 SELECT $1 AS one
FROM "postgres_foreign_keys" WHERE "postgres_foreign_keys"."constrained_table_name" = $2 AND "postgres_foreign_keys"."referenced_table_name" = $3 AND "postgres_foreign_keys"."name" = $4 AND "postgres_foreign_keys"."constrained_columns" = $5 AND "postgres_foreign_keys"."referenced_columns" = $6 AND "postgres_foreign_keys"."on_delete_action" = $7
LIMIT $82 0.0 ms 0.0 ms 0.0 ms 2 SELECT pg_backend_pid()
Histogram for ReplaceCiJobVariablesForeignKeyV2
Query Runtime Count 0 seconds - 0.01 seconds 0 0.01 seconds - 0.1 seconds 12 0.1 seconds - 1 second 0 1 second - 5 seconds 0 5 seconds - 15 seconds 0 15 seconds - 5 minutes 0 5 minutes + 0 Migration: 20230612083810 - ReplacePCiBuildsMetadataForeignKeyV2
- Type: Post deploy
- Duration: 4.1 s
- Database size change: +0.00 B
Calls Total Time Max Time Mean Time Rows Query 2 9.8 ms 5.2 ms 4.9 ms 4 SELECT "postgres_partitions".*
FROM "postgres_partitions" WHERE "postgres_partitions"."parent_identifier" = $1
ORDER BY "postgres_partitions"."name" ASC1 2.2 ms 2.2 ms 2.2 ms 0 ALTER TABLE gitlab_partitions_dynamic.ci_builds_metadata_101 ADD CONSTRAINT temp_fk_e20479742e_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds (partition_id, id) ON
UPDATE CASCADE ON DELETE CASCADE NOT VALID1 2.0 ms 2.0 ms 2.0 ms 0 ALTER TABLE public.ci_builds_metadata ADD CONSTRAINT temp_fk_e20479742e_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds (partition_id, id) ON
UPDATE CASCADE ON DELETE CASCADE NOT VALID2 3.0 ms 1.6 ms 1.5 ms 2 SELECT $1 AS one
FROM "postgres_foreign_keys" WHERE "postgres_foreign_keys"."constrained_table_identifier" = $2 AND "postgres_foreign_keys"."name" = $3
LIMIT $41 0.9 ms 0.9 ms 0.9 ms 0 SELECT "postgres_autovacuum_activity".*
FROM "postgres_autovacuum_activity" WHERE "postgres_autovacuum_activity"."wraparound_prevention" = $1 AND (schema = current_schema()) AND "postgres_autovacuum_activity"."table" IN ($2, $3)6 1.5 ms 0.3 ms 0.2 ms 2 SELECT "postgres_partitioned_tables".*
FROM "postgres_partitioned_tables" WHERE (identifier = concat(current_schema(), $1, $2))
LIMIT $31 0.2 ms 0.2 ms 0.2 ms 0 LOCK TABLE p_ci_builds, gitlab_partitions_dynamic.ci_builds_metadata_101 IN SHARE ROW EXCLUSIVE MODE
1 0.2 ms 0.2 ms 0.2 ms 0 LOCK TABLE p_ci_builds, public.ci_builds_metadata IN SHARE ROW EXCLUSIVE MODE
2 0.2 ms 0.1 ms 0.1 ms 0 SELECT $1 AS one
FROM "postgres_foreign_keys" WHERE "postgres_foreign_keys"."constrained_table_identifier" = $2 AND "postgres_foreign_keys"."referenced_table_name" = $3 AND "postgres_foreign_keys"."name" = $4 AND "postgres_foreign_keys"."constrained_columns" = $5 AND "postgres_foreign_keys"."referenced_columns" = $6 AND "postgres_foreign_keys"."on_delete_action" = $7
LIMIT $82 0.1 ms 0.1 ms 0.1 ms 2 INSERT INTO "postgres_async_foreign_key_validations" ("created_at", "updated_at", "name", "table_name") VALUES ($1, $2, $3, $4) RETURNING "id"
2 0.0 ms 0.0 ms 0.0 ms 0 SELECT $1 AS one
FROM "postgres_async_foreign_key_validations" WHERE "postgres_async_foreign_key_validations"."name" = $2 AND "postgres_async_foreign_key_validations"."table_name" = $3
LIMIT $41 0.0 ms 0.0 ms 0.0 ms 0 SELECT $1 AS one
FROM "postgres_foreign_keys" WHERE "postgres_foreign_keys"."constrained_table_name" = $2 AND "postgres_foreign_keys"."referenced_table_name" = $3 AND "postgres_foreign_keys"."name" = $4 AND "postgres_foreign_keys"."constrained_columns" = $5 AND "postgres_foreign_keys"."referenced_columns" = $6 AND "postgres_foreign_keys"."on_delete_action" = $7
LIMIT $82 0.0 ms 0.0 ms 0.0 ms 0 SELECT "postgres_async_foreign_key_validations".*
FROM "postgres_async_foreign_key_validations" WHERE "postgres_async_foreign_key_validations"."constraint_type" = $1 AND "postgres_async_foreign_key_validations"."name" = $2 AND "postgres_async_foreign_key_validations"."table_name" = $3
LIMIT $42 0.0 ms 0.0 ms 0.0 ms 2 SELECT pg_backend_pid()
Histogram for ReplacePCiBuildsMetadataForeignKeyV2
Query Runtime Count 0 seconds - 0.01 seconds 0 0.01 seconds - 0.1 seconds 26 0.1 seconds - 1 second 0 1 second - 5 seconds 0 5 seconds - 15 seconds 0 15 seconds - 5 minutes 0 5 minutes + 0 Migration: 20230612084013 - ReplacePCiRunnerMachineBuildsForeignKeyV2
- Type: Post deploy
- Duration: 3.3 s
- Database size change: +0.00 B
Calls Total Time Max Time Mean Time Rows Query 2 8.3 ms 4.2 ms 4.2 ms 2 SELECT "postgres_partitions".*
FROM "postgres_partitions" WHERE "postgres_partitions"."parent_identifier" = $1
ORDER BY "postgres_partitions"."name" ASC1 1.9 ms 1.9 ms 1.9 ms 0 ALTER TABLE gitlab_partitions_dynamic.ci_runner_machine_builds_100 ADD CONSTRAINT temp_fk_bb490f12fe_p FOREIGN KEY (partition_id, build_id) REFERENCES p_ci_builds (partition_id, id) ON
UPDATE CASCADE ON DELETE CASCADE NOT VALID1 1.6 ms 1.6 ms 1.6 ms 1 SELECT $1 AS one
FROM "postgres_foreign_keys" WHERE "postgres_foreign_keys"."constrained_table_identifier" = $2 AND "postgres_foreign_keys"."name" = $3
LIMIT $41 0.6 ms 0.6 ms 0.6 ms 0 SELECT "postgres_autovacuum_activity".*
FROM "postgres_autovacuum_activity" WHERE "postgres_autovacuum_activity"."wraparound_prevention" = $1 AND (schema = current_schema()) AND "postgres_autovacuum_activity"."table" = $24 0.9 ms 0.3 ms 0.2 ms 2 SELECT "postgres_partitioned_tables".*
FROM "postgres_partitioned_tables" WHERE (identifier = concat(current_schema(), $1, $2))
LIMIT $31 0.2 ms 0.2 ms 0.2 ms 0 LOCK TABLE p_ci_builds, gitlab_partitions_dynamic.ci_runner_machine_builds_100 IN SHARE ROW EXCLUSIVE MODE
1 0.1 ms 0.1 ms 0.1 ms 1 INSERT INTO "postgres_async_foreign_key_validations" ("created_at", "updated_at", "name", "table_name") VALUES ($1, $2, $3, $4) RETURNING "id"
1 0.0 ms 0.0 ms 0.0 ms 0 SELECT $1 AS one
FROM "postgres_foreign_keys" WHERE "postgres_foreign_keys"."constrained_table_identifier" = $2 AND "postgres_foreign_keys"."referenced_table_name" = $3 AND "postgres_foreign_keys"."name" = $4 AND "postgres_foreign_keys"."constrained_columns" = $5 AND "postgres_foreign_keys"."referenced_columns" = $6 AND "postgres_foreign_keys"."on_delete_action" = $7
LIMIT $81 0.0 ms 0.0 ms 0.0 ms 0 SELECT $1 AS one
FROM "postgres_async_foreign_key_validations" WHERE "postgres_async_foreign_key_validations"."name" = $2 AND "postgres_async_foreign_key_validations"."table_name" = $3
LIMIT $41 0.0 ms 0.0 ms 0.0 ms 0 SELECT "postgres_async_foreign_key_validations".*
FROM "postgres_async_foreign_key_validations" WHERE "postgres_async_foreign_key_validations"."constraint_type" = $1 AND "postgres_async_foreign_key_validations"."name" = $2 AND "postgres_async_foreign_key_validations"."table_name" = $3
LIMIT $41 0.0 ms 0.0 ms 0.0 ms 0 SELECT $1 AS one
FROM "postgres_foreign_keys" WHERE "postgres_foreign_keys"."constrained_table_name" = $2 AND "postgres_foreign_keys"."referenced_table_name" = $3 AND "postgres_foreign_keys"."name" = $4 AND "postgres_foreign_keys"."constrained_columns" = $5 AND "postgres_foreign_keys"."referenced_columns" = $6 AND "postgres_foreign_keys"."on_delete_action" = $7
LIMIT $82 0.0 ms 0.0 ms 0.0 ms 2 SELECT pg_backend_pid()
Histogram for ReplacePCiRunnerMachineBuildsForeignKeyV2
Query Runtime Count 0 seconds - 0.01 seconds 0 0.01 seconds - 0.1 seconds 17 0.1 seconds - 1 second 0 1 second - 5 seconds 0 5 seconds - 15 seconds 0 15 seconds - 5 minutes 0 5 minutes + 0 Other information
Other migrations pending on GitLab.com
Migration Type Total runtime Result DB size change 20230522180913 - CreateAbuseEvents Regular 2.7 s +48.00 KiB 20230522181134 - AddForeignKeyConstraintsToAbuseEvents Regular 2.7 s +16.00 KiB 20230605095810 - EnsureDefaultOrganization Regular 2.0 s +0.00 B 20230612072807 - AddVacuumTypeToAutovacuumStatus Regular 2.0 s +0.00 B 20230524120241 - AddTempIndexToPackagesOnProjectIdWhenNpmAndNotPendingDestruction Post deploy 3.2 s +8.00 KiB 20230524201454 - QueueMarkDuplicateNpmPackagesForDestruction Post deploy 2.0 s +0.00 B 20230530140456 - ValidateFkCiBuildPendingStatesPCiBuilds Post deploy 2.2 s +0.00 B 20230530140509 - ValidateFkCiBuildTraceChunksPCiBuilds Post deploy 2.2 s +0.00 B 20230530140521 - ValidateFkCiUnitTestFailuresPCiBuilds Post deploy 2.2 s +0.00 B 20230530140534 - ValidateFkCiSourcesPipelinesPCiBuilds Post deploy 2.2 s +0.00 B 20230530140546 - ValidateFkCiResourcesPCiBuilds Post deploy 2.2 s +0.00 B 20230530140558 - ValidateFkCiBuildReportResultsPCiBuilds Post deploy 2.2 s +0.00 B 20230530140611 - ValidateFkCiBuildNeedsPCiBuilds Post deploy 2.2 s +0.00 B 20230530140623 - ValidateFkCiBuildsRunnerSessionPCiBuilds Post deploy 2.2 s +0.00 B 20230530140634 - ValidateFkCiPendingBuildsPCiBuilds Post deploy 2.2 s +0.00 B 20230530140646 - ValidateFkCiBuildTraceMetadataPCiBuilds Post deploy 2.2 s +0.00 B 20230602131429 - ChangeNotifiedOfOwnActivityDefault Post deploy 2.2 s +0.00 B 20230607093222 - RemoveWebauthnRegistrationsU2fRegistrationIdColumn Post deploy 2.1 s -8.00 KiB 20230607165632 - RemoveFkOnProjectIdOnProjectWikiRepositoryStates Post deploy 2.4 s +0.00 B 20230607165718 - DropProjectWikiRepositoryStates Post deploy 2.1 s -56.00 KiB 20230608071301 - RequeueCleanupPersonalAccessTokensWithNilExpiresAt Post deploy 2.0 s +0.00 B 20230608231452 - CleanupBigintConversionForTodosForGitlabCom Post deploy 2.2 s +0.00 B 20230608232452 - CleanupBigintConversionForSystemNoteMetadataForGitlabCom Post deploy 2.2 s +0.00 B 20230608233452 - CleanupBigintConversionForEpicUserMentionsForGitlabCom Post deploy 2.2 s +0.00 B 20230608234452 - CleanupBigintConversionForSuggestionsForGitlabCom Post deploy 2.2 s +0.00 B 20230608235452 - CleanupBigintConversionForIssueUserMentionsForGitlabCom Post deploy 2.2 s +0.00 B 20230609000452 - CleanupBigintConversionForNoteDiffFilesForGitlabCom Post deploy 2.2 s +0.00 B 20230609001452 - CleanupBigintConversionForSnippetUserMentionsForGitlabCom Post deploy 2.2 s +0.00 B 20230609002452 - CleanupBigintConversionForDesignUserMentionsForGitlabCom Post deploy 2.2 s +0.00 B 20230609003452 - CleanupBigintConversionForVulnerabilityUserMentionsForGitlabCom Post deploy 2.2 s +0.00 B 20230609004452 - CleanupBigintConversionForCommitUserMentionsForGitlabCom Post deploy 2.2 s +0.00 B 20230609005452 - CleanupBigintConversionForMergeRequestUserMentionsForGitlabCom Post deploy 2.2 s +0.00 B 20230609010452 - CleanupBigintConversionForTimelogsForGitlabCom Post deploy 2.3 s +0.00 B 20230609011452 - CleanupBigintConversionForAwardEmojiForGitlabCom Post deploy 2.2 s +0.00 B Clone details
Clone ID Clone Created At Clone Data Timestamp Expected Removal Time database-testing-2023598-10330914-main
2023-06-14T14:01:33Z 2023-06-08T18:15:49Z 2023-06-15 02:12:43 +0000 database-testing-2023598-10330914-ci
2023-06-14T14:01:34Z 2023-06-13T14:01:16Z 2023-06-15 02:12:43 +0000
Brought to you by gitlab-org/database-team/gitlab-com-database-testing. Epic
- A deleted user
added database-testing-automation label
removed review request for @sabrams
requested review from @sabrams
marked the checklist item I have evaluated the MR acceptance checklist for this MR. as completed
Thanks @mbobin! Everything LGTM, I'll set MWPS!
enabled an automatic merge when the pipeline for 1adcebd6 succeeds
Hello @mbobin
The database team is looking for ways to improve the database review process and we would love your help!
If you'd be open to someone on the database team reaching out to you for a chat, or if you'd like to leave some feedback asynchronously, just post a reply to this comment mentioning:
@gitlab-org/database-team
And someone will be by shortly!
Thanks for your help!
This message was generated automatically. You're welcome to improve it.
mentioned in commit dfabd56d
added workflowstaging-canary label
added workflowcanary label and removed workflowstaging-canary label
added workflowstaging label and removed workflowcanary label
added workflowproduction label and removed workflowstaging label
added workflowpost-deploy-db-production label and removed workflowproduction label
mentioned in merge request !123805 (merged)
mentioned in issue #414396 (closed)
mentioned in merge request !123811 (merged)
added Data WarehouseNot Impacted label and removed Data WarehouseImpact Check label
added releasedcandidate label
mentioned in merge request kubitus-project/kubitus-installer!2224 (merged)
added releasedpublished label and removed releasedcandidate label
mentioned in merge request !145899 (merged)