explain.depesz.com

PostgreSQL's explain analyze made readable

Result: ijPk

Settings
# exclusive inclusive rows x rows loops node
1. 2,023.325 108,214.865 ↓ 2.1 10,019,768 1

Merge Left Join (cost=12,252,527.30..12,511,210.89 rows=4,697,571 width=457) (actual time=93,238.291..108,214.865 rows=10,019,768 loops=1)

  • Merge Cond: (ecrituresallinfo0digitfacture.id_ecritures = gap_order_invoice2.ecritures_id)
2. 2,024.152 85,379.281 ↓ 2.1 10,019,768 1

Merge Left Join (cost=10,726,115.88..10,912,319.14 rows=4,697,571 width=393) (actual time=72,426.024..85,379.281 rows=10,019,768 loops=1)

  • Merge Cond: (ecrituresallinfo0digitfacture.id_ecritures = entriessumpooltva.ecritures_autoid)
3. 1,753.312 78,288.287 ↓ 2.1 10,019,768 1

Merge Left Join (cost=10,274,462.71..10,418,522.46 rows=4,697,571 width=361) (actual time=68,002.303..78,288.287 rows=10,019,768 loops=1)

  • Merge Cond: (ecrituresallinfo0digitfacture.id_ecritures = mouvementswithpool_1.ecritures_id)
4. 2,719.077 72,405.992 ↓ 2.1 10,019,768 1

Merge Left Join (cost=10,073,422.39..10,135,823.83 rows=4,697,571 width=261) (actual time=67,497.884..72,405.992 rows=10,019,768 loops=1)

  • Merge Cond: (ecrituresallinfo0digitfacture.id_ecritures = mouvementswithpool.ecritures_id)
5. 3,605.169 11,818.160 ↑ 1.0 4,697,489 1

Sort (cost=1,159,967.04..1,171,710.96 rows=4,697,571 width=187) (actual time=10,971.566..11,818.160 rows=4,697,489 loops=1)

  • Sort Key: ecrituresallinfo0digitfacture.id_ecritures
  • Sort Method: external merge Disk: 733,176kB
6. 429.685 8,212.991 ↑ 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,212.991 rows=4,697,489 loops=1)

7. 7,783.306 7,783.306 ↑ 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.037..7,783.306 rows=4,697,489 loops=1)

8. 9,731.607 57,868.755 ↓ 3.9 10,006,584 1

Sort (cost=8,913,455.36..8,919,940.95 rows=2,594,239 width=78) (actual time=56,526.310..57,868.755 rows=10,006,584 loops=1)

  • Sort Key: mouvementswithpool.ecritures_id
  • Sort Method: external sort Disk: 683,280kB
9. 1,797.907 48,137.148 ↓ 3.9 10,006,584 1

Hash Left Join (cost=8,549,524.10..8,637,079.66 rows=2,594,239 width=78) (actual time=41,391.624..48,137.148 rows=10,006,584 loops=1)

  • Hash Cond: ((first(mouvementswithpool.id_account)) = plan_comptable.auto_id)
10. 17,422.307 46,338.852 ↓ 3.9 10,006,584 1

HashAggregate (cost=8,549,454.17..8,575,396.56 rows=2,594,239 width=96) (actual time=41,391.221..46,338.852 rows=10,006,584 loops=1)

  • Group Key: mouvementswithpool.ecritures_id, mouvementswithpool.pool_name
11. 22,371.547 28,916.545 ↑ 1.0 25,909,859 1

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

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

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

  • Filter: (pool_name IS DISTINCT FROM 'Accounts payable'::text)
  • Rows Removed by Filter: 1,371,121
13. 0.192 0.389 ↑ 1.0 1,819 1

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

  • Buckets: 2,048 Batches: 1 Memory Usage: 125kB
14. 0.197 0.197 ↑ 1.0 1,819 1

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

15. 284.323 4,128.983 ↓ 1.9 2,098,550 1

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

16. 3,222.695 3,844.660 ↓ 1.2 1,311,931 1

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

  • Group Key: mouvementswithpool_1.ecritures_id, mouvementswithpool_1.pool_name
17. 279.613 621.965 ↓ 1.0 1,371,121 1

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

  • Sort Key: mouvementswithpool_1.ecritures_id
  • Sort Method: quicksort Memory: 156,271kB
18. 342.352 342.352 ↓ 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.025..342.352 rows=1,371,121 loops=1)

  • Index Cond: (pool_name = 'Accounts payable'::text)
19. 1,256.801 5,066.842 ↓ 3.2 6,399,642 1

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

  • Sort Key: entriessumpooltva.ecritures_autoid
  • Sort Method: quicksort Memory: 217,323kB
20. 182.523 3,810.041 ↓ 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,488.266..3,810.041 rows=2,539,058 loops=1)

21. 2,974.004 3,627.518 ↓ 1.3 2,539,058 1

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

  • Group Key: mouvementswithpool_2.ecritures_id, mouvementswithpool_2.pool_name
22. 653.514 653.514 ↓ 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.019..653.514 rows=3,507,276 loops=1)

  • Index Cond: (pool_name = 'VAT'::text)
23. 0.011 20,812.259 ↓ 0.0 0 1

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

  • Sort Key: gap_order_invoice2.ecritures_id
  • Sort Method: quicksort Memory: 25kB
24. 0.001 20,812.248 ↓ 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=20,812.248..20,812.248 rows=0 loops=1)

25. 18,628.007 20,812.247 ↓ 0.0 0 1

HashAggregate (cost=1,510,588.75..1,513,613.90 rows=134,451 width=100) (actual time=20,812.247..20,812.247 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: 4,697,489
26. 2,184.240 2,184.240 ↑ 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.010..2,184.240 rows=27,280,980 loops=1)