Skip to content

WIP: Add root_ancestor to namespaces

Dmitry Gruzd requested to merge 218703-add-root-ancestor-to-namespaces into master

What does this MR do?

This is a first MR to resolve #218703 (closed). It introduces namespaces.root_ancestor_id to allow preloading to resolve the N+1 issue #218703 (closed)

Database changes

Approximate children namespaces count ~ 468,552
  Index Scan using index_namespaces_on_parent_id_and_id on public.namespaces  (cost=0.56..286415.36 rows=467018 width=329) (actual time=16.541..191346.899 rows=468552 loops=1)
   Index Cond: (namespaces.parent_id IS NOT NULL)
   Buffers: shared hit=308787 read=139401 dirtied=8052
   I/O Timings: read=185566.998
Approximate root namespaces count ~ 7,169,571
 Index Scan using index_namespaces_on_parent_id_and_id on public.namespaces  (cost=0.56..495437.75 rows=7166907 width=329) (actual time=1.416..74392.999 rows=7169571 loops=1)
   Index Cond: (namespaces.parent_id IS NULL)
   Buffers: shared hit=3718538 read=108800 dirtied=6578
   I/O Timings: read=60556.682

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Closes #218703 (closed)

Edited by Dmitry Gruzd

Merge request reports