Skip to content

Geo - Support filtering container repositories by keyword via GraphQL

What does this MR do and why?

Currently, for self-service replicables, we are unable to do any filtering on the Geo Replicable views.

This MR supports filtering container repositories registries by keyword (fuzzy_search) via GraphQL:

Registries Searchable attributes
Container Repositories Name

Database

Raw SQL and query plans

Using:

Geo::ContainerRepositoryRegistry.with_search('Gitlab')

Then:

https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/15038/commands/52251

SELECT
    container_repositories.id
FROM
    container_repositories
WHERE
    container_repositories.name ILIKE '%Gitlab%'
LIMIT 1000;

Query plan:

 Limit  (cost=115.99..2398.45 rows=1000 width=4) (actual time=8.490..35.365 rows=1000 loops=1)
   Buffers: shared hit=30 read=969 dirtied=143
   I/O Timings: read=22.071 write=0.000
   ->  Bitmap Heap Scan on public.container_repositories  (cost=115.99..25442.11 rows=11096 width=4) (actual time=8.488..35.188 rows=1000 loops=1)
         Buffers: shared hit=30 read=969 dirtied=143
         I/O Timings: read=22.071 write=0.000
         ->  Bitmap Index Scan using index_container_repository_on_name_trigram  (cost=0.00..113.22 rows=11096 width=0) (actual time=6.937..6.938 rows=9722 loops=1)
               Index Cond: ((container_repositories.name)::text ~~* '%Gitlab%'::text)
               Buffers: shared hit=30 read=46
               I/O Timings: read=1.945 write=0.000

Statistics:

Time: 40.283 ms  
  - planning: 4.596 ms  
  - execution: 35.687 ms  
    - I/O read: 22.071 ms  
    - I/O write: 0.000 ms  
  
Shared buffers:  
  - hits: 30 (~240.00 KiB) from the buffer pool  
  - reads: 969 (~7.60 MiB) from the OS file cache, including disk I/O  
  - dirtied: 143 (~1.10 MiB)  
  - writes: 0  

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 #364722 (closed) and #411770

Edited by Javiera Tapia

Merge request reports