BE - User Contribution Mapping - filter for placeholder users in the admin view

What does this MR do and why?

On the admin/users page we need to provide the option for admins to filter down the list of users to just placeholder users.

This MR prepares backend to process this request.

In case it is needed, I also added the ability to exclude placeholders from the list.

References

#521974 (closed)

Queries

Placeholders

SELECT * FROM users WHERE user_type = 15
Limit  (cost=0.56..96.72 rows=101 width=1503) (actual time=0.038..0.183 rows=101 loops=1)
   Buffers: shared hit=106
   I/O Timings: read=0.000 write=0.000
   ->  Index Scan using index_users_on_user_type_and_id on public.users  (cost=0.56..49760.19 rows=52266 width=1503) (actual time=0.037..0.176 rows=101 loops=1)
         Index Cond: (users.user_type = 15)
         Buffers: shared hit=106
         I/O Timings: read=0.000 write=0.000
Settings: random_page_cost = '1.5', seq_page_cost = '4', work_mem = '100MB', effective_cache_size = '472585MB', jit = 'off'

Time: 4.114 ms  
  - planning: 3.865 ms  
  - execution: 0.249 ms  
    - I/O read: 0.000 ms  
    - I/O write: 0.000 ms  
  
Shared buffers:  
  - hits: 106 (~848.00 KiB) from the buffer pool  
  - reads: 0 from the OS file cache, including disk I/O  
  - dirtied: 0  
  - writes: 0  

https://postgres.ai/console/gitlab/gitlab-production-main/sessions/37941/commands/116003

Without placeholders

SELECT * FROM users WHERE user_type != 15
 Seq Scan on public.users  (cost=0.00..4960631.70 rows=19287325 width=1499) (actual time=9.701..129276.114 rows=19356772 loops=1)
   Filter: (users.user_type <> 15)
   Rows Removed by Filter: 55641
   Buffers: shared hit=25187 read=1154529
   I/O Timings: read=114485.601 write=0.000
Settings: random_page_cost = '1.5', seq_page_cost = '4', work_mem = '100MB', effective_cache_size = '472585MB', jit = 'off'
Time: 2.169 min  
  - planning: 4.556 ms  
  - execution: 2.169 min  
    - I/O read: 1.908 min  
    - I/O write: 0.000 ms  
  
Shared buffers:  
  - hits: 25187 (~196.80 MiB) from the buffer pool  
  - reads: 1154529 (~8.80 GiB) from the OS file cache, including disk I/O  
  - dirtied: 0  
  - writes: 0  

https://postgres.ai/console/gitlab/gitlab-production-main/sessions/38067/commands/116532

How to set up and validate locally

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #526631 (closed)

Edited by Oiza Baiye

Merge request reports

Loading