explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 1MUN

Settings
# exclusive inclusive rows x rows loops node
1. 0.026 76.946 ↑ 1.0 93 1

Sort (cost=14,366.90..14,367.14 rows=93 width=68) (actual time=76.942..76.946 rows=93 loops=1)

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

Merge Right Join (cost=14,008.18..14,363.86 rows=93 width=68) (actual time=76.352..76.920 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)) =
3. 0.000 57.113 ↑ 25.2 82 1

Finalize GroupAggregate (cost=10,226.26..10,522.68 rows=2,070 width=61) (actual time=56.603..57.113 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.235 57.249 ↑ 7.9 218 1

Gather Merge (cost=10,226.26..10,455.42 rows=1,724 width=61) (actual time=56.586..57.249 rows=218 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
5. 0.790 53.014 ↑ 7.4 117 3 / 3

Partial GroupAggregate (cost=9,226.23..9,256.40 rows=862 width=61) (actual time=52.090..53.014 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.608 52.224 ↓ 3.5 3,002 3 / 3

Sort (cost=9,226.23..9,228.39 rows=862 width=35) (actual time=52.073..52.224 rows=3,002 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: 413kB
  • Worker 0: Sort Method: quicksort Memory: 412kB
  • Worker 1: Sort Method: quicksort Memory: 412kB
7. 0.712 49.616 ↓ 4.7 4,044 3 / 3

Nested Loop (cost=382.16..9,184.20 rows=862 width=35) (actual time=4.043..49.616 rows=4,044 loops=3)

8. 1.728 12.505 ↓ 13.0 4,044 3 / 3

Hash Join (cost=381.46..8,267.30 rows=310 width=32) (actual time=4.013..12.505 rows=4,044 loops=3)

  • Hash Cond: (c.account_id = a.account_id)
9. 0.634 9.905 ↓ 3.0 8,958 3 / 3

Parallel Append (cost=145.37..8,023.30 rows=2,966 width=37) (actual time=2.949..9.905 rows=8,958 loops=3)

10. 7.395 9.271 ↓ 3.0 8,958 3 / 3

Parallel Bitmap Heap Scan on cashbasis_p6 c (cost=145.37..8,008.47 rows=2,966 width=37) (actual time=2.949..9.271 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=2478
11. 1.876 1.876 ↓ 3.8 26,873 1 / 3

Bitmap Index Scan on cashbasis_p6_company_id_cash_date_tx_id_sequence_idx (cost=0.00..143.59 rows=7,119 width=0) (actual time=5.629..5.629 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.872 ↓ 3.3 99 3 / 3

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

  • Buckets: 1024 Batches: 1 Memory Usage: 13kB
13. 0.850 0.850 ↓ 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.033..0.850 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.749 ↑ 1.0 93 1

Sort (cost=3,781.92..3,782.16 rows=93 width=21) (actual time=19.744..19.749 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.004 19.665 ↑ 1.0 93 1

Nested Loop (cost=3,684.87..3,778.88 rows=93 width=21) (actual time=19.489..19.665 rows=93 loops=1)

18. 0.255 0.255 ↑ 1.0 31 1

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

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

Materialize (cost=3,684.87..3,684.92 rows=3 width=5) (actual time=0.625..0.626 rows=3 loops=31)

20. 0.002 19.384 ↑ 1.0 3 1

Subquery Scan on entity (cost=3,684.87..3,684.90 rows=3 width=5) (actual time=19.381..19.384 rows=3 loops=1)

21. 0.003 19.382 ↑ 1.0 3 1

Limit (cost=3,684.87..3,684.87 rows=3 width=37) (actual time=19.380..19.382 rows=3 loops=1)

22. 0.007 19.379 ↑ 46.3 3 1

Sort (cost=3,684.87..3,685.21 rows=139 width=37) (actual time=19.379..19.379 rows=3 loops=1)

  • Sort Key: (sum(c_1.home_amount))
  • Sort Method: top-N heapsort Memory: 25kB
23. 0.161 19.372 ↑ 10.7 13 1

GroupAggregate (cost=3,680.29..3,683.07 rows=139 width=37) (actual time=19.255..19.372 rows=13 loops=1)

  • Group Key: t_1.item_id
24. 0.251 19.211 ↓ 6.7 932 1

Sort (cost=3,680.29..3,680.64 rows=139 width=11) (actual time=19.172..19.211 rows=932 loops=1)

  • Sort Key: t_1.item_id
  • Sort Method: quicksort Memory: 68kB
25. 0.603 18.960 ↓ 6.7 932 1

Nested Loop (cost=237.50..3,675.34 rows=139 width=11) (actual time=0.434..18.960 rows=932 loops=1)

26. 1.190 10.839 ↓ 4.3 1,074 1

Hash Join (cost=236.80..2,943.90 rows=249 width=24) (actual time=0.416..10.839 rows=1,074 loops=1)

  • Hash Cond: (c_1.account_id = a_1.account_id)
27. 0.802 9.285 ↓ 4.4 10,396 1

Append (cost=0.70..2,701.46 rows=2,379 width=29) (actual time=0.046..9.285 rows=10,396 loops=1)

28. 8.483 8.483 ↓ 4.4 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,689.57 rows=2,379 width=29) (actual time=0.045..8.483 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.018 0.364 ↓ 3.3 99 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 13kB
30. 0.346 0.346 ↓ 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.025..0.346 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 : 44.216 ms
Execution time : 77.398 ms