Skip to content

Add foreign key from chat_name to service

What does this MR do?

Fixes the 500 error when visiting the profile/chat_names page. It does this by cleaning up orphaned data in the database and adding a foreign key to keep new orphaned rows.

The cleanup will remove 44,558 rows

Relates to #25230 (closed)

Database Lab explain:

 ModifyTable on public.chat_names  (cost=1485.12..4290.44 rows=22292 width=6) (actual time=455.944..455.944 rows=0 loops=1)
   Buffers: shared hit=89627 read=567 dirtied=563
   I/O Timings: read=120.063
   ->  Seq Scan on public.chat_names  (cost=1485.12..4290.44 rows=22292 width=6) (actual time=7.145..346.330 rows=44558 loops=1)
         Filter: (NOT (hashed SubPlan 1))
         Rows Removed by Filter: 0
         Buffers: shared read=566 dirtied=32
         I/O Timings: read=119.141
         SubPlan 1
           ->  Index Scan using index_services_on_type on public.services  (cost=0.56..1481.61 rows=1407 width=4) (actual time=4.506..4.506 rows=0 loops=1)
                 Index Cond: ((services.type)::text = 'chat'::text)
                 Buffers: shared read=4
                 I/O Timings: read=4.431
Time: 3.032 s
  - planning: 0.195 ms
  - execution: 3.032 s
    - I/O read: 120.063 ms
    - I/O write: 0.000 ms

Shared buffers:
  - hits: 89627 (~700.20 MiB) from the buffer pool
  - reads: 567 (~4.40 MiB) from the OS file cache, including disk I/O
  - dirtied: 563 (~4.40 MiB)
  - writes: 0

This update will remove 44558 rows

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Edited by 🤖 GitLab Bot 🤖

Merge request reports