Create p_ci_finished_build_ch_sync_events table
Sequence | MR |
---|---|
1 |
Create p_ci_finished_build_ch_sync_events table (!131902 - merged) |
2 | Add service to sync builds to ClickHouse (!132010 - merged) |
What does this MR do and why?
This MR creates the EE-only p_ci_finished_build_ch_sync_events
table to implement the suggestion presented in the issue. The actual service to populate the table is being introduced in the follow-up !132010 (merged).
- Changelog: added
- EE: true
Part of #421200 (closed)
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
N/A
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.
Database query plans
next_partition_if query
https://console.postgres.ai/gitlab/gitlab-production-ci/sessions/22534/commands/72592
SELECT "p_ci_finished_build_ch_sync_events"."build_id", "p_ci_finished_build_ch_sync_events"."build_finished_at"
FROM "p_ci_finished_build_ch_sync_events"
WHERE "p_ci_finished_build_ch_sync_events"."partition" = 1
ORDER BY "p_ci_finished_build_ch_sync_events"."build_id" ASC
LIMIT 1
Limit (cost=0.42..0.45 rows=1 width=16) (actual time=0.044..0.045 rows=1 loops=1)
Buffers: shared hit=4
I/O Timings: read=0.000 write=0.000
-> Index Scan using p_ci_finished_build_ch_sync_events_1_pkey on gitlab_partitions_dynamic.p_ci_finished_build_ch_sync_events_1 p_ci_finished_build_ch_sync_events (cost=0.42..3687.08 rows=100000 width=16) (actual time=0.042..0.043 rows=1 loops=1)
Index Cond: (p_ci_finished_build_ch_sync_events.partition = 1)
Buffers: shared hit=4
I/O Timings: read=0.000 write=0.000
detach_partition_if query
https://console.postgres.ai/gitlab/gitlab-production-ci/sessions/22534/commands/72593
SELECT 1 AS one
FROM "p_ci_finished_build_ch_sync_events"
WHERE "p_ci_finished_build_ch_sync_events"."processed" = FALSE
AND "p_ci_finished_build_ch_sync_events"."partition" = 1
LIMIT 1
Limit (cost=0.42..0.45 rows=1 width=4) (actual time=0.076..0.078 rows=1 loops=1)
Buffers: shared hit=4
I/O Timings: read=0.000 write=0.000
-> Index Only Scan using p_ci_finished_build_ch_sync_events__partition_expr_build_id_idx on gitlab_partitions_dynamic.p_ci_finished_build_ch_sync_events_1 p_ci_finished_build_ch_sync_events (cost=0.42..2759.92 rows=100000 width=4) (actual time=0.075..0.075 rows=1 loops=1)
Index Cond: (p_ci_finished_build_ch_sync_events.partition = 1)
Heap Fetches: 0
Buffers: shared hit=4
I/O Timings: read=0.000 write=0.000
Edited by Pedro Pombeiro