explain.depesz.com

PostgreSQL's explain analyze made readable

Result: FegR

Settings
# exclusive inclusive rows x rows loops node
1. 2,394.288 590,731.104 ↑ 7.1 124,775 1

GroupAggregate (cost=42,733,939.81..42,751,806.91 rows=880,000 width=36) (actual time=582,780.359..590,731.104 rows=124,775 loops=1)

  • Group Key: sat_insurance_contract_osago."primaryDrivingArea", lnk_insurance_contract_insurance_company.insurance_company_key, sat_insurance_contract_osago."eosagoIndicator", sat_insurance_contract.closing_date
2. 44,356.858 588,336.816 ↓ 3.6 18,445,644 1

Sort (cost=42,733,939.81..42,736,477.66 rows=5,075,699 width=44) (actual time=582,780.308..588,336.816 rows=18,445,644 loops=1)

  • Sort Key: sat_insurance_contract_osago."primaryDrivingArea", lnk_insurance_contract_insurance_company.insurance_company_key, sat_insurance_contract_osago."eosagoIndicator", sat_insurance_contract.closing_date
  • Sort Method: external merge Disk: 1,046,864kB
3. 15,215.065 543,979.958 ↓ 3.6 18,445,644 1

Nested Loop (cost=20,606,872.20..42,531,655.73 rows=5,075,699 width=44) (actual time=120,856.870..543,979.958 rows=18,445,644 loops=1)

4. 0.000 454,982.317 ↓ 3.6 18,445,644 1

Nested Loop (cost=20,606,872.09..35,465,779.13 rows=5,075,699 width=72) (actual time=120,856.832..454,982.317 rows=18,445,644 loops=1)

5. 0.000 365,629.311 ↓ 3.6 18,445,644 1

Nested Loop (cost=20,606,871.98..28,394,207.28 rows=5,075,802 width=40) (actual time=120,856.796..365,629.311 rows=18,445,644 loops=1)

6. 3,302.332 144,902.862 ↓ 3.6 18,445,644 1

Unique (cost=20,606,871.86..20,625,149.44 rows=5,075,802 width=69) (actual time=120,856.733..144,902.862 rows=18,445,644 loops=1)

7. 81,271.859 141,600.530 ↓ 1.1 19,450,774 1

Sort (cost=20,606,871.86..20,616,010.65 rows=18,277,575 width=69) (actual time=120,856.727..141,600.530 rows=19,450,774 loops=1)

  • Sort Key: sat_insurance_contract.contract_id, (GREATEST(sat_insurance_contract.effective_date, sat_insurance_contract.revision_date)) DESC NULLS LAST
  • Sort Method: external merge Disk: 1,560,696kB
8. 0.000 60,328.671 ↓ 1.1 19,450,774 1

Gather (cost=1,000.00..19,737,569.48 rows=18,277,575 width=69) (actual time=0.577..60,328.671 rows=19,450,774 loops=1)

  • Workers Planned: 9
  • Workers Launched: 9
9. 61,078.945 61,078.945 ↑ 1.0 1,945,077 10 / 10

Parallel Seq Scan on sat_insurance_contract (cost=0.00..17,908,811.98 rows=2,030,842 width=69) (actual time=0.282..61,078.945 rows=1,945,077 loops=10)

  • Filter: (((status)::text <> ALL ('{1,3,4}'::text[])) AND (closing_date <= to_date('31.12.2019'::text, 'DD.MM.YYYY'::text)) AND (closing_date >= (to_date('31.12.2019'::text, 'DD.MM.YYYY'::text) - 30)))
  • Rows Removed by Filter: 48,379,116
10. 221,347.728 221,347.728 ↑ 1.0 1 18,445,644

Index Only Scan using pk_hub_insurance_contract_key on hub_insurance_contract (cost=0.11..1.53 rows=1 width=16) (actual time=0.012..0.012 rows=1 loops=18,445,644)

  • Index Cond: (insurance_contract_key = sat_insurance_contract.insurance_contract_key)
  • Heap Fetches: 18,445,644
11. 92,228.220 92,228.220 ↑ 1.0 1 18,445,644

Index Scan using insurance_contract_key1_idx on lnk_insurance_contract_insurance_company (cost=0.11..1.39 rows=1 width=32) (actual time=0.004..0.005 rows=1 loops=18,445,644)

  • Index Cond: (insurance_contract_key = hub_insurance_contract.insurance_contract_key)
12. 73,782.576 73,782.576 ↑ 1.0 1 18,445,644

Index Scan using pk_sat_insurance_contract_osago on sat_insurance_contract_osago (cost=0.11..1.39 rows=1 width=20) (actual time=0.004..0.004 rows=1 loops=18,445,644)

  • Index Cond: (insurance_contract_key = hub_insurance_contract.insurance_contract_key)
Planning time : 8.227 ms
Execution time : 590,865.502 ms