Skip to content

PoC for understanding uniqueness constraints across partitions

Description

For ci_builds we have a 1 unique index that prevent inserting jobs with duplicate tokens:

    "index_ci_builds_on_token_encrypted" UNIQUE, btree (token_encrypted) WHERE token_encrypted IS NOT NULL

We need to understand how these indexes would work with multiple partitions because we use the token to uniquely identify a job.

Unique constraints identified

table unique index need to be fix for partitioning
ci_builds index_ci_builds_on_token_encrypted
ci_builds_metadata index_ci_builds_metadata_on_build_id
ci_job_artifacts index_ci_job_artifacts_on_job_id_and_file_type
ci_pipeline_variables index_ci_pipeline_variables_on_pipeline_id_and_key
ci_stages index_ci_stages_on_pipeline_id_and_name

Objectives

Check if inserting resources scans all partitions and how it's affecting the performance.

Edited by Max Orefice