explain.depesz.com

PostgreSQL's explain analyze made readable

Result: g0gP

Settings
# exclusive inclusive rows x rows loops node
1. 0.003 206.878 ↓ 0.0 0 1

Delete on permissions_device p (cost=86,466.81..98,658.59 rows=1,543 width=44) (actual time=206.878..206.878 rows=0 loops=1)

2. 0.000 206.875 ↓ 0.0 0 1

Nested Loop (cost=86,466.81..98,658.59 rows=1,543 width=44) (actual time=206.875..206.875 rows=0 loops=1)

3. 0.005 206.875 ↓ 0.0 0 1

HashAggregate (cost=86,466.38..86,481.81 rows=1,543 width=42) (actual time=206.875..206.875 rows=0 loops=1)

  • Group Key: t.id
4. 0.599 206.870 ↓ 0.0 0 1

Hash Anti Join (cost=46,682.19..86,462.53 rows=1,543 width=42) (actual time=206.870..206.870 rows=0 loops=1)

  • Hash Cond: ((t.user_id = p_1.user_id) AND (t.device_id = p_1.device_id))
5. 170.068 170.068 ↑ 1.2 1,664 1

Seq Scan on permissions_device t (cost=0.00..39,609.03 rows=2,057 width=18) (actual time=23.168..170.068 rows=1,664 loops=1)

  • Filter: (NOT is_implicit)
  • Rows Removed by Filter: 2569439
6. 0.512 36.203 ↓ 1.5 1,664 1

Hash (cost=46,665.30..46,665.30 rows=1,126 width=40) (actual time=36.203..36.203 rows=1,664 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 133kB
7. 0.820 35.691 ↓ 1.5 1,664 1

Subquery Scan on p_1 (cost=46,642.78..46,665.30 rows=1,126 width=40) (actual time=34.387..35.691 rows=1,664 loops=1)

8. 4.087 34.871 ↓ 1.5 1,664 1

HashAggregate (cost=46,642.78..46,654.04 rows=1,126 width=8) (actual time=34.380..34.871 rows=1,664 loops=1)

  • Group Key: p_2.user_id, p_2.device_id
9. 30.784 30.784 ↑ 1.1 8,875 1

Seq Scan on permissions p_2 (cost=0.00..46,595.52 rows=9,452 width=8) (actual time=0.004..30.784 rows=8,875 loops=1)

10. 0.000 0.000 ↓ 0.0 0

Index Scan using permissions_device_pkey on permissions_device p (cost=0.43..7.88 rows=1 width=10) (never executed)

  • Index Cond: (id = t.id)