explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 5SS9

Settings
# exclusive inclusive rows x rows loops node
1. 37.101 7,268.118 ↑ 6.7 235 1

Group (cost=239,249.08..239,272.80 rows=1,581 width=62) (actual time=7,218.386..7,268.118 rows=235 loops=1)

  • Group Key: d.id, ca.account_name, eo.export_status_type_id, eo.reference_id, eo.exported_on
2. 117.975 7,231.017 ↓ 33.0 52,139 1

Sort (cost=239,249.08..239,253.04 rows=1,581 width=62) (actual time=7,218.381..7,231.017 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: 8222kB
3. 41.294 7,113.042 ↓ 33.0 52,139 1

Hash Join (cost=17,752.40..239,165.08 rows=1,581 width=62) (actual time=272.508..7,113.042 rows=52,139 loops=1)

  • Hash Cond: (d.chart_of_account_id = ca.id)
4. 695.254 7,071.200 ↓ 33.0 52,139 1

Hash Join (cost=17,739.45..239,147.92 rows=1,581 width=46) (actual time=271.892..7,071.200 rows=52,139 loops=1)

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

Gather (cost=1,000.43..222,360.98 rows=8,922 width=4) (actual time=4.363..6,108.608 rows=2,428,801 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
6. 330.551 5,531.037 ↓ 217.8 809,600 3 / 3

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

7. 687.001 687.001 ↑ 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.097..687.001 rows=54,379 loops=3)

  • Filter: (account_type_id <> ALL ('{6,8,10,14,16}'::integer[]))
  • Rows Removed by Filter: 350055
8. 4,513.485 4,513.485 ↓ 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.014..0.083 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. 1.016 267.338 ↑ 5.9 716 1

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

  • Buckets: 8192 Batches: 1 Memory Usage: 112kB
10. 84.839 266.322 ↑ 5.9 716 1

Hash Right Join (cost=1,959.46..16,686.60 rows=4,193 width=46) (actual time=174.632..266.322 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: 22949
11. 3.330 135.593 ↓ 1.0 1,395 1

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

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

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

  • Filter: ((export_partner_id = 1) AND (export_object_type = 'Deposit'::export_object_types))
  • Rows Removed by Filter: 210479
13. 18.647 45.890 ↑ 1.0 23,665 1

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

  • Buckets: 32768 Batches: 1 Memory Usage: 1668kB
14. 27.243 27.243 ↑ 1.0 23,665 1

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

15. 0.259 0.548 ↑ 1.0 309 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 26kB
16. 0.289 0.289 ↑ 1.0 309 1

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

Planning time : 8.286 ms