Draft: Resolve "Add range partitioning helper"
What does this MR do and why?
In this merge request, we are adding support for range int partition.
partition_table_by_int_range(table_name, column_name, partition_size:, primary_key:)
# Creates a partitioned copy of an existing table, using a RANGE partitioning strategy on a int/bigint column.
# One partition is created per partition_size between 1 and MAX(column_name). Also installs a trigger on
# the original table to copy writes into the partitioned table. To copy over historic data from before creation
# of the partitioned table, use the `enqueue_partitioning_data_migration` helper in a post-deploy migration.
# Note: If the original table is empty the system creates 6 partitions in the new table.
#
# A copy of the original table is required as PG currently does not support partitioning existing tables.
#
# Example:
#
# partition_table_by_int_range :merge_request_diff_commits, :relative_order, partition_size: 500, primary_key: ['merge_request_diff_id', 'relative_order']
#
# Options are:
# :partition_size - a int specifying the partition size
# :primary_key - a array specifying the primary query of the new table
#
# Note: The system always adds a buffer of 6 partitions.
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
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.
Related to #423780 (closed)
Edited by Diogo Frazão