explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 5ggD : Teste

Settings
# exclusive inclusive rows x rows loops node
1. 0.556 1,118,954.838 ↓ 1.0 2,701 1

Unique (cost=95,268,576.86..95,268,590.07 rows=2,642 width=255) (actual time=1,118,954.039..1,118,954.838 rows=2,701 loops=1)

2. 6.130 1,118,954.282 ↓ 1.9 5,083 1

Sort (cost=95,268,576.86..95,268,583.47 rows=2,642 width=255) (actual time=1,118,954.038..1,118,954.282 rows=5,083 loops=1)

  • Sort Key: ai.id, (max(assets_transaction.date)) DESC
  • Sort Method: quicksort Memory: 2,791kB
3. 34,683.540 1,118,948.152 ↓ 1.9 5,083 1

Merge Join (cost=69,891,375.46..95,268,426.70 rows=2,642 width=255) (actual time=1,118,941.175..1,118,948.152 rows=5,083 loops=1)

  • Merge Cond: (assets_transaction.installment_id = ai.id)
4. 156,734.544 1,084,234.263 ↓ 7.0 565,212,465 1

Finalize GroupAggregate (cost=69,777,399.70..94,145,466.70 rows=80,715,569 width=16) (actual time=692,952.678..1,084,234.263 rows=565,212,465 loops=1)

  • Group Key: assets_transaction.installment_id, assets_transaction.balance
5. 133,471.335 927,499.719 ↓ 3.6 588,745,230 1

Gather Merge (cost=69,777,399.70..92,127,577.48 rows=161,431,138 width=16) (actual time=692,952.667..927,499.719 rows=588,745,230 loops=1)

  • Workers Planned: 2
  • Workers Launched: 2
6. 57,336.260 794,028.384 ↓ 2.4 196,249,129 3 / 3

Partial GroupAggregate (cost=69,776,399.68..73,493,418.62 rows=80,715,569 width=16) (actual time=690,317.091..794,028.384 rows=196,249,129 loops=3)

  • Group Key: assets_transaction.installment_id, assets_transaction.balance
7. 484,852.839 736,692.124 ↑ 1.3 217,113,138 3 / 3

Sort (cost=69,776,399.68..70,503,865.49 rows=290,986,325 width=16) (actual time=690,317.079..736,692.124 rows=217,113,138 loops=3)

  • Sort Key: assets_transaction.installment_id, assets_transaction.balance
  • Sort Method: external merge Disk: 6,410,880kB
  • Worker 0: Sort Method: external merge Disk: 6,329,728kB
  • Worker 1: Sort Method: external merge Disk: 6,381,504kB
8. 251,839.285 251,839.285 ↑ 1.3 217,139,724 3 / 3

Parallel Seq Scan on assets_transaction (cost=0.00..13,950,258.89 rows=290,986,325 width=16) (actual time=0.138..251,839.285 rows=217,139,724 loops=3)

  • Filter: (date <= '2020-07-01'::date)
  • Rows Removed by Filter: 47,534,561
9. 2.743 30.349 ↓ 6.1 5,082 1

Sort (cost=113,975.76..113,977.85 rows=839 width=243) (actual time=29.824..30.349 rows=5,082 loops=1)

  • Sort Key: ai.id
  • Sort Method: quicksort Memory: 1,480kB
10. 6.219 27.606 ↓ 3.2 2,701 1

Gather (cost=1,581.48..113,935.01 rows=839 width=243) (actual time=4.765..27.606 rows=2,701 loops=1)

  • Workers Planned: 1
  • Workers Launched: 1
11. 0.510 21.387 ↓ 2.7 1,350 2 / 2

Hash Left Join (cost=581.48..112,851.11 rows=494 width=243) (actual time=3.875..21.387 rows=1,350 loops=2)

  • Hash Cond: (aa.assignor_id = cc.id)
12. 0.472 20.559 ↓ 2.7 1,350 2 / 2

