explain.depesz.com

PostgreSQL's explain analyze made readable

Result: kMeC

Settings
# exclusive inclusive rows x rows loops node
1. 0.049 76.950 ↑ 1.0 93 1

Sort (cost=12,903.34..12,903.58 rows=93 width=68) (actual time=76.946..76.950 rows=93 loops=1)

  • Sort Key: date_series.date
  • Sort Method: quicksort Memory: 29kB
2. 0.058 76.901 ↑ 1.0 93 1

Merge Right Join (cost=12,584.43..12,900.30 rows=93 width=68) (actual time=76.348..76.901 rows=93 loops=1)

  • Merge Cond: ((t.item_id = entity.item_id) AND ((date_part('day'::text, c.cash_date)) = ((date_series.date_of_month)::double precision)) AND ((date_part('month'::text, c.cash_date)) = ((date_series.month)::double precision)) AND ((date_part('year'::text, c.cash_date)) = ((date_series.year)::double precision)))
3. 0.000 57.181 ↑ 22.4 82 1

Finalize GroupAggregate (cost=9,213.90..9,476.94 rows=1,836 width=61) (actual time=56.685..57.181 rows=82 loops=1)

  • Group Key: t.item_id, (date_part('day'::text, c.cash_date)), (date_part('month'::text, c.cash_date)), (date_part('year'::text, c.cash_date))
4. 4.510 57.318 ↑ 7.1 216 1

