explain.depesz.com

PostgreSQL's explain analyze made readable

Result: nDlW

Settings
# exclusive inclusive rows x rows loops node
1. 0.025 95,627.916 ↓ 0.0 0 1

Sort (cost=5,514,921.38..5,514,921.61 rows=93 width=68) (actual time=95,627.916..95,627.916 rows=0 loops=1)

  • Sort Key: date_series.date
  • Sort Method: quicksort Memory: 25kB
2. 0.002 95,627.891 ↓ 0.0 0 1

Merge Right Join (cost=5,508,570.43..5,514,918.33 rows=93 width=68) (actual time=95,627.891..95,627.891 rows=0 loops=1)

  • Merge Cond: ((t.item_id = entity.item_id) AND ((date_part('day'::text, (date(c.cash_date))::timestamp without time zone)) = ((date_series.date_of_month)::double precision)) AND ((date_part('month'::text, (date(c.cash_date))::timestamp without time zone)) = ((date_series.month)::double precision)) AND ((date_part('year'::text, (date(c.cash_date))::timestamp without time zone)) = ((date_series.year)::double precision)))
3. 0.000 40,468.166 ↓ 0.0 0 1

Finalize GroupAggregate (cost=3,622,451.90..3,627,893.60 rows=32,868 width=61) (actual time=40,468.166..40,468.166 rows=0 loops=1)

  • Group Key: t.item_id, (date_part('day'::text, (date(c.cash_date))::timestamp without time zone)), (date_part('month'::text, (date(c.cash_date))::timestamp without time zone)), (date_part('year'::text, (date(c.cash_date))::timestamp without time zone))
4. 4.810 40,468.235 ↓ 0.0 0 1

Gather Merge (cost=3,622,451.90..3,626,332.37 rows=27,390 width=61) (actual time=40,468.165..40,468.235 rows=0 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
5. 0.001 40,463.425 ↓ 0.0 0 3 / 3

Partial GroupAggregate (cost=3,621,451.87..3,622,170.86 rows=13,695 width=61) (actual time=40,463.425..40,463.425 rows=0 loops=3)

  • Group Key: t.item_id, (date_part('day'::text, (date(c.cash_date))::timestamp without time zone)), (date_part('month'::text, (date(c.cash_date))::timestamp without time zone)), (date_part('year'::text, (date(c.cash_date))::timestamp without time zone))
6. 0.026 40,463.424 ↓ 0.0 0 3 / 3

Sort (cost=3,621,451.87..3,621,486.11 rows=13,695 width=35) (actual time=40,463.424..40,463.424 rows=0 loops=3)

  • Sort Key: t.item_id, (date_part('day'::text, (date(c.cash_date))::timestamp without time zone)), (date_part('month'::text, (date(c.cash_date))::timestamp without time zone)), (date_part('year'::text, (date(c.cash_date))::timestamp without time zone))
  • Sort Method: quicksort Memory: 25kB
  • Worker 0: Sort Method: quicksort Memory: 25kB
  • Worker 1: Sort Method: quicksort Memory: 25kB
7. 0.001 40,463.398 ↓ 0.0 0 3 / 3

Nested Loop (cost=347.43..3,620,510.93 rows=13,695 width=35) (actual time=40,463.398..40,463.398 rows=0 loops=3)

8. 0.001 40,463.397 ↓ 0.0 0 3 / 3

Hash Join (cost=346.73..3,617,757.26 rows=833 width=32) (actual time=40,463.397..40,463.397 rows=0 loops=3)

  • Hash Cond: (c.account_id = a.account_id)
9. 0.001 40,463.396 ↓ 0.0 0 3 / 3

Parallel Append (cost=0.70..3,617,393.13 rows=6,807 width=37) (actual time=40,463.396..40,463.396 rows=0 loops=3)

10. 40,463.395 40,463.395 ↓ 0.0 0 3 / 3

Parallel Index Scan using cashbasis_p1_pkey on cashbasis_p1 c (cost=0.70..3,617,359.09 rows=6,807 width=37) (actual time=40,463.395..40,463.395 rows=0 loops=3)

  • Index Cond: (company_id = 109287618.000000000)
  • Filter: ((date(cash_date) >= '2019-01-01'::date) AND (date(cash_date) <= '2019-01-31'::date))
  • Rows Removed by Filter: 1529103
11. 0.000 0.000 ↓ 0.0 0 / 3

Hash (cost=345.48..345.48 rows=44 width=13) (never executed)

12. 0.000 0.000 ↓ 0.0 0 / 3

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

  • Index Cond: (company_id = 109287618.000000000)
  • Filter: (account_type_id = '10'::numeric)
13. 0.000 0.000 ↓ 0.0 0 / 3

Append (cost=0.70..2.93 rows=1 width=23) (never executed)

14. 0.000 0.000 ↓ 0.0 0 / 3

Index Scan using txdetails_p1_pkey on txdetails_p1 t (cost=0.70..2.92 rows=1 width=23) (never executed)

  • Index Cond: ((company_id = 109287618.000000000) AND (tx_id = c.tx_id) AND (sequence = c.sequence))
  • Filter: (is_no_post IS NULL)
15. 0.014 55,159.723 ↓ 0.0 0 1

Sort (cost=1,886,118.53..1,886,118.76 rows=93 width=21) (actual time=55,159.723..55,159.723 rows=0 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: 25kB
16. 0.000 55,159.709 ↓ 0.0 0 1

Nested Loop (cost=1,886,021.47..1,886,115.49 rows=93 width=21) (actual time=55,159.709..55,159.709 rows=0 loops=1)

17. 0.332 0.332 ↑ 1.0 31 1

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

  • Filter: ((date >= '2019-01-01'::date) AND (date <= '2019-01-31'::date))
  • Rows Removed by Filter: 3623
18. 0.017 55,159.385 ↓ 0.0 0 31

Materialize (cost=1,886,021.47..1,886,021.53 rows=3 width=5) (actual time=1,779.335..1,779.335 rows=0 loops=31)

19. 0.001 55,159.368 ↓ 0.0 0 1

Subquery Scan on entity (cost=1,886,021.47..1,886,021.51 rows=3 width=5) (actual time=55,159.368..55,159.368 rows=0 loops=1)

20. 0.001 55,159.367 ↓ 0.0 0 1

Limit (cost=1,886,021.47..1,886,021.48 rows=3 width=37) (actual time=55,159.367..55,159.367 rows=0 loops=1)

21. 0.004 55,159.366 ↓ 0.0 0 1

Sort (cost=1,886,021.47..1,886,025.05 rows=1,429 width=37) (actual time=55,159.366..55,159.366 rows=0 loops=1)

  • Sort Key: (sum((c_1.home_amount / '10000000'::numeric)))
  • Sort Method: quicksort Memory: 25kB
22. 0.000 55,159.362 ↓ 0.0 0 1

Finalize GroupAggregate (cost=1,885,587.06..1,886,003.00 rows=1,429 width=37) (actual time=55,159.362..55,159.362 rows=0 loops=1)

  • Group Key: t_1.item_id
23. 7.152 55,161.646 ↓ 0.0 0 1

Gather Merge (cost=1,885,587.06..1,885,963.71 rows=2,858 width=37) (actual time=55,159.361..55,161.646 rows=0 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
24. 0.001 55,154.494 ↓ 0.0 0 3 / 3

Partial GroupAggregate (cost=1,884,587.04..1,884,633.80 rows=1,429 width=37) (actual time=55,154.494..55,154.494 rows=0 loops=3)

  • Group Key: t_1.item_id
25. 0.022 55,154.493 ↓ 0.0 0 3 / 3

Sort (cost=1,884,587.04..1,884,594.26 rows=2,890 width=11) (actual time=55,154.493..55,154.493 rows=0 loops=3)

  • Sort Key: t_1.item_id
  • Sort Method: quicksort Memory: 25kB
  • Worker 0: Sort Method: quicksort Memory: 25kB
  • Worker 1: Sort Method: quicksort Memory: 25kB
26. 0.000 55,154.471 ↓ 0.0 0 3 / 3

Hash Join (cost=347.43..1,884,420.91 rows=2,890 width=11) (actual time=55,154.471..55,154.471 rows=0 loops=3)

  • Hash Cond: (c_1.account_id = a_1.account_id)
27. 0.000 55,154.471 ↓ 0.0 0 3 / 3

Nested Loop (cost=1.40..1,884,012.05 rows=23,625 width=24) (actual time=55,154.470..55,154.471 rows=0 loops=3)

28. 48.028 50,527.357 ↓ 1.4 596,764 3 / 3

Parallel Append (cost=0.70..669,356.23 rows=416,645 width=23) (actual time=1.935..50,527.357 rows=596,764 loops=3)

29. 50,479.329 50,479.329 ↓ 1.4 596,764 3 / 3

Parallel Index Only Scan using txdetails_p1_company_id_date_tx_date_is_no_post_tx_id_seque_idx on txdetails_p1 t_1 (cost=0.70..667,273.00 rows=416,645 width=23) (actual time=1.934..50,479.329 rows=596,764 loops=3)

  • Index Cond: ((company_id = 109287618.000000000) AND (is_no_post IS NULL) AND (item_id IS NOT NULL))
  • Heap Fetches: 18
30. 596.764 4,774.112 ↓ 0.0 0 1,790,292 / 3

Append (cost=0.70..2.91 rows=1 width=29) (actual time=0.008..0.008 rows=0 loops=1,790,292)

31. 4,177.348 4,177.348 ↓ 0.0 0 1,790,292 / 3

Index Scan using cashbasis_p1_pkey on cashbasis_p1 c_1 (cost=0.70..2.90 rows=1 width=29) (actual time=0.007..0.007 rows=0 loops=1,790,292)

  • Index Cond: ((company_id = 109287618.000000000) AND (tx_id = t_1.tx_id) AND (sequence = t_1.sequence))
  • Filter: ((date(cash_date) >= '2020-01-01'::date) AND (date(cash_date) <= '2020-01-29'::date))
  • Rows Removed by Filter: 1
32. 0.000 0.000 ↓ 0.0 0 / 3

Hash (cost=345.48..345.48 rows=44 width=13) (never executed)

33. 0.000 0.000 ↓ 0.0 0 / 3

Index Scan using accounts_pk on accounts a_1 (cost=0.56..345.48 rows=44 width=13) (never executed)

  • Index Cond: (company_id = 109287618.000000000)
  • Filter: (account_type_id = '10'::numeric)
Planning time : 2.865 ms
Execution time : 95,630.467 ms