Hash Join (cost=563.19..112,831.52 rows=494 width=197) (actual time=3.531..20.559 rows=1,350 loops=2)

  • Hash Cond: (aa.type_id = assets_assettype.id)
13. 0.850 20.037 ↓ 2.7 1,350 2 / 2

Nested Loop (cost=561.02..112,827.94 rows=494 width=167) (actual time=3.428..20.037 rows=1,350 loops=2)

14. 0.473 16.486 ↓ 2.7 1,350 2 / 2

Hash Join (cost=560.59..109,014.81 rows=494 width=136) (actual time=3.392..16.486 rows=1,350 loops=2)

  • Hash Cond: (aa.operation_id = oo.id)
15. 0.847 13.394 ↓ 2.7 1,350 2 / 2

Nested Loop (cost=113.56..108,566.49 rows=494 width=137) (actual time=0.729..13.394 rows=1,350 loops=2)

16. 2.692 3.230 ↑ 1.3 847 2 / 2

Parallel Bitmap Heap Scan on assets_asset aa (cost=113.00..8,217.57 rows=1,102 width=46) (actual time=0.613..3.230 rows=847 loops=2)

  • Recheck Cond: (fund_id = 19)
  • Filter: (date_cession <= '2020-07-01'::date)
  • Rows Removed by Filter: 26
  • Heap Blocks: exact=330
17. 0.538 0.538 ↑ 1.2 1,745 1 / 2

Bitmap Index Scan on assets_asset_fund_id_d7e7b3b5 (cost=0.00..112.53 rows=2,129 width=0) (actual time=1.077..1.077 rows=1,745 loops=1)

  • Index Cond: (fund_id = 19)
18. 9.317 9.317 ↑ 5.5 2 1,694 / 2

Index Scan using assets_installment_asset_id_9406a2a0 on assets_installment ai (cost=0.56..90.95 rows=11 width=99) (actual time=0.008..0.011 rows=2 loops=1,694)

  • Index Cond: (asset_id = aa.id)
  • Filter: ((date_done IS NULL) OR (date_done > '2020-07-01'::date))
  • Rows Removed by Filter: 0
19. 0.547 2.619 ↓ 1.0 2,999 2 / 2

Hash (cost=409.79..409.79 rows=2,979 width=7) (actual time=2.619..2.619 rows=2,999 loops=2)

  • Buckets: 4,096 Batches: 1 Memory Usage: 150kB
20. 2.072 2.072 ↓ 1.0 2,999 2 / 2

Seq Scan on operations_operation oo (cost=0.00..409.79 rows=2,979 width=7) (actual time=0.018..2.072 rows=2,999 loops=2)

21. 2.701 2.701 ↑ 1.0 1 2,701 / 2

Index Scan using debtors_debtor_pkey on debtors_debtor dd (cost=0.43..7.72 rows=1 width=39) (actual time=0.002..0.002 rows=1 loops=2,701)

  • Index Cond: (id = aa.debtor_id)
22. 0.011 0.050 ↓ 1.0 53 2 / 2

Hash (cost=1.52..1.52 rows=52 width=38) (actual time=0.050..0.050 rows=53 loops=2)

  • Buckets: 1,024 Batches: 1 Memory Usage: 11kB
23. 0.039 0.039 ↓ 1.0 53 2 / 2

Seq Scan on assets_assettype (cost=0.00..1.52 rows=52 width=38) (actual time=0.032..0.039 rows=53 loops=2)

24. 0.146 0.318 ↓ 1.0 422 2 / 2

Hash (cost=13.13..13.13 rows=413 width=54) (actual time=0.318..0.318 rows=422 loops=2)

  • Buckets: 1,024 Batches: 1 Memory Usage: 45kB
25. 0.172 0.172 ↓ 1.0 422 2 / 2

Seq Scan on companies_company cc (cost=0.00..13.13 rows=413 width=54) (actual time=0.024..0.172 rows=422 loops=2)