Gather Merge (cost=9,213.90..9,417.27 rows=1,530 width=61) (actual time=56.667..57.318 rows=216 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
5. 0.775 52.808 ↑ 6.5 117 3 / 3

Partial GroupAggregate (cost=8,213.87..8,240.65 rows=765 width=61) (actual time=51.916..52.808 rows=117 loops=3)

  • Group Key: t.item_id, (date_part('day'::text, c.cash_date)), (date_part('month'::text, c.cash_date)), (date_part('year'::text, c.cash_date))
6. 2.597 52.033 ↓ 3.9 2,990 3 / 3

Sort (cost=8,213.87..8,215.79 rows=765 width=35) (actual time=51.900..52.033 rows=2,990 loops=3)

  • Sort Key: t.item_id, (date_part('day'::text, c.cash_date)), (date_part('month'::text, c.cash_date)), (date_part('year'::text, c.cash_date))
  • Sort Method: quicksort Memory: 414kB
  • Worker 0: Sort Method: quicksort Memory: 413kB
  • Worker 1: Sort Method: quicksort Memory: 411kB
7. 0.583 49.436 ↓ 5.3 4,044 3 / 3

Nested Loop (cost=366.43..8,177.23 rows=765 width=35) (actual time=3.933..49.436 rows=4,044 loops=3)

8. 1.703 12.454 ↓ 14.7 4,044 3 / 3

Hash Join (cost=365.73..7,363.83 rows=275 width=32) (actual time=3.900..12.454 rows=4,044 loops=3)

  • Hash Cond: (c.account_id = a.account_id)
9. 0.647 9.781 ↓ 3.4 8,958 3 / 3

Parallel Append (cost=129.63..7,120.71 rows=2,632 width=37) (actual time=2.812..9.781 rows=8,958 loops=3)

10. 7.249 9.134 ↓ 3.4 8,958 3 / 3

Parallel Bitmap Heap Scan on cashbasis_p6 c (cost=129.63..7,107.55 rows=2,632 width=37) (actual time=2.812..9.134 rows=8,958 loops=3)

  • Recheck Cond: ((company_id = 178348139.000000000) AND (cash_date >= '2019-01-01 00:00:00'::timestamp without time zone) AND (cash_date <= '2019-01-31 00:00:00'::timestamp without time zone))
  • Heap Blocks: exact=2477
11. 1.885 1.885 ↓ 4.3 26,873 1 / 3

Bitmap Index Scan on cashbasis_p6_company_id_cash_date_tx_id_sequence_idx (cost=0.00..128.05 rows=6,316 width=0) (actual time=5.656..5.656 rows=26,873 loops=1)

  • Index Cond: ((company_id = 178348139.000000000) AND (cash_date >= '2019-01-01 00:00:00'::timestamp without time zone) AND (cash_date <= '2019-01-31 00:00:00'::timestamp without time zone))
12. 0.022 0.970 ↓ 3.3 99 3 / 3

Hash (cost=235.72..235.72 rows=30 width=13) (actual time=0.970..0.970 rows=99 loops=3)

  • Buckets: 1024 Batches: 1 Memory Usage: 13kB
13. 0.948 0.948 ↓ 3.3 99 3 / 3

Index Scan using accounts_pk on accounts a (cost=0.56..235.72 rows=30 width=13) (actual time=0.035..0.948 rows=99 loops=3)

  • Index Cond: (company_id = 178348139.000000000)
  • Filter: (account_type_id = '10'::numeric)
  • Rows Removed by Filter: 283
14. 4.044 36.399 ↑ 1.0 1 12,133 / 3

Append (cost=0.70..2.93 rows=1 width=23) (actual time=0.008..0.009 rows=1 loops=12,133)

15. 32.355 32.355 ↑ 1.0 1 12,133 / 3

Index Scan using txdetails_p6_pkey on txdetails_p6 t (cost=0.70..2.92 rows=1 width=23) (actual time=0.008..0.008 rows=1 loops=12,133)

  • Index Cond: ((company_id = 178348139.000000000) AND (tx_id = c.tx_id) AND (sequence = c.sequence))
  • Filter: (is_no_post IS NULL)
16. 0.084 19.662 ↑ 1.0 93 1

Sort (cost=3,370.54..3,370.77 rows=93 width=21) (actual time=19.657..19.662 rows=93 loops=1)

  • Sort Key: entity.item_id, ((date_series.date_of_month)::double precision), ((date_series.month)::double precision), ((date_series.year)::double precision)
  • Sort Method: quicksort Memory: 32kB
17. 0.023 19.578 ↑ 1.0 93 1

Nested Loop (cost=3,273.48..3,367.49 rows=93 width=21) (actual time=19.392..19.578 rows=93 loops=1)

18. 0.273 0.273 ↑ 1.0 31 1

Seq Scan on date_series (cost=0.00..92.81 rows=31 width=16) (actual time=0.113..0.273 rows=31 loops=1)

  • Filter: ((date >= '2019-01-01'::date) AND (date <= '2019-01-31'::date))
  • Rows Removed by Filter: 3623
19. 0.003 19.282 ↑ 1.0 3 31

Materialize (cost=3,273.48..3,273.53 rows=3 width=5) (actual time=0.622..0.622 rows=3 loops=31)

20. 0.002 19.279 ↑ 1.0 3 1

Subquery Scan on entity (cost=3,273.48..3,273.51 rows=3 width=5) (actual time=19.276..19.279 rows=3 loops=1)

21. 0.003 19.277 ↑ 1.0 3 1

Limit (cost=3,273.48..3,273.48 rows=3 width=37) (actual time=19.275..19.277 rows=3 loops=1)

22. 0.006 19.274 ↑ 40.7 3 1

Sort (cost=3,273.48..3,273.78 rows=122 width=37) (actual time=19.274..19.274 rows=3 loops=1)

  • Sort Key: (sum(c_1.home_amount))
  • Sort Method: top-N heapsort Memory: 25kB
23. 0.179 19.268 ↑ 9.4 13 1

GroupAggregate (cost=3,269.46..3,271.90 rows=122 width=37) (actual time=19.143..19.268 rows=13 loops=1)

  • Group Key: t_1.item_id
24. 0.274 19.089 ↓ 7.6 932 1

Sort (cost=3,269.46..3,269.77 rows=122 width=11) (actual time=19.050..19.089 rows=932 loops=1)

  • Sort Key: t_1.item_id
  • Sort Method: quicksort Memory: 68kB
25. 0.464 18.815 ↓ 7.6 932 1

Nested Loop (cost=237.50..3,265.23 rows=122 width=11) (actual time=0.506..18.815 rows=932 loops=1)

26. 1.206 10.833 ↓ 4.9 1,074 1

Hash Join (cost=236.80..2,621.92 rows=219 width=24) (actual time=0.478..10.833 rows=1,074 loops=1)

  • Hash Cond: (c_1.account_id = a_1.account_id)
27. 0.739 9.216 ↓ 5.0 10,396 1

Append (cost=0.70..2,380.24 rows=2,096 width=29) (actual time=0.053..9.216 rows=10,396 loops=1)

28. 8.477 8.477 ↓ 5.0 10,396 1

Index Scan using cashbasis_p6_company_id_cash_date_tx_id_sequence_idx on cashbasis_p6 c_1 (cost=0.70..2,369.76 rows=2,096 width=29) (actual time=0.052..8.477 rows=10,396 loops=1)

  • Index Cond: ((company_id = 178348139.000000000) AND (cash_date >= '2020-01-01 00:00:00'::timestamp without time zone) AND (cash_date <= '2020-01-29 00:00:00'::timestamp without time zone))
29. 0.021 0.411 ↓ 3.3 99 1

Hash (cost=235.72..235.72 rows=30 width=13) (actual time=0.411..0.411 rows=99 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 13kB
30. 0.390 0.390 ↓ 3.3 99 1

Index Scan using accounts_pk on accounts a_1 (cost=0.56..235.72 rows=30 width=13) (actual time=0.042..0.390 rows=99 loops=1)

  • Index Cond: (company_id = 178348139.000000000)
  • Filter: (account_type_id = '10'::numeric)
  • Rows Removed by Filter: 283
31. 0.000 7.518 ↑ 1.0 1 1,074

Append (cost=0.70..2.93 rows=1 width=23) (actual time=0.007..0.007 rows=1 loops=1,074)

32. 7.518 7.518 ↑ 1.0 1 1,074

Index Scan using txdetails_p6_pkey on txdetails_p6 t_1 (cost=0.70..2.92 rows=1 width=23) (actual time=0.006..0.007 rows=1 loops=1,074)

  • Index Cond: ((company_id = 178348139.000000000) AND (tx_id = c_1.tx_id) AND (sequence = c_1.sequence))
  • Filter: ((is_no_post IS NULL) AND (item_id IS NOT NULL))
  • Rows Removed by Filter: 0
Planning time : 50.810 ms
Execution time : 77.495 ms