explain.depesz.com

PostgreSQL's explain analyze made readable

Result: L1hM

Settings
# exclusive inclusive rows x rows loops node
1. 0.003 1,809.087 ↓ 2.0 2 1

Limit (cost=687,589.25..687,589.26 rows=1 width=764) (actual time=1,809.085..1,809.087 rows=2 loops=1)

2. 0.024 1,809.084 ↓ 2.0 2 1

Sort (cost=687,589.25..687,589.26 rows=1 width=764) (actual time=1,809.083..1,809.084 rows=2 loops=1)

  • Sort Key: adset.created_at DESC, adset.adset_id
  • Sort Method: quicksort Memory: 26kB
3. 0.041 1,809.060 ↓ 2.0 2 1

WindowAgg (cost=685,314.79..687,589.24 rows=1 width=764) (actual time=1,809.056..1,809.060 rows=2 loops=1)

4. 0.008 1,809.019 ↓ 2.0 2 1

Nested Loop (cost=685,314.79..687,589.21 rows=1 width=820) (actual time=1,804.011..1,809.019 rows=2 loops=1)

5. 0.034 1,808.969 ↓ 2.0 2 1

Nested Loop Left Join (cost=685,314.64..687,581.03 rows=1 width=824) (actual time=1,803.972..1,808.969 rows=2 loops=1)

  • Join Filter: (adset.adset_id = adseterror.adset_id)
  • Rows Removed by Join Filter: 127
6. 0.457 1,745.261 ↓ 2.0 2 1

Merge Left Join (cost=677,546.37..679,809.97 rows=1 width=816) (actual time=1,740.317..1,745.261 rows=2 loops=1)

  • Merge Cond: (adset.adset_id = adset_creative_stat.adset_id)
7. 0.009 0.073 ↓ 2.0 2 1

Sort (cost=26.36..26.36 rows=1 width=720) (actual time=0.072..0.073 rows=2 loops=1)

  • Sort Key: adset.adset_id
  • Sort Method: quicksort Memory: 26kB
8. 0.005 0.064 ↓ 2.0 2 1

Nested Loop (cost=0.29..26.35 rows=1 width=720) (actual time=0.057..0.064 rows=2 loops=1)

  • Join Filter: (adset.advertiser_id = advertiser.advertiser_id)
  • Rows Removed by Join Filter: 4
9. 0.015 0.015 ↑ 1.5 2 1

Index Scan using ix_adset_campaign_id on adset (cost=0.29..10.75 rows=3 width=684) (actual time=0.011..0.015 rows=2 loops=1)

  • Index Cond: (campaign_id = 4586)
10. 0.011 0.044 ↓ 1.5 3 2

Materialize (cost=0.00..15.51 rows=2 width=40) (actual time=0.009..0.022 rows=3 loops=2)

11. 0.033 0.033 ↓ 1.5 3 1

Seq Scan on advertiser (cost=0.00..15.50 rows=2 width=40) (actual time=0.010..0.033 rows=3 loops=1)

  • Filter: (agency_id = 13)
  • Rows Removed by Filter: 194
12. 5.403 1,744.731 ↑ 4.2 1,821 1

Finalize GroupAggregate (cost=677,520.01..679,688.75 rows=7,587 width=100) (actual time=1,736.865..1,744.731 rows=1,821 loops=1)

  • Group Key: adset_creative_stat.adset_id
13. 0.000 1,739.328 ↑ 3.4 4,501 1

Gather Merge (cost=677,520.01..679,290.44 rows=15,174 width=100) (actual time=1,736.846..1,739.328 rows=4,501 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
14. 4.092 5,199.189 ↑ 5.1 1,501 3

Sort (cost=676,519.99..676,538.96 rows=7,587 width=100) (actual time=1,732.601..1,733.063 rows=1,501 loops=3)

  • Sort Key: adset_creative_stat.adset_id
  • Sort Method: quicksort Memory: 259kB
  • Worker 0: Sort Method: quicksort Memory: 260kB
  • Worker 1: Sort Method: quicksort Memory: 259kB
15. 541.683 5,195.097 ↑ 5.1 1,501 3

Partial HashAggregate (cost=675,898.26..676,031.03 rows=7,587 width=100) (actual time=1,730.134..1,731.699 rows=1,501 loops=3)

  • Group Key: adset_creative_stat.adset_id
16. 4,653.414 4,653.414 ↑ 1.3 349,168 3

Parallel Seq Scan on adset_creative_stat (cost=0.00..671,200.95 rows=469,731 width=28) (actual time=0.065..1,551.138 rows=349,168 loops=3)

  • Filter: ((hour >= 436246) AND (hour <= 436990))
  • Rows Removed by Filter: 12301772
17. 12.767 63.674 ↑ 1.3 64 2

HashAggregate (cost=7,768.27..7,769.13 rows=86 width=12) (actual time=31.816..31.837 rows=64 loops=2)

  • Group Key: adseterror.adset_id
18. 22.639 50.907 ↓ 1.0 42,301 1

Hash Join (cost=1,181.11..7,560.95 rows=41,464 width=8) (actual time=9.683..50.907 rows=42,301 loops=1)

  • Hash Cond: (adseterror.adset_id = adset_1.adset_id)
19. 18.663 18.663 ↓ 1.0 42,301 1

Seq Scan on adseterror (cost=0.00..6,270.96 rows=41,464 width=8) (actual time=0.010..18.663 rows=42,301 loops=1)

  • Filter: (("time" >= '2019-10-07 22:00:00'::timestamp without time zone) AND ("time" <= '2019-11-07 22:59:59'::timestamp without time zone))
20. 4.648 9.605 ↑ 1.0 15,068 1

Hash (cost=992.76..992.76 rows=15,068 width=4) (actual time=9.605..9.605 rows=15,068 loops=1)

  • Buckets: 16384 Batches: 1 Memory Usage: 658kB
21. 4.957 4.957 ↑ 1.0 15,068 1

Index Only Scan using adset_pkey on adset adset_1 (cost=0.29..992.76 rows=15,068 width=4) (actual time=0.020..4.957 rows=15,068 loops=1)

  • Heap Fetches: 2761
22. 0.042 0.042 ↑ 1.0 1 2

Index Only Scan using agency_pkey on agency (cost=0.15..8.17 rows=1 width=4) (actual time=0.020..0.021 rows=1 loops=2)

  • Index Cond: (agency_id = 13)
  • Heap Fetches: 2