explain.depesz.com

PostgreSQL's explain analyze made readable

Result: npe9

Settings
# exclusive inclusive rows x rows loops node
1. 0.001 2,017.204 ↓ 0.0 0 1

Insert on tmp_user_role_entity_import_error (cost=5.33..1,761.79 rows=498 width=426) (actual time=2,017.204..2,017.204 rows=0 loops=1)

2. 1,871.950 2,017.203 ↓ 0.0 0 1

Nested Loop Anti Join (cost=5.33..1,761.79 rows=498 width=426) (actual time=2,017.203..2,017.203 rows=0 loops=1)

  • Join Filter: ((u.true_view_id)::text ~~* (ure.unit)::text)
  • Rows Removed by Join Filter: 2743726
3. 0.464 0.464 ↑ 1.0 501 1

Seq Scan on user_role_entity ure (cost=0.00..23.26 rows=501 width=14) (actual time=0.012..0.464 rows=501 loops=1)

  • Filter: ((unit IS NOT NULL) AND (session_id = $1))
4. 141.154 144.789 ↓ 45.6 5,477 501

Materialize (cost=5.33..842.34 rows=120 width=10) (actual time=0.000..0.289 rows=5,477 loops=501)

5. 0.988 3.635 ↓ 46.1 5,527 1

Nested Loop (cost=5.33..841.74 rows=120 width=10) (actual time=0.056..3.635 rows=5,527 loops=1)

6. 0.015 0.015 ↓ 14.0 28 1

Seq Scan on corporate_with_parent cwp (cost=0.00..4.26 rows=2 width=16) (actual time=0.003..0.015 rows=28 loops=1)

  • Filter: (parent_corporate_id = $10)
  • Rows Removed by Filter: 89
7. 2.240 2.632 ↓ 1.9 197 28

Bitmap Heap Scan on unit u (cost=5.33..417.72 rows=102 width=26) (actual time=0.021..0.094 rows=197 loops=28)

  • Recheck Cond: (corporate_id = cwp.corporate_id)
  • Filter: ($13 OR (SubPlan 1))
  • Heap Blocks: exact=1821
8. 0.392 0.392 ↓ 1.5 198 28

Bitmap Index Scan on idx_unit_corporate_id (cost=0.00..5.30 rows=136 width=0) (actual time=0.014..0.014 rows=198 loops=28)

  • Index Cond: (corporate_id = cwp.corporate_id)
9.          

SubPlan (for Bitmap Heap Scan)

10. 0.000 0.000 ↓ 0.0 0

Function Scan on unnest ua (cost=0.00..2.00 rows=1 width=0) (never executed)

  • Filter: ((((entity_code)::text = 'corporate'::text) AND (entity_id = u.corporate_id)) OR (((entity_code)::text = 'unit'::text) AND (entity_id = u.unit_id)))