Skip to content

Avoid N+1 queries in epic reference

Jan Provaznik requested to merge n1_cross_ref into master

What does this MR do?

Optimizes epics reference method and avoids N+1 queries in epic's autocomplete.

Related to #331118 (closed)

DB group preload query:

SELECT "namespaces".* FROM "namespaces" WHERE "namespaces"."type" = 'Group' AND "namespaces"."id" IN (5754519, 7137538, 5032027, 2351283, 2750817, 2593421, 6104555, 2639717, 7983076, 6891292)

Index Scan using index_namespaces_on_type_and_id_partial on public.namespaces  (cost=0.43..21.58 rows=2 width=346) (actual time=26.439..103.688 rows=10 loops=1)
   Index Cond: (((namespaces.type)::text = 'Group'::text) AND (namespaces.id = ANY ('{5754519,7137538,5032027,2351283,2750817,2593421,6104555,2639717,7983076,6891292}'::integer[])))
   Buffers: shared hit=12 read=32
   I/O Timings: read=103.273 write=0.000

Screenshots (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.

  • 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
Edited by Jan Provaznik

Merge request reports

Loading