Skip to content

Enable analyze for p_ci_builds_metadata

Tianwen Chen requested to merge 423135-ci_builds_metadata into master

What does this MR do and why?

See #423959 (comment 1588358939)

This is related to #423135 (closed). We have built the feature to run regular analyze on partitioned tables so that Postgresql can use the table information to execute a better query plan. And now we want to register Ci::BuildMetadata and schedule to run the analyze weekly.

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

  1. Open up Rails console and development logs:

    tail -f log/development.log
    rails c
  2. Enable feature flag

    Feature.enable(:database_analyze_on_partitioned_tables)
  3. Run sync_partitions

    ::Gitlab::Database::Partitioning.sync_partitions
  4. Check if you can see the following output from Rails console or development logs

    ANALYZE VERBOSE "p_ci_builds_metadata"

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #423135 (closed)

Edited by Tianwen Chen

Merge request reports