explain.depesz.com

PostgreSQL's explain analyze made readable

Result: TCYp : RLS with ACL in table on pg@10.4, 100 users

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.087 21.664 ↑ 1.0 1 1

Aggregate (cost=1,203,889.00..1,203,889.01 rows=1 width=8) (actual time=21.664..21.664 rows=1 loops=1)

2. 21.350 21.577 ↑ 55.4 1,056 1

Seq Scan on items (cost=0.00..1,203,742.72 rows=58,512 width=0) (actual time=0.516..21.577 rows=1,056 loops=1)

  • Filter: (public OR (alternatives: SubPlan 1 or hashed SubPlan 2))
  • Rows Removed by Filter: 98,944
3.          

SubPlan (for Seq Scan)

4. 0.000 0.000 ↓ 0.0 0

Index Only Scan using permissions_index on permissions (cost=0.43..60.35 rows=4 width=0) (never executed)

  • Index Cond: ((item_id = items.id) AND (user_or_group_id = ANY ((regexp_split_to_array(current_setting('jwt.claims.role'::text), ','::text))::uuid[])))
  • Heap Fetches: 0
5. 0.171 0.227 ↓ 1.3 1,056 1

Bitmap Heap Scan on permissions permissions_1 (cost=50.33..1,227.84 rows=791 width=16) (actual time=0.068..0.227 rows=1,056 loops=1)

  • Recheck Cond: (user_or_group_id = ANY ((regexp_split_to_array(current_setting('jwt.claims.role'::text), ','::text))::uuid[]))
  • Heap Blocks: exact=9
6. 0.056 0.056 ↓ 1.3 1,056 1

Bitmap Index Scan on permissions_user_or_group_id_idx (cost=0.00..50.13 rows=791 width=0) (actual time=0.056..0.056 rows=1,056 loops=1)

  • Index Cond: (user_or_group_id = ANY ((regexp_split_to_array(current_setting('jwt.claims.role'::text), ','::text))::uuid[]))
Planning time : 0.210 ms
Execution time : 21.756 ms