explain.depesz.com

PostgreSQL's explain analyze made readable

Result: W5Oj

Settings
# exclusive inclusive rows x rows loops node
1. 15,247.969 16,733,903.348 ↓ 0.0 0 1

Insert on instrument_hist (cost=7,463,538.11..8,105,168.33 rows=17,110,139 width=73) (actual time=16,733,903.348..16,733,903.348 rows=0 loops=1)

  • Functions: 20
  • Options: Inlining true, Optimization true, Expressions true, Deforming true
  • Timing: Generation 8.589 ms, Inlining 41.729 ms, Optimization 472.531 ms, Emission 290.345 ms, Total 813.193 ms
2. 1,091.459 16,718,655.379 ↑ 2.5 6,856,522 1

Subquery Scan on *SELECT* (cost=7,463,538.11..8,105,168.33 rows=17,110,139 width=73) (actual time=16,697,045.082..16,718,655.379 rows=6,856,522 loops=1)

3. 5,175.201 16,717,563.920 ↑ 2.5 6,856,522 1

Unique (cost=7,463,538.11..7,934,066.94 rows=17,110,139 width=81) (actual time=16,697,045.060..16,717,563.920 rows=6,856,522 loops=1)

4. 45,909.353 16,712,388.719 ↓ 1.0 17,118,998 1

Sort (cost=7,463,538.11..7,506,313.46 rows=17,110,139 width=81) (actual time=16,697,045.058..16,712,388.719 rows=17,118,998 loops=1)

  • Sort Key: h_1.id, h_1.is_on, h_1.app_on, (date(h_1.modified_timestamp)), (lead((h_1.modified_timestamp)::date) OVER (?)), i.name, i.display_name, i.symbol, i.asset, i.tenant
  • Sort Method: external merge Disk: 1,646,336kB
5. 53,156.905 16,666,479.366 ↓ 1.0 17,118,998 1

WindowAgg (cost=0.97..4,928,343.83 rows=17,110,139 width=81) (actual time=805.634..16,666,479.366 rows=17,118,998 loops=1)

6. 12,194.445 16,613,322.461 ↓ 1.0 17,118,998 1

Merge Join (cost=0.97..4,543,365.70 rows=17,110,139 width=73) (actual time=805.423..16,613,322.461 rows=17,118,998 loops=1)

  • Merge Cond: (h_1.id = i.id)
7. 16,587,052.034 16,587,052.034 ↓ 1.0 17,118,998 1

Index Scan using ts_instrument_pkey on ts_instrument h_1 (cost=0.56..4,310,510.47 rows=17,110,139 width=18) (actual time=805.395..16,587,052.034 rows=17,118,998 loops=1)

  • Index Cond: (modified_timestamp >= 2,018-06-14 21:00:00+00::timestamp with time zone)
  • Filter: (is_on IS NOT NULL)
8. 14,075.982 14,075.982 ↑ 2.2 9,714 1

Index Scan using ts_instrument_pkey on ts_instrument i (cost=0.41..18,924.16 rows=21,734 width=63) (actual time=0.016..14,075.982 rows=9,714 loops=1)

Planning time : 19.396 ms
Execution time : 16,734,157.270 ms