Skip to content

Docs: Check validity after async index creation

What does this MR do and why?

When checking that an asynchronously created index exists in production, we should also ensure that the index is not invalid. As shown below, \di does not indicate if an index is invalid, but \d does.

See https://www.postgresql.org/docs/12/sql-createindex.html#:~:text=The%20psql%20%5Cd%20command%20will%20report%20such%20an%20index%20as%20INVALID.

Related to https://gitlab.com/gitlab-org/product-intelligence/-/issues/471

Screenshots or screen recordings

Command:

\di index_security_ci_builds_on_name_and_id_parser_features

Output:

List of relations
 Schema |                          Name                           | Type  |    Owner     |   Table   
--------+---------------------------------------------------------+-------+--------------+-----------
 public | index_security_ci_builds_on_name_and_id_parser_features | index | joe_aladhani | ci_builds
(1 row)

Command:

\d index_security_ci_builds_on_name_and_id_parser_features

Output:

Index "public.index_security_ci_builds_on_name_and_id_parser_features"
        Column        |          Type          | Key? | Definition 
----------------------+------------------------+------+------------
 name                 | character varying(255) | yes  | name
 id_convert_to_bigint | bigint                 | yes  | id
btree, for table "public.ci_builds", predicate ((name::text = ANY (ARRAY['container_scanning'::character varying::text, 'dast'::character varying::text, 'dependency_scanning'::character varying::text, 'license_management'::character varying::text, 'sast'::character varying::text, 'secret_detection'::character varying::text, 'coverage_fuzzing'::character varying::text, 'license_scanning'::character varying::text])) AND type::text = 'Ci::Build'::text), invalid

MR acceptance checklist

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

Edited by Alishan Ladhani

Merge request reports