explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 8jPl : Optimization for: QUERY 1; plan #CVCq

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.014 1,556.278 ↑ 1.0 50 1

Limit (cost=25,670.61..25,670.74 rows=50 width=585) (actual time=1,556.250..1,556.278 rows=50 loops=1)

2. 110.487 1,556.264 ↑ 34.3 50 1

Sort (cost=25,670.61..25,674.90 rows=1,714 width=585) (actual time=1,556.250..1,556.264 rows=50 loops=1)

  • Sort Key: images.date_uploaded
  • Sort Method: top-N heapsort Memory: 75kB
3. 147.379 1,445.777 ↓ 93.9 160,886 1

Nested Loop (cost=1.28..25,613.68 rows=1,714 width=585) (actual time=0.097..1,445.777 rows=160,886 loops=1)

4. 73.716 976.326 ↓ 91.9 161,036 1

Nested Loop (cost=0.85..13,724.04 rows=1,753 width=585) (actual time=0.069..976.326 rows=161,036 loops=1)

5. 0.040 0.786 ↑ 1.0 22 1

Nested Loop (cost=0.29..214.87 rows=22 width=8) (actual time=0.023..0.786 rows=22 loops=1)

6. 0.570 0.570 ↑ 1.0 22 1

Seq Scan on user_groups (cost=0.00..95.83 rows=22 width=4) (actual time=0.008..0.570 rows=22 loops=1)

  • Filter: (group_id = 7)
  • Rows Removed by Filter: 5319
7. 0.176 0.176 ↑ 1.0 1 22

Index Only Scan using users_pkey on users (cost=0.29..5.40 rows=1 width=4) (actual time=0.006..0.008 rows=1 loops=22)

  • Index Cond: (id = user_groups.user_id)
  • Heap Fetches: 18
8. 901.824 901.824 ↓ 37.2 7,320 22

Index Scan using creator_date_uploaded_Where_pub_not_del on images (cost=0.56..612.08 rows=197 width=585) (actual time=0.062..40.992 rows=7,320 loops=22)

  • Index Cond: ((creator_id = users.id) AND ((creator_type)::text = 'User'::text) AND (status = 2))
9. 322.072 322.072 ↑ 1.0 1 161,036

Index Scan using locations_pkey on locations (cost=0.43..6.77 rows=1 width=4) (actual time=0.002..0.002 rows=1 loops=161,036)

  • Index Cond: (id = images.location_id)
  • Filter: active
  • Rows Removed by Filter: 0
Planning time : 1.694 ms
Execution time : 1,556.352 ms