explain.depesz.com

PostgreSQL's explain analyze made readable

Result: E09r

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 67.634 4,538.391 ↓ 85,105.0 85,105 1

Hash Right Join (cost=107,474.56..107,476.95 rows=1 width=2,248) (actual time=4,502.660..4,538.391 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=2,240,510, temp read=3,832 written=19,740
2.          

CTE filtered_data_txns_for_milestones

3. 433.302 4,192.773 ↓ 85,105.0 85,105 1

Nested Loop (cost=9,603.64..107,447.83 rows=1 width=771) (actual time=64.503..4,192.773 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: 293,903
  • Buffers: shared hit=2,240,510, temp read=40 written=12,179
4. 130.512 2,908.421 ↓ 85,105.0 85,105 1

Nested Loop (cost=9,603.64..107,446.50 rows=1 width=415) (actual time=64.452..2,908.421 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: 293,903
  • Buffers: shared hit=1,773,578, temp read=40 written=12,179
5. 189.558 1,926.859 ↓ 28,368.3 85,105 1

Nested Loop (cost=9,603.64..107,444.44 rows=3 width=259) (actual time=64.423..1,926.859 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=1,306,332, temp read=40 written=12,179
6. 168.499 933.967 ↓ 16,736.1 401,667 1

Merge Join (cost=9,603.23..107,433.11 rows=24 width=259) (actual time=61.106..933.967 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.
  • Rows Removed by Join Filter: 19,019
  • Buffers: shared hit=16,332, temp read=40 written=12,179
7. 0.078 0.078 ↑ 1,093.8 73 1

Index Only Scan using legal_entity_id_idx on template (cost=0.42..3,417.15 rows=79,846 width=28) (actual time=0.036..0.078 rows=73 loops=1)

  • Index Cond: ((dataset_source_id = 2) AND (effective_begin_date = '2019-12-31'::date))
  • Heap Fetches: 73
  • Buffers: shared hit=3
8. 300.321 765.390 ↓ 1.0 460,048 1

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

  • Buffers: shared hit=16,329, temp read=40 written=12,179
9. 44.037 465.069 ↓ 1.0 458,775 1

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

  • Sort Key: a.legal_entity_id
  • Buffers: shared hit=16,329
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. 421.028 421.028 ↓ 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.040..421.028 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=16,328
12. 803.334 803.334 ↓ 0.0 0 401,667

Index Only Scan using legal_entity_family_id_idx on milestone (cost=0.42..0.45 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) AND (dataset_type_id = a.dataset_type_id) AND (dataset_level_id = a.dataset_level_id) AND (dataset_source_id = 2) AND (effective_begin_date = '2
  • Heap Fetches: 85,105
  • Buffers: shared hit=1,290,000
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=467,246
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.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=467,246
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=466,932
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=466,932
19.          

CTE union_parser_mode

20. 0.000 0.005 ↓ 0.0 0 1

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

21. 0.002 0.003 ↓ 0.0 0 1

HashAggregate (cost=12.49..12.92 rows=43 width=17) (actual time=0.003..0.003 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.001 0.001 ↓ 0.0 0 1

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

  • Filter: (knowledge_end_date > now())
23. 0.001 0.002 ↓ 0.0 0 1

HashAggregate (cost=12.49..12.92 rows=43 width=17) (actual time=0.002..0.002 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.001 0.001 ↓ 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.001..0.001 rows=0 loops=1)

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

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

26. 92.923 4,470.751 ↓ 85,105.0 85,105 1

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

  • Buckets: 16,384 (originally 1024) Batches: 2 (originally 1) Memory Usage: 31,325kB
  • Buffers: shared hit=2,240,510, temp read=40 written=19,739
27. 4,377.828 4,377.828 ↓ 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=64.511..4,377.828 rows=85,105 loops=1)

  • Buffers: shared hit=2,240,510, temp read=40 written=15,949
Planning time : 93.448 ms
Execution time : 4,566.133 ms