explain.depesz.com

PostgreSQL's explain analyze made readable

Result: m2T7

Settings
# exclusive inclusive rows x rows loops node
1. 3,637.452 104,708.536 ↓ 2.1 10,019,768 1

Hash Left Join (cost=11,175,180.24..12,263,756.01 rows=4,697,571 width=457) (actual time=66,877.196..104,708.536 rows=10,019,768 loops=1)

  • Hash Cond: ((first(mouvementswithpool.id_account)) = plan_comptable.auto_id)
2. 1,374.607 101,070.698 ↓ 2.1 10,019,768 1

Merge Left Join (cost=11,175,110.31..12,140,374.85 rows=4,697,571 width=435) (actual time=66,876.792..101,070.698 rows=10,019,768 loops=1)

  • Merge Cond: (ecrituresallinfo0digitfacture.id_ecritures = gap_order_invoice2.ecritures_id)
3. 2,278.618 77,710.955 ↓ 2.1 10,019,768 1

Merge Left Join (cost=9,648,698.88..10,600,202.73 rows=4,697,571 width=371) (actual time=44,891.652..77,710.955 rows=10,019,768 loops=1)

  • Merge Cond: (ecrituresallinfo0digitfacture.id_ecritures = entriessumpooltva.ecritures_autoid)
4. 1,897.894 70,014.760 ↓ 2.1 10,019,768 1

Merge Left Join (cost=9,197,045.71..10,106,406.05 rows=4,697,571 width=339) (actual time=40,282.459..70,014.760 rows=10,019,768 loops=1)

  • Merge Cond: (ecrituresallinfo0digitfacture.id_ecritures = mouvementswithpool_1.ecritures_id)
5. 2,771.744 63,866.484 ↓ 2.1 10,019,768 1

Merge Left Join (cost=8,996,005.40..9,823,707.42 rows=4,697,571 width=239) (actual time=39,735.378..63,866.484 rows=10,019,768 loops=1)

  • Merge Cond: (ecrituresallinfo0digitfacture.id_ecritures = mouvementswithpool.ecritures_id)
6. 3,803.776 12,256.139 ↑ 1.0 4,697,489 1

Sort (cost=1,159,967.04..1,171,710.96 rows=4,697,571 width=187) (actual time=11,292.559..12,256.139 rows=4,697,489 loops=1)

  • Sort Key: ecrituresallinfo0digitfacture.id_ecritures
  • Sort Method: external merge Disk: 733176kB
7. 433.474 8,452.363 ↑ 1.0 4,697,489 1

Subquery Scan on ecrituresallinfo0digitfacture (cost=0.00..205,877.35 rows=4,697,571 width=187) (actual time=0.038..8,452.363 rows=4,697,489 loops=1)

8. 8,018.889 8,018.889 ↑ 1.0 4,697,489 1

Seq Scan on ecrituresallinfo0 (cost=0.00..158,901.64 rows=4,697,571 width=187) (actual time=0.036..8,018.889 rows=4,697,489 loops=1)

9. 1,668.290 48,838.601 ↓ 3.9 10,006,584 1

Materialize (cost=7,836,038.36..8,607,824.55 rows=2,594,239 width=56) (actual time=28,442.813..48,838.601 rows=10,006,584 loops=1)

10. 9,453.345 47,170.311 ↓ 3.9 10,006,584 1

GroupAggregate (cost=7,836,038.36..8,575,396.56 rows=2,594,239 width=96) (actual time=28,442.810..47,170.311 rows=10,006,584 loops=1)

  • Group Key: mouvementswithpool.ecritures_id, mouvementswithpool.pool_name
11. 31,012.206 37,716.966 ↑ 1.0 25,909,859 1

Sort (cost=7,836,038.36..7,900,894.34 rows=25,942,393 width=316) (actual time=28,442.800..37,716.966 rows=25,909,859 loops=1)

  • Sort Key: mouvementswithpool.ecritures_id, mouvementswithpool.pool_name, mouvementswithpool.montant_absolu DESC, mouvementswithpool.montant_signe DESC
  • Sort Method: external merge Disk: 1470688kB
12. 6,704.760 6,704.760 ↑ 1.0 25,909,859 1

Seq Scan on mouvementswithpool (cost=0.00..828,564.25 rows=25,942,393 width=316) (actual time=234.817..6,704.760 rows=25,909,859 loops=1)

  • Filter: (pool_name IS DISTINCT FROM 'Accounts payable'::text)
  • Rows Removed by Filter: 1371121
13. 265.873 4,250.382 ↓ 1.9 2,098,550 1

Materialize (cost=201,040.32..257,472.62 rows=1,078,566 width=104) (actual time=547.078..4,250.382 rows=2,098,550 loops=1)

14. 3,299.419 3,984.509 ↓ 1.2 1,311,931 1

GroupAggregate (cost=201,040.32..243,990.55 rows=1,078,566 width=144) (actual time=547.076..3,984.509 rows=1,311,931 loops=1)

  • Group Key: mouvementswithpool_1.ecritures_id, mouvementswithpool_1.pool_name
15. 329.765 685.090 ↓ 1.0 1,371,121 1

Sort (cost=201,040.32..204,386.79 rows=1,338,587 width=33) (actual time=547.050..685.090 rows=1,371,121 loops=1)

  • Sort Key: mouvementswithpool_1.ecritures_id
  • Sort Method: quicksort Memory: 156271kB
16. 355.325 355.325 ↓ 1.0 1,371,121 1

Index Scan using test_index on mouvementswithpool mouvementswithpool_1 (cost=0.56..64,823.83 rows=1,338,587 width=33) (actual time=0.022..355.325 rows=1,371,121 loops=1)

  • Index Cond: (pool_name = 'Accounts payable'::text)
17. 1,439.169 5,417.577 ↓ 3.2 6,399,642 1

Sort (cost=451,653.16..456,719.76 rows=2,026,639 width=36) (actual time=4,609.190..5,417.577 rows=6,399,642 loops=1)

  • Sort Key: entriessumpooltva.ecritures_autoid
  • Sort Method: quicksort Memory: 217323kB
18. 177.857 3,978.408 ↓ 1.3 2,539,058 1

Subquery Scan on entriessumpooltva (cost=193,756.69..239,356.07 rows=2,026,639 width=36) (actual time=2,557.748..3,978.408 rows=2,539,058 loops=1)

19. 3,153.439 3,800.551 ↓ 1.3 2,539,058 1

HashAggregate (cost=193,756.69..219,089.67 rows=2,026,639 width=44) (actual time=2,557.747..3,800.551 rows=2,539,058 loops=1)

  • Group Key: mouvementswithpool_2.ecritures_id, mouvementswithpool_2.pool_name
20. 647.112 647.112 ↓ 1.0 3,507,276 1

Index Scan using test_index on mouvementswithpool mouvementswithpool_2 (cost=0.56..167,771.55 rows=3,464,685 width=18) (actual time=0.018..647.112 rows=3,507,276 loops=1)

  • Index Cond: (pool_name = 'VAT'::text)
21. 0.009 21,985.136 ↓ 0.0 0 1

Sort (cost=1,526,411.43..1,526,747.56 rows=134,451 width=68) (actual time=21,985.136..21,985.136 rows=0 loops=1)

  • Sort Key: gap_order_invoice2.ecritures_id
  • Sort Method: quicksort Memory: 25kB
22. 0.000 21,985.127 ↓ 0.0 0 1

Subquery Scan on gap_order_invoice2 (cost=1,510,588.75..1,514,958.41 rows=134,451 width=68) (actual time=21,985.127..21,985.127 rows=0 loops=1)

23. 19,717.555 21,985.127 ↓ 0.0 0 1

HashAggregate (cost=1,510,588.75..1,513,613.90 rows=134,451 width=100) (actual time=21,985.127..21,985.127 rows=0 loops=1)

  • Group Key: mouvementswithpool_3.ecritures_id
  • Filter: ((COALESCE(sum(CASE WHEN (mouvementswithpool_3.pool_name = 'Accounts payable'::text) THEN mouvementswithpool_3.montant_signe ELSE NULL::numeric END), '0'::numeric) IS DISTINCT FROM '0'::numeric) AND (COALESCE(sum(CASE WHEN (mouvementswithpool_3.pool_name = 'Suppliers - Accrued invoices'::text) THEN mouvementswithpool_3.montant_signe ELSE NULL::numeric END), '0'::numeric) IS DISTINCT FROM '0'::numeric) AND (COALESCE(sum(CASE WHEN (mouvementswithpool_3.pool_name = 'VAT'::text) THEN mouvementswithpool_3.montant_signe ELSE NULL::numeric END), '0'::numeric) = '0'::numeric))
  • Rows Removed by Filter: 4697489
24. 2,267.572 2,267.572 ↑ 1.0 27,280,980 1

Seq Scan on mouvementswithpool mouvementswithpool_3 (cost=0.00..760,361.80 rows=27,280,980 width=18) (actual time=0.009..2,267.572 rows=27,280,980 loops=1)

25. 0.167 0.386 ↑ 1.0 1,819 1

Hash (cost=47.19..47.19 rows=1,819 width=26) (actual time=0.386..0.386 rows=1,819 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 125kB
26. 0.219 0.219 ↑ 1.0 1,819 1

Seq Scan on plan_comptable (cost=0.00..47.19 rows=1,819 width=26) (actual time=0.010..0.219 rows=1,819 loops=1)

Planning time : 1.980 ms