explain.depesz.com

PostgreSQL's explain analyze made readable

Result: A0jm : Test

Settings
# exclusive inclusive rows x rows loops node
1. 93.318 171,792.678 ↑ 1.0 14,385 1

Seq Scan on users (cost=47,222.30..4,644,210.28 rows=14,385 width=187) (actual time=4,270.810..171,792.678 rows=14,385 loops=1)

  • Filter: (NOT deleted)
  • Rows Removed by Filter: 10,193
2.          

CTE grp

3. 389.599 4,210.522 ↑ 1.2 12,282 1

GroupAggregate (cost=1,000.72..47,222.30 rows=14,192 width=50) (actual time=8.279..4,210.522 rows=12,282 loops=1)

  • Group Key: users_1.username
4. 2,583.316 3,820.923 ↓ 9.1 1,059,929 1

Gather Merge (cost=1,000.72..46,462.44 rows=116,492 width=44) (actual time=8.075..3,820.923 rows=1,059,929 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
5. 414.496 1,237.607 ↓ 7.3 353,310 3 / 3

Nested Loop (cost=0.69..32,016.35 rows=48,538 width=44) (actual time=0.196..1,237.607 rows=353,310 loops=3)

6. 12.756 12.756 ↑ 1.3 4,795 3 / 3

Parallel Index Scan using users_username_idx on users users_1 (cost=0.41..13,636.22 rows=5,994 width=392) (actual time=0.047..12.756 rows=4,795 loops=3)

  • Filter: (NOT deleted)
  • Rows Removed by Filter: 3,398
7. 810.355 810.355 ↓ 9.2 74 14,385 / 3

Index Only Scan using groups_code_unique_idx on groups (cost=0.28..2.99 rows=8 width=26) (actual time=0.003..0.169 rows=74 loops=14,385)

  • Index Cond: (code = ANY (users_1.groups))
  • Heap Fetches: 1,059,929
8.          

SubPlan (for Seq Scan)

9. 171,699.360 171,699.360 ↑ 71.0 1 14,385

CTE Scan on grp (cost=0.00..319.32 rows=71 width=32) (actual time=8.068..11.936 rows=1 loops=14,385)

  • Filter: (username = users.username)
  • Rows Removed by Filter: 12,281
Planning time : 1.030 ms
Execution time : 171,803.968 ms