explain.depesz.com

PostgreSQL's explain analyze made readable

Result: p49S

Settings
# exclusive inclusive rows x rows loops node
1. 194.876 194.876 ↑ 4.8 4 1

CTE Scan on users_and_groups (cost=316,413.19..316,413.57 rows=19 width=8) (actual time=6.770..194.876 rows=4 loops=1)

  • Filter: (userid IS NOT NULL)
  • Rows Removed by Filter: 2
2.          

CTE users_and_groups

3. 0.011 194.867 ↑ 3.2 6 1

Recursive Union (cost=0.43..316,413.19 rows=19 width=16) (actual time=6.768..194.867 rows=6 loops=1)

4. 39.638 39.638 ↑ 2.2 4 1

Index Scan using groupings_userid_parentid_key on groupings (cost=0.43..16,937.01 rows=9 width=16) (actual time=6.766..39.638 rows=4 loops=1)

  • Index Cond: (parentid = '6121172599862501'::bigint)
5. 0.030 155.218 ↑ 1.0 1 2

Nested Loop (cost=0.00..29,947.58 rows=1 width=16) (actual time=77.608..77.609 rows=1 loops=2)

  • Join Filter: (g.parentid = u.groupid)
  • Rows Removed by Join Filter: 32
6. 0.004 0.004 ↑ 30.0 3 2

WorkTable Scan on users_and_groups u (cost=0.00..1.80 rows=90 width=8) (actual time=0.001..0.002 rows=3 loops=2)

7. 0.023 155.184 ↑ 3.5 11 6

Materialize (cost=0.00..29,894.57 rows=38 width=24) (actual time=2.767..25.864 rows=11 loops=6)

8. 155.161 155.161 ↑ 3.5 11 1

Seq Scan on groupings g (cost=0.00..29,894.38 rows=38 width=24) (actual time=16.591..155.161 rows=11 loops=1)

  • Filter: (parentid = ANY ('{2943838358868810,7214578362478893,6121172599862501,546644769438960}'::bigint[]))
  • Rows Removed by Filter: 1,300,774
Planning time : 0.324 ms
Execution time : 194.957 ms