explain.depesz.com

PostgreSQL's explain analyze made readable

Result: uuQQ

Settings
# exclusive inclusive rows x rows loops node
1. 0.023 162.365 ↑ 1.0 93 1

Sort (cost=11,895.39..11,895.62 rows=93 width=68) (actual time=162.360..162.365 rows=93 loops=1)

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

Hash Left Join (cost=11,796.85..11,892.35 rows=93 width=68) (actual time=162.120..162.342 rows=93 loops=1)

  • Hash Cond: (((date_series.month)::double precision = base.month) AND ((date_series.year)::double precision = base.year) AND ((date_series.date_of_month)::double precision = base.date) AND (entity.item_id = base.entity_id))
3. 0.007 20.276 ↑ 1.0 93 1

Nested Loop (cost=3,033.67..3,127.69 rows=93 width=21) (actual time=20.093..20.276 rows=93 loops=1)

4. 0.274 0.274 ↑ 1.0 31 1

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

  • Filter: ((date >= '2019-01-01'::date) AND (date <= '2019-01-31'::date))
  • Rows Removed by Filter: 3,623
5. 0.021 19.995 ↑ 1.0 3 31

Materialize (cost=3,033.67..3,033.72 rows=3 width=5) (actual time=0.644..0.645 rows=3 loops=31)

6. 0.002 19.974 ↑ 1.0 3 1

Subquery Scan on entity (cost=3,033.67..3,033.71 rows=3 width=5) (actual time=19.967..19.974 rows=3 loops=1)

7. 0.006 19.972 ↑ 1.0 3 1

Limit (cost=3,033.67..3,033.68 rows=3 width=37) (actual time=19.966..19.972 rows=3 loops=1)

8. 0.008 19.966 ↑ 40.7 3 1

Sort (cost=3,033.67..3,033.98 rows=122 width=37) (actual time=19.965..19.966 rows=3 loops=1)

  • Sort Key: (sum(c.home_amount))
  • Sort Method: top-N heapsort Memory: 25kB
9. 0.170 19.958 ↑ 9.4 13 1

GroupAggregate (cost=3,029.66..3,032.10 rows=122 width=37) (actual time=19.838..19.958 rows=13 loops=1)

  • Group Key: t.item_id
10. 0.276 19.788 ↓ 7.6 932 1

Sort (cost=3,029.66..3,029.96 rows=122 width=11) (actual time=19.747..19.788 rows=932 loops=1)

  • Sort Key: t.item_id
  • Sort Method: quicksort Memory: 68kB
11. 0.627 19.512 ↓ 7.6 932 1

Nested Loop (cost=237.50..3,025.43 rows=122 width=11) (actual time=0.587..19.512 rows=932 loops=1)

12. 1.223 11.367 ↓ 4.9 1,074 1

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

  • Hash Cond: (c.account_id = a.account_id)
13. 0.734 9.642 ↓ 5.0 10,396 1

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

14. 8.908 8.908 ↓ 5.0 10,396 1

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

  • Index Cond: ((company_id = 178,348,139.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))
15. 0.022 0.502 ↓ 3.3 99 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 13kB
16. 0.480 0.480 ↓ 3.3 99 1

Index Scan using accounts_pk on accounts a (cost=0.56..235.72 rows=30 width=13) (actual time=0.030..0.480 rows=99 loops=1)

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

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

18. 7.518 7.518 ↑ 1.0 1 1,074

Index Only Scan using test_idx on txdetails_p6 t (cost=0.70..1.83 rows=1 width=23) (actual time=0.007..0.007 rows=1 loops=1,074)

  • Index Cond: ((company_id = 178,348,139.000000000) AND (is_no_post IS NULL) AND (tx_id = c.tx_id) AND (sequence = c.sequence) AND (item_id IS NOT NULL))
  • Heap Fetches: 0
19. 0.061 142.008 ↑ 11.5 159 1

Hash (cost=8,726.46..8,726.46 rows=1,836 width=61) (actual time=142.008..142.008 rows=159 loops=1)

  • Buckets: 2,048 Batches: 1 Memory Usage: 27kB
20. 0.020 141.947 ↑ 10.7 171 1

Subquery Scan on base (cost=8,671.38..8,726.46 rows=1,836 width=61) (actual time=141.861..141.947 rows=171 loops=1)

21. 5.292 141.927 ↑ 10.7 171 1

HashAggregate (cost=8,671.38..8,708.10 rows=1,836 width=61) (actual time=141.859..141.927 rows=171 loops=1)

  • Group Key: t_1.item_id, date_part('day'::text, c_1.cash_date), date_part('month'::text, c_1.cash_date), date_part('year'::text, c_1.cash_date)
22. 10.341 136.635 ↓ 6.6 12,133 1

Nested Loop (cost=237.50..8,648.43 rows=1,836 width=35) (actual time=0.582..136.635 rows=12,133 loops=1)

23. 4.869 41.363 ↓ 18.4 12,133 1

Hash Join (cost=236.80..7,420.49 rows=660 width=32) (actual time=0.557..41.363 rows=12,133 loops=1)

  • Hash Cond: (c_1.account_id = a_1.account_id)
24. 2.178 35.998 ↓ 4.3 26,873 1

Append (cost=0.70..7,167.55 rows=6,315 width=37) (actual time=0.055..35.998 rows=26,873 loops=1)

25. 33.820 33.820 ↓ 4.3 26,873 1

Index Scan using cashbasis_p6_company_id_cash_date_tx_id_sequence_idx on cashbasis_p6 c_1 (cost=0.70..7,135.97 rows=6,315 width=37) (actual time=0.055..33.820 rows=26,873 loops=1)

  • Index Cond: ((company_id = 178,348,139.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))
26. 0.019 0.496 ↓ 3.3 99 1

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

  • Buckets: 1,024 Batches: 1 Memory Usage: 13kB
27. 0.477 0.477 ↓ 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.030..0.477 rows=99 loops=1)

  • Index Cond: (company_id = 178,348,139.000000000)
  • Filter: (account_type_id = '10'::numeric)
  • Rows Removed by Filter: 283
28. 0.000 84.931 ↑ 1.0 1 12,133

Append (cost=0.70..1.83 rows=1 width=23) (actual time=0.007..0.007 rows=1 loops=12,133)

29. 84.931 84.931 ↑ 1.0 1 12,133

Index Only Scan using test_idx on txdetails_p6 t_1 (cost=0.70..1.82 rows=1 width=23) (actual time=0.007..0.007 rows=1 loops=12,133)

  • Index Cond: ((company_id = 178,348,139.000000000) AND (is_no_post IS NULL) AND (tx_id = c_1.tx_id) AND (sequence = c_1.sequence))
  • Heap Fetches: 0
Planning time : 48.075 ms
Execution time : 162.595 ms