explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ke4H : Optimization for: plan #E09r

Settings

Optimization path:

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 67.652 4,279.685 ↓ 85,105.0 85,105 1

Hash Right Join (cost=107,463.53..107,465.91 rows=1 width=2,248) (actual time=4,244.110..4,279.685 rows=85,105 loops=1)

  • Hash Cond: ((d.parser_id = filterkeys.parser_id) AND (d.etl_dataset_type_id = filterkeys.f_dataset_type_id))
  • Join Filter: ((d.effective_begin_date <= filterkeys.f_effective_begin_date) AND (d.effective_end_date > filterkeys.f_effective_begin_date))
  • Filter: ((d.parser_id IS NULL) OR ((d.parser_id > 0) AND d.in_cocoa_mode) OR ((d.parser_id < 0) AND (NOT d.in_cocoa_mode)))
  • Buffers: shared hit=2148172, temp read=3832 written=19740
  • dataset_level_id) AND (a.dataset_type_id = dataset_type_id))
2.          

CTE filtered_data_txns_for_milestones

3. 376.139 3,934.896 ↓ 85,105.0 85,105 1

Nested Loop (cost=9,433.12..107,436.80 rows=1 width=771) (actual time=56.515..3,934.896 rows=85,105 loops=1)

  • Join Filter: ((c.knowledge_begin_date <= milestone.knowledge_begin_date) AND (c.knowledge_end_date > milestone.knowledge_begin_date))
  • Rows Removed by Join Filter: 293903
  • Buffers: shared hit=2148172, temp read=40 written=12179
4. 84.915 2,707.707 ↓ 85,105.0 85,105 1

Nested Loop (cost=9,433.12..107,435.46 rows=1 width=415) (actual time=56.472..2,707.707 rows=85,105 loops=1)

  • Join Filter: ((b.knowledge_begin_date <= milestone.knowledge_begin_date) AND (b.knowledge_end_date > milestone.knowledge_begin_date))
  • Rows Removed by Join Filter: 293903
  • Buffers: shared hit=1681240, temp read=40 written=12179
5. 57.463 1,771.742 ↓ 28,368.3 85,105 1

Nested Loop (cost=9,433.12..107,433.40 rows=3 width=259) (actual time=56.443..1,771.742 rows=85,105 loops=1)

  • Join Filter: ((template.legal_entity_family_id = milestone.legal_entity_family_id) AND (template.dataset_level_id = milestone.dataset_level_id) AND (template.dataset_type_id = milestone.dataset_type_id))
  • Buffers: shared hit=1213994, temp read=40 written=12179
6. 164.473 910.945 ↓ 16,736.1 401,667 1

Merge Join (cost=9,432.83..107,425.10 rows=24 width=259) (actual time=53.310..910.945 rows=401,667 loops=1)

  • Merge Cond: (template.legal_entity_id = a.legal_entity_id)
  • Join Filter: ((template.legal_entity_family_id = a.legal_entity_family_id) AND (template.dataset_level_id = a.dataset_level_id) AND (template.dataset_type_id = a.dataset_type_id) AND (template.strategy_id = a.strategy_id))
  • Rows Removed by Join Filter: 19019
  • Buffers: shared hit=16331, temp read=40 written=12179
7. 0.088 0.088 ↑ 1,093.8 73 1

Index Scan using legal_entity_id_idx on template (cost=0.29..2,628.21 rows=79,846 width=28) (actual time=0.032..0.088 rows=73 loops=1)

  • Filter: ((dataset_source_id = 2) AND (effective_begin_date = '2019-12-31'::date))
  • Buffers: shared hit=2
8. 282.426 746.384 ↓ 1.0 460,048 1

Materialize (cost=0.56..97,128.99 rows=456,336 width=235) (actual time=0.058..746.384 rows=460,048 loops=1)

  • Buffers: shared hit=16329, temp read=40 written=12179
9. 47.750 463.958 ↓ 1.0 458,775 1

Merge Append (cost=0.56..95,988.15 rows=456,336 width=235) (actual time=0.050..463.958 rows=458,775 loops=1)

  • Sort Key: a.legal_entity_id
  • Buffers: shared hit=16329
10. 0.004 0.004 ↓ 0.0 0 1

Index Scan using idx_data_keys_date_lef on processed_feed_data_keys a (cost=0.12..4.15 rows=1 width=1,684) (actual time=0.004..0.004 rows=0 loops=1)

  • Index Cond: (effective_begin_date = '2019-12-31'::date)
  • Filter: ((dataset_source_id = 2) AND (available = 'Y'::bpchar) AND ((bucket_type)::text = 'REGULAR'::text))
  • Buffers: shared hit=1
11. 416.204 416.204 ↓ 1.0 458,775 1

Index Scan using idx_data_keys_date_lef_2019_12_2 on processed_feed_data_keys_2019_12_2 a_1 (cost=0.42..90,279.79 rows=456,335 width=235) (actual time=0.046..416.204 rows=458,775 loops=1)

  • Index Cond: (effective_begin_date = '2019-12-31'::date)
  • Filter: ((dataset_source_id = 2) AND (available = 'Y'::bpchar) AND ((bucket_type)::text = 'REGULAR'::text))
  • Buffers: shared hit=16328
12. 803.334 803.334 ↓ 0.0 0 401,667

Index Scan using legal_entity_family_id_idx on milestone (cost=0.29..0.33 rows=1 width=28) (actual time=0.002..0.002 rows=0 loops=401,667)

  • Index Cond: (legal_entity_family_id = a.legal_entity_family_id)
  • Filter: ((dataset_source_id = 2) AND (effective_begin_date = '2019-12-31'::date) AND (a.knowledge_begin_date <= knowledge_begin_date) AND (a.knowledge_end_date > knowledge_begin_date) AND (a.dataset_level_id =
  • Rows Removed by Filter: 1
  • Buffers: shared hit=1197663
13. 85.105 851.050 ↓ 2.0 4 85,105

Append (cost=0.00..0.66 rows=2 width=160) (actual time=0.005..0.010 rows=4 loops=85,105)

  • Buffers: shared hit=467246
14. 0.000 0.000 ↓ 0.0 0 85,105

Seq Scan on processed_feed_data b (cost=0.00..0.00 rows=1 width=160) (actual time=0.000..0.000 rows=0 loops=85,105)

  • Filter: ((dataset_source_id = 2) AND (effective_begin_date = '2019-12-31'::date) AND (available = 'Y'::bpchar) AND (a.raw_record_id = raw_record_id) AND (a.parser_id = parser_id))
15. 765.945 765.945 ↓ 4.0 4 85,105

Index Scan using idx_feed_data_rwid_2019_12_2 on processed_feed_data_2019_12_2 b_1 (cost=0.42..0.66 rows=1 width=160) (actual time=0.004..0.009 rows=4 loops=85,105)

  • Index Cond: (raw_record_id = a.raw_record_id)
  • Filter: ((dataset_source_id = 2) AND (effective_begin_date = '2019-12-31'::date) AND (available = 'Y'::bpchar) AND (a.parser_id = parser_id))
  • Rows Removed by Filter: 2
  • Buffers: shared hit=467246
16. 85.105 851.050 ↓ 2.0 4 85,105

Append (cost=0.00..1.25 rows=2 width=1,175) (actual time=0.005..0.010 rows=4 loops=85,105)

  • Buffers: shared hit=466932
17. 0.000 0.000 ↓ 0.0 0 85,105

Seq Scan on processed_feed_records c (cost=0.00..0.00 rows=1 width=64) (actual time=0.000..0.000 rows=0 loops=85,105)

  • Filter: ((dataset_source_id = 2) AND (effective_begin_date = '2019-12-31'::date) AND (available = 'Y'::bpchar) AND (a.raw_record_id = raw_record_id) AND (a.parser_id = parser_id))
18. 765.945 765.945 ↓ 4.0 4 85,105

Index Scan using idx_records_rwid_2019_12_2 on processed_feed_records_2019_12_2 c_1 (cost=0.42..1.25 rows=1 width=1,175) (actual time=0.005..0.009 rows=4 loops=85,105)

  • Index Cond: (raw_record_id = a.raw_record_id)
  • Filter: ((dataset_source_id = 2) AND (effective_begin_date = '2019-12-31'::date) AND (available = 'Y'::bpchar) AND (a.parser_id = parser_id))
  • Rows Removed by Filter: 2
  • Buffers: shared hit=466932
19.          

CTE union_parser_mode

20. 0.000 0.010 ↓ 0.0 0 1

Append (cost=12.49..26.69 rows=86 width=17) (actual time=0.010..0.010 rows=0 loops=1)

21. 0.002 0.004 ↓ 0.0 0 1

HashAggregate (cost=12.49..12.92 rows=43 width=17) (actual time=0.004..0.004 rows=0 loops=1)

  • Group Key: etl_to_cocoa_mapping.etl_parser_id, etl_to_cocoa_mapping.in_cocoa_mode, etl_to_cocoa_mapping.etl_dataset_type_id, etl_to_cocoa_mapping.effective_begin_date, etl_to_cocoa_mapping.effective_end_date
22. 0.002 0.002 ↓ 0.0 0 1

Seq Scan on etl_to_cocoa_mapping (cost=0.00..11.95 rows=43 width=17) (actual time=0.002..0.002 rows=0 loops=1)

  • Filter: (knowledge_end_date > now())
23. 0.000 0.006 ↓ 0.0 0 1

HashAggregate (cost=12.49..12.92 rows=43 width=17) (actual time=0.006..0.006 rows=0 loops=1)

  • Group Key: etl_to_cocoa_mapping_1.cocoa_parser_id, etl_to_cocoa_mapping_1.in_cocoa_mode, etl_to_cocoa_mapping_1.etl_dataset_type_id, etl_to_cocoa_mapping_1.effective_begin_date, etl_to_cocoa_mapping_1.effective_end_date
24. 0.006 0.006 ↓ 0.0 0 1

Seq Scan on etl_to_cocoa_mapping etl_to_cocoa_mapping_1 (cost=0.00..11.95 rows=43 width=17) (actual time=0.006..0.006 rows=0 loops=1)

  • Filter: (knowledge_end_date > now())
25. 0.012 0.012 ↓ 0.0 0 1

CTE Scan on union_parser_mode d (cost=0.00..1.72 rows=86 width=17) (actual time=0.012..0.012 rows=0 loops=1)

26. 95.388 4,212.021 ↓ 85,105.0 85,105 1

Hash (cost=0.02..0.02 rows=1 width=2,220) (actual time=4,212.021..4,212.021 rows=85,105 loops=1)

  • Buckets: 16384 (originally 1024) Batches: 2 (originally 1) Memory Usage: 31325kB
  • Buffers: shared hit=2148172, temp read=40 written=19739
27. 4,116.633 4,116.633 ↓ 85,105.0 85,105 1

CTE Scan on filtered_data_txns_for_milestones filterkeys (cost=0.00..0.02 rows=1 width=2,220) (actual time=56.522..4,116.633 rows=85,105 loops=1)

  • Buffers: shared hit=2148172, temp read=40 written=15949
Planning time : 30.421 ms
Execution time : 4,306.745 ms