explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 9WKS

Settings
# exclusive inclusive rows x rows loops node
1. 0.000 0.000 ↓ 0.0

Sort (cost=1,612,961.69..1,613,610.14 rows=259,380 width=96) (actual rows= loops=)

  • Sort Key: (CASE WHEN ((t.tx_date >= '2018-01-01'::date) AND (t.tx_date <= '2018-12-31'::date)) THEN 'previousPeriod'::text WHEN ((t.tx_date >= '2019-01-01'::date) AND (t.tx_date <= '2019-12-31'::date)) THEN 'currentPeriod'::text ELSE NULL::text END), (sum((t.home_amount / '10000000'::numeric)))
2. 0.000 0.000 ↓ 0.0

Finalize GroupAggregate (cost=1,535,025.04..1,581,847.32 rows=259,380 width=96) (actual rows= loops=)

  • Group Key: ((t.item_id)::character varying), (CASE WHEN ((t.tx_date >= '2018-01-01'::date) AND (t.tx_date <= '2018-12-31'::date)) THEN 'previousPeriod'::text WHEN ((t.tx_date >= '2019-01-01'::date) AND (t.tx_date <= '2019-12-31'::date)) THEN 'currentPeriod'::text ELSE NULL::text END)
3. 0.000 0.000 ↓ 0.0

Gather Merge (cost=1,535,025.04..1,571,985.17 rows=272,920 width=96) (actual rows= loops=)

  • Workers Planned: 2
4. 0.000 0.000 ↓ 0.0

Partial GroupAggregate (cost=1,534,025.01..1,539,483.41 rows=136,460 width=96) (actual rows= loops=)

  • Group Key: ((t.item_id)::character varying), (CASE WHEN ((t.tx_date >= '2018-01-01'::date) AND (t.tx_date <= '2018-12-31'::date)) THEN 'previousPeriod'::text WHEN ((t.tx_date >= '2019-01-01'::date) AND (t.tx_date <= '2019-12-31'::date)) THEN 'currentPeriod'::text ELSE NULL::text END)
5. 0.000 0.000 ↓ 0.0

Sort (cost=1,534,025.01..1,534,366.16 rows=136,460 width=70) (actual rows= loops=)

  • Sort Key: ((t.item_id)::character varying), (CASE WHEN ((t.tx_date >= '2018-01-01'::date) AND (t.tx_date <= '2018-12-31'::date)) THEN 'previousPeriod'::text WHEN ((t.tx_date >= '2019-01-01'::date) AND (t.tx_date <= '2019-12-31'::date)) THEN 'currentPeriod'::text ELSE NULL::text END)
6. 0.000 0.000 ↓ 0.0

Hash Join (cost=346.73..1,519,106.26 rows=136,460 width=70) (actual rows= loops=)

  • Hash Cond: (t.account_id = a.account_id)
7. 0.000 0.000 ↓ 0.0

Parallel Append (cost=0.70..1,513,837.99 rows=1,080,750 width=28) (actual rows= loops=)

8. 0.000 0.000 ↓ 0.0

Parallel Index Only Scan using txdetails_p0_company_id_date_tx_date_is_no_post_tx_id_seque_idx on txdetails_p0 t (cost=0.70..1,508,434.24 rows=1,080,750 width=28) (actual rows= loops=)

  • Index Cond: ((company_id = '79451168'::numeric) AND (tx_date >= '2018-01-01'::date) AND (tx_date <= '2019-12-31'::date))
  • Filter: (CASE WHEN ((tx_date >= '2018-01-01'::date) AND (tx_date <= '2018-12-31'::date)) THEN 'previousPeriod'::text WHEN ((tx_date >= '2019-01-01'::date) AND (tx_date <= '2019-12-31'::date)) THEN 'currentPeriod'::text ELSE NULL::text END IS NOT NULL)
9. 0.000 0.000 ↓ 0.0

Hash (cost=345.48..345.48 rows=44 width=13) (actual rows= loops=)

10. 0.000 0.000 ↓ 0.0

Index Scan using accounts_pk on accounts a (cost=0.56..345.48 rows=44 width=13) (actual rows= loops=)

  • Index Cond: (company_id = '79451168'::numeric)
  • Filter: (account_type_id = '10'::numeric)