explain.depesz.com

PostgreSQL's explain analyze made readable

Result: g4f1

Settings
# exclusive inclusive rows x rows loops node
1. 7.001 535.866 ↑ 1.1 924 1

Unique (cost=94,863.88..94,921.08 rows=987 width=4) (actual time=519.677..535.866 rows=924 loops=1)

2. 82.723 528.865 ↓ 11.2 128,022 1

Sort (cost=94,863.88..94,892.48 rows=11,440 width=4) (actual time=519.676..528.865 rows=128,022 loops=1)

  • Sort Key: sp_accounts.id
  • Sort Method: external sort Disk: 1,760kB
3. 18.684 446.142 ↓ 11.2 128,022 1

Hash Left Join (cost=21.89..94,092.72 rows=11,440 width=4) (actual time=0.301..446.142 rows=128,022 loops=1)

  • Hash Cond: (sp_album_tracks.sp_album_id = sp_albums.id)
  • Filter: ((sp_accounts.followers_count >= 200) OR (sp_albums.id IS NOT NULL))
  • Rows Removed by Filter: 1,786
4. 35.654 427.186 ↓ 11.3 129,808 1

Nested Loop (cost=1.43..94,042.23 rows=11,440 width=12) (actual time=0.026..427.186 rows=129,808 loops=1)

5. 13.717 131.916 ↓ 11.3 129,808 1

Nested Loop (cost=0.99..88,814.59 rows=11,440 width=12) (actual time=0.017..131.916 rows=129,808 loops=1)

6. 4.313 4.313 ↓ 1.0 999 1

Index Scan using sp_accounts_pkey on sp_accounts (cost=0.43..1,038.55 rows=987 width=8) (actual time=0.004..4.313 rows=999 loops=1)

  • Index Cond: (id < 1000)
7. 113.886 113.886 ↓ 1.3 130 999

Index Scan using index_sp_account_tracks_on_sp_account_id on sp_account_tracks (cost=0.56..87.90 rows=103 width=8) (actual time=0.005..0.114 rows=130 loops=999)

  • Index Cond: (sp_account_id = sp_accounts.id)
  • Filter: (NOT inactive)
  • Rows Removed by Filter: 0
8. 259.616 259.616 ↑ 1.0 1 129,808

Index Only Scan using index_sp_album_tracks_on_sp_track_id_and_sp_album_id on sp_album_tracks (cost=0.44..0.46 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=129,808)

  • Index Cond: (sp_track_id = sp_account_tracks.sp_track_id)
  • Heap Fetches: 166
9. 0.022 0.272 ↑ 1.0 199 1

Hash (cost=17.95..17.95 rows=201 width=4) (actual time=0.272..0.272 rows=199 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 15kB
10. 0.250 0.250 ↑ 1.0 199 1

Index Only Scan using sp_albums_pkey on sp_albums (cost=0.43..17.95 rows=201 width=4) (actual time=0.004..0.250 rows=199 loops=1)

  • Index Cond: (id < 200)
  • Heap Fetches: 140
Planning time : 0.789 ms
Execution time : 536.291 ms