Skip to content

Remove Flowdock integration records

Arturo Herrero requested to merge remove-flowdock-integration-records into master

Description

It's been a while since the last time that I wrote a migration, and several things have changed. This migration is based on a similar but old merge request !59769 (merged).

We are removing the Flowdock integration !102394 (merged) because the service has been shut down, as part of that, we remove the database records here.

Migration

$ rails db:migrate
main: == 20221129124240 RemoveFlowdockIntegrationRecords: migrating =================
main: == 20221129124240 RemoveFlowdockIntegrationRecords: migrated (0.0202s) ========
$ rails db:migrate:down:main VERSION=20221129124240
main: == 20221129124240 RemoveFlowdockIntegrationRecords: reverting =================
main: == 20221129124240 RemoveFlowdockIntegrationRecords: reverted (0.0006s) ========

Query

The query takes above the prescribed 1-second execution time.

DELETE FROM "integrations"
WHERE "integrations"."type_new" = 'Integrations::Flowdock'
Time: 8.427 s
  - planning: 3.533 ms
  - execution: 8.424 s

https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/13546/commands/47625

It looks like we have 8,784 records to be deleted from the database, but we have to run the deletion in batches of 1000:

DELETE FROM "integrations"
WHERE "integrations"."type_new" = 'Integrations::Flowdock'
AND "integrations"."id" BETWEEN 1 AND 1000
Time: 90.972 ms
  - planning: 1.337 ms
  - execution: 89.635 ms
    - I/O read: 88.681 ms
    - I/O write: 0.000 ms

Shared buffers:
  - hits: 3 (~24.00 KiB) from the buffer pool
  - reads: 62 (~496.00 KiB) from the OS file cache, including disk I/O
  - dirtied: 1 (~8.00 KiB)
  - writes: 0

https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/13608/commands/47755

Reference:

Related to #379197 (closed).

Edited by Arturo Herrero

Merge request reports