Skip to content

Add non-partial index on namespace table

Brett Walker requested to merge bw-add-index-namespaces-type into master

What does this MR do and why?

As discussed here, add an index on namespaces table targeting type and id.

There currently exists a partial index on these columns

CREATE INDEX "index_namespaces_on_type_and_id_partial" ON "public"."namespaces" USING btree (
  "type" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST,
  "id" "pg_catalog"."int4_ops" ASC NULLS LAST
) WHERE type IS NOT NULL;

Since we're making all namespaces have a type, such as User or Group, we now need a full index rather than a partial. The partial will be removed in an upcoming MR.

Since namespaces is a large and highly trafficked table, we use the procedure detailed here: Create indexes asynchronously

Related to #342543 (closed)

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 Brett Walker

Merge request reports