explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Q9hR

Settings
# exclusive inclusive rows x rows loops node
1. 29.541 5,939.293 ↑ 6.7 235 1

Group (cost=239,249.08..239,272.80 rows=1,581 width=62) (actual time=5,898.621..5,939.293 rows=235 loops=1)

  • Group Key: d.id, ca.account_name, eo.export_status_type_id, eo.reference_id, eo.exported_on
2. 116.115 5,909.752 ↓ 33.0 52,139 1

Sort (cost=239,249.08..239,253.04 rows=1,581 width=62) (actual time=5,898.605..5,909.752 rows=52,139 loops=1)

  • Sort Key: d.id DESC, ca.account_name, eo.export_status_type_id, eo.reference_id, eo.exported_on
  • Sort Method: quicksort Memory: 8,222kB
3. 42.758 5,793.637 ↓ 33.0 52,139 1

Hash Join (cost=17,752.40..239,165.08 rows=1,581 width=62) (actual time=159.997..5,793.637 rows=52,139 loops=1)

  • Hash Cond: (d.chart_of_account_id = ca.id)
4. 590.641 5,750.512 ↓ 33.0 52,139 1

Hash Join (cost=17,739.45..239,147.92 rows=1,581 width=46) (actual time=159.608..5,750.512 rows=52,139 loops=1)

  • Hash Cond: (cp.deposit_id = d.id)
5. 634.100 5,002.837 ↓ 272.2 2,428,801 1

Gather (cost=1,000.43..222,360.98 rows=8,922 width=4) (actual time=2.509..5,002.837 rows=2,428,801 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
6. 254.234 4,368.737 ↓ 217.8 809,600 3 / 3

Nested Loop (cost=0.43..220,468.78 rows=3,718 width=4) (actual time=0.727..4,368.737 rows=809,600 loops=3)

7. 471.088 471.088 ↑ 1.3 54,379 3 / 3

Parallel Seq Scan on accounts a (cost=0.00..60,189.80 rows=67,991 width=8) (actual time=0.040..471.088 rows=54,379 loops=3)

  • Filter: (account_type_id <> ALL ('{6,8,10,14,16}'::integer[]))
  • Rows Removed by Filter: 350,055
8. 3,643.415 3,643.415 ↓ 15.0 15 163,138 / 3

Index Scan using idx_company_payments_company_account_id on company_payments cp (cost=0.43..2.35 rows=1 width=12) (actual time=0.011..0.067 rows=15 loops=163,138)

  • Index Cond: (account_id = a.id)
  • Filter: ((payment_amount >= '0'::numeric) AND (a.cid = cid))
  • Rows Removed by Filter: 1
9. 0.590 157.034 ↑ 5.9 716 1

Hash (cost=16,686.60..16,686.60 rows=4,193 width=46) (actual time=157.034..157.034 rows=716 loops=1)

  • Buckets: 8,192 Batches: 1 Memory Usage: 112kB
10. 37.629 156.444 ↑ 5.9 716 1

Hash Right Join (cost=1,959.46..16,686.60 rows=4,193 width=46) (actual time=108.936..156.444 rows=716 loops=1)

  • Hash Cond: ((eo.export_object_type_key)::integer = d.id)
  • Filter: ((d.deposit_date >= (date_trunc('month'::text, now()) - '2 mons'::interval)) OR (eo.exported_on >= (date_trunc('month'::text, now()) - '2 mons'::interval)))
  • Rows Removed by Filter: 22,949
11. 4.346 97.128 ↓ 1.0 1,395 1

Gather (cost=1,000.00..15,723.17 rows=1,380 width=26) (actual time=0.693..97.128 rows=1,395 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
12. 92.782 92.782 ↑ 1.2 465 3 / 3

Parallel Seq Scan on export_objects eo (cost=0.00..14,585.17 rows=575 width=26) (actual time=1.182..92.782 rows=465 loops=3)

  • Filter: ((export_partner_id = 1) AND (export_object_type = 'Deposit'::export_object_types))
  • Rows Removed by Filter: 210,479
13. 9.480 21.687 ↑ 1.0 23,665 1

Hash (cost=663.65..663.65 rows=23,665 width=27) (actual time=21.687..21.687 rows=23,665 loops=1)

  • Buckets: 32,768 Batches: 1 Memory Usage: 1,668kB
14. 12.207 12.207 ↑ 1.0 23,665 1

Seq Scan on deposits d (cost=0.00..663.65 rows=23,665 width=27) (actual time=0.012..12.207 rows=23,665 loops=1)

15. 0.173 0.367 ↑ 1.0 309 1

Hash (cost=9.09..9.09 rows=309 width=24) (actual time=0.367..0.367 rows=309 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 26kB
16. 0.194 0.194 ↑ 1.0 309 1

Seq Scan on chart_of_accounts ca (cost=0.00..9.09 rows=309 width=24) (actual time=0.023..0.194 rows=309 loops=1)