explain.depesz.com

PostgreSQL's explain analyze made readable

Result: c65i : US

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 2.976 1,086.205 ↓ 3,074.0 3,074 1

GroupAggregate (cost=93,457.64..93,457.67 rows=1 width=274) (actual time=1,082.819..1,086.205 rows=3,074 loops=1)

  • Group Key: cte_base.processedtime, cte_base.key, (CURRENT_TIMESTAMP), ((CURRENT_TIMESTAMP - '00:10:00'::interval))
2.          

CTE cte_topnasn

3. 0.047 0.047 ↑ 6.9 15 1

Index Scan using idx_country_rank on country_asn_rank r (cost=0.41..175.54 rows=103 width=31) (actual time=0.025..0.047 rows=15 loops=1)

  • Index Cond: ((country = 'US'::text) AND (asn_rank <= 15))
4.          

CTE cte_base

5. 164.125 1,047.094 ↓ 8,387.0 8,387 1

Nested Loop (cost=92,068.21..93,282.06 rows=1 width=501) (actual time=662.524..1,047.094 rows=8,387 loops=1)

  • Join Filter: ((perf.asn)::text = t.asn_id)
  • Rows Removed by Join Filter: 2103253
6. 0.000 742.193 ↓ 140,776.0 140,776 1

Gather Merge (cost=92,068.21..93,278.71 rows=1 width=93) (actual time=627.107..742.193 rows=140,776 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
7. 140.742 2,014.518 ↓ 46,925.0 46,925 3

Merge Join (cost=91,068.18..92,278.57 rows=1 width=93) (actual time=594.638..671.506 rows=46,925 loops=3)

  • Merge Cond: (((perf.asn)::text = th.asn) AND ((perf.cdn)::text = (th.cdn)::text) AND ((perf.state)::text = th.state))
8. 485.940 1,158.165 ↑ 1.2 47,238 3

Sort (cost=80,380.94..80,528.00 rows=58,822 width=75) (actual time=371.162..386.055 rows=47,238 loops=3)

  • Sort Key: perf.asn, perf.cdn, perf.state
  • Sort Method: external merge Disk: 4016kB
9. 9.594 672.225 ↑ 1.2 47,238 3

Append (cost=0.00..73,106.54 rows=58,822 width=75) (actual time=203.261..224.075 rows=47,238 loops=3)

10. 165.282 165.282 ↓ 0.0 0 3

Parallel Seq Scan on cdn_isp_performance_us_2019_10_31_20 perf (cost=0.00..18,580.78 rows=1 width=75) (actual time=55.094..55.094 rows=0 loops=3)

  • Filter: (((country)::text = 'US'::text) AND (processedtimestamp <= timezone('utc'::text, CURRENT_TIMESTAMP)) AND (processedtimestamp >= (timezone('utc'::text, CURRENT_TIMESTAMP) - '00:10:00'::interval)))
  • Rows Removed by Filter: 231032
11. 204.720 204.720 ↓ 0.0 0 3

Parallel Seq Scan on cdn_isp_performance_us_2019_11_8_16 perf_1 (cost=0.00..23,236.61 rows=1 width=75) (actual time=68.240..68.240 rows=0 loops=3)

  • Filter: (((country)::text = 'US'::text) AND (processedtimestamp <= timezone('utc'::text, CURRENT_TIMESTAMP)) AND (processedtimestamp >= (timezone('utc'::text, CURRENT_TIMESTAMP) - '00:10:00'::interval)))
  • Rows Removed by Filter: 288070
12. 219.297 219.297 ↓ 0.0 0 3

Parallel Seq Scan on cdn_isp_performance_us_2019_11_8_17 perf_2 (cost=0.00..24,763.20 rows=1 width=75) (actual time=73.099..73.099 rows=0 loops=3)

  • Filter: (((country)::text = 'US'::text) AND (processedtimestamp <= timezone('utc'::text, CURRENT_TIMESTAMP)) AND (processedtimestamp >= (timezone('utc'::text, CURRENT_TIMESTAMP) - '00:10:00'::interval)))
  • Rows Removed by Filter: 307002
13. 73.329 73.329 ↑ 1.2 47,238 3

Parallel Seq Scan on cdn_isp_performance_us_2019_11_8_18 perf_3 (cost=0.00..6,488.01 rows=58,816 width=75) (actual time=6.826..24.443 rows=47,238 loops=3)

  • Filter: (((country)::text = 'US'::text) AND (processedtimestamp <= timezone('utc'::text, CURRENT_TIMESTAMP)) AND (processedtimestamp >= (timezone('utc'::text, CURRENT_TIMESTAMP) - '00:10:00'::interval)))
  • Rows Removed by Filter: 33163
14. 0.003 0.003 ↓ 0.0 0 3

Parallel Seq Scan on cdn_isp_performance_us_2019_11_8_19 perf_4 (cost=0.00..12.65 rows=1 width=506) (actual time=0.001..0.001 rows=0 loops=3)

  • Filter: (((country)::text = 'US'::text) AND (processedtimestamp <= timezone('utc'::text, CURRENT_TIMESTAMP)) AND (processedtimestamp >= (timezone('utc'::text, CURRENT_TIMESTAMP) - '00:10:00'::interval)))
15. 0.000 0.000 ↓ 0.0 0 3

Parallel Seq Scan on cdn_isp_performance_us_2019_11_8_20 perf_5 (cost=0.00..12.65 rows=1 width=506) (actual time=0.000..0.000 rows=0 loops=3)

  • Filter: (((country)::text = 'US'::text) AND (processedtimestamp <= timezone('utc'::text, CURRENT_TIMESTAMP)) AND (processedtimestamp >= (timezone('utc'::text, CURRENT_TIMESTAMP) - '00:10:00'::interval)))
16. 0.000 0.000 ↓ 0.0 0 3

Parallel Seq Scan on cdn_isp_performance_us_2019_11_8_21 perf_6 (cost=0.00..12.65 rows=1 width=506) (actual time=0.000..0.000 rows=0 loops=3)

  • Filter: (((country)::text = 'US'::text) AND (processedtimestamp <= timezone('utc'::text, CURRENT_TIMESTAMP)) AND (processedtimestamp >= (timezone('utc'::text, CURRENT_TIMESTAMP) - '00:10:00'::interval)))
17. 676.728 715.611 ↓ 1.5 93,653 3

Sort (cost=10,687.24..10,842.78 rows=62,216 width=30) (actual time=223.465..238.537 rows=93,653 loops=3)

  • Sort Key: th.asn, th.cdn, th.state
  • Sort Method: external sort Disk: 2512kB
18. 30.264 38.883 ↓ 1.0 62,673 3

Bitmap Heap Scan on cdn_threshold th (cost=1,878.60..5,733.30 rows=62,216 width=30) (actual time=2.997..12.961 rows=62,673 loops=3)

  • Recheck Cond: (country = 'US'::text)
  • Heap Blocks: exact=1194
19. 8.619 8.619 ↓ 1.0 62,673 3

Bitmap Index Scan on ix_cdn_threshold (cost=0.00..1,863.04 rows=62,216 width=0) (actual time=2.873..2.873 rows=62,673 loops=3)

  • Index Cond: (country = 'US'::text)
20. 140.776 140.776 ↑ 6.9 15 140,776

CTE Scan on cte_topnasn t (cost=0.00..2.06 rows=103 width=450) (actual time=0.000..0.001 rows=15 loops=140,776)

21. 31.264 1,083.229 ↓ 8,387.0 8,387 1

Sort (cost=0.04..0.04 rows=1 width=274) (actual time=1,082.803..1,083.229 rows=8,387 loops=1)

  • Sort Key: cte_base.processedtime, cte_base.key
  • Sort Method: quicksort Memory: 1564kB
22. 1,051.965 1,051.965 ↓ 8,387.0 8,387 1

CTE Scan on cte_base (cost=0.00..0.03 rows=1 width=274) (actual time=662.528..1,051.965 rows=8,387 loops=1)

Planning time : 142.091 ms
Execution time : 1,088.525 ms