explain.depesz.com

PostgreSQL's explain analyze made readable

Result: j6z

Settings
# exclusive inclusive rows x rows loops node
1. 0.008 10.379 ↑ 503.5 2 1

Sort (cost=5,185.58..5,188.09 rows=1,007 width=96) (actual time=10.378..10.379 rows=2 loops=1)

  • 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)))
  • Sort Method: quicksort Memory: 25kB
2. 1.297 10.371 ↑ 503.5 2 1

HashAggregate (cost=5,107.65..5,135.35 rows=1,007 width=96) (actual time=10.368..10.371 rows=2 loops=1)

  • 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. 1.427 9.074 ↓ 3.4 3,444 1

Hash Join (cost=346.73..5,097.58 rows=1,007 width=70) (actual time=2.890..9.074 rows=3,444 loops=1)

  • Hash Cond: (t.account_id = a.account_id)
4. 0.464 4.815 ↑ 1.1 6,910 1

Append (cost=0.70..4,715.80 rows=7,759 width=28) (actual time=0.047..4.815 rows=6,910 loops=1)

5. 4.351 4.351 ↑ 1.1 6,910 1

Index Only Scan using txdetails_p9_company_id_date_tx_date_is_no_post_tx_id_seque_idx on txdetails_p9 t (cost=0.70..4,677.00 rows=7,759 width=28) (actual time=0.046..4.351 rows=6,910 loops=1)

  • Index Cond: ((company_id = 182519665.000000000) AND (tx_date >= '2018-01-01'::date) AND (tx_date <= '2019-12-31'::date) AND (is_no_post IS NULL))
  • 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)
  • Heap Fetches: 4
6. 0.311 2.832 ↓ 39.6 1,741 1

Hash (cost=345.48..345.48 rows=44 width=13) (actual time=2.832..2.832 rows=1,741 loops=1)

  • Buckets: 2048 (originally 1024) Batches: 1 (originally 1) Memory Usage: 95kB
7. 2.521 2.521 ↓ 39.6 1,741 1

Index Scan using accounts_pk on accounts a (cost=0.56..345.48 rows=44 width=13) (actual time=0.036..2.521 rows=1,741 loops=1)

  • Index Cond: (company_id = 182519665.000000000)
  • Filter: (account_type_id = '10'::numeric)
  • Rows Removed by Filter: 130
Planning time : 1.266 ms
Execution time : 10.445 ms