explain.depesz.com

PostgreSQL's explain analyze made readable

Result: JxjO

Settings
# exclusive inclusive rows x rows loops node
1. 3,803.530 103,280.117 ↓ 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=64,724.702..103,280.117 rows=10,019,768 loops=1)

  • Hash Cond: ((first(mouvementswithpool.id_account)) = plan_comptable.auto_id)
2. 1,397.838 99,476.197 ↓ 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=64,724.294..99,476.197 rows=10,019,768 loops=1)

  • Merge Cond: (ecrituresallinfo0digitfacture.id_ecritures = gap_order_invoice2.ecritures_id)
3. 2,337.046 76,642.013 ↓ 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=43,287.945..76,642.013 rows=10,019,768 loops=1)

  • Merge Cond: (ecrituresallinfo0digitfacture.id_ecritures = entriessumpooltva.ecritures_autoid)
4. 1,908.963 69,098.656 ↓ 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=38,858.593..69,098.656 rows=10,019,768 loops=1)

  • Merge Cond: (ecrituresallinfo0digitfacture.id_ecritures = mouvementswithpool_1.ecritures_id)
5. 2,799.574 62,693.407 ↓ 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=38,325.491..62,693.407 rows=10,019,768 loops=1)

  • Merge Cond: (ecrituresallinfo0digitfacture.id_ecritures = mouvementswithpool.ecritures_id)
6. 3,699.469 11,822.680 ↑ 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,860.107..11,822.680 rows=4,697,489 loops=1)

  • Sort Key: ecrituresallinfo0digitfacture.id_ecritures
  • Sort Method: external merge Disk: 733176kB
7. 415.588 8,123.211 ↑ 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.035..8,123.211 rows=4,697,489 loops=1)

8. 7,707.623 7,707.623 ↑ 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.033..7,707.623 rows=4,697,489 loops=1)

9. 1,673.935 48,071.153 ↓ 3.9 10,006,584 1

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

10. 9,558.559 46,397.218 ↓ 3.9 10,006,584 1

GroupAggregate (cost=7,836,038.36..8,575,396.56 rows=2,594,239 width=96) (actual time=27,465.374..46,397.218 rows=10,006,584 loops=1)

  • Group Key: mouvementswithpool.ecritures_id, mouvementswithpool.pool_name
11. 30,472.431 36,838.659 ↑ 1.0 25,909,859 1

Sort (cost=7,836,038.36..7,900,894.34 rows=25,942,393 width=316) (actual time=27,465.363..36,838.659 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,366.228 6,366.228 ↑ 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.967..6,366.228 rows=25,909,859 loops=1)

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

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

14. 3,553.829 4,234.049 ↓ 1.2 1,311,931 1

GroupAggregate (cost=201,040.32..243,990.55 rows=1,078,566 width=144) (actual time=533.097..4,234.049 rows=1,311,931 loops=1)

  • Group Key: mouvementswithpool_1.ecritures_id, mouvementswithpool_1.pool_name
15. 334.510 680.220 ↓ 1.0 1,371,121 1

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

  • Sort Key: mouvementswithpool_1.ecritures_id
  • Sort Method: quicksort Memory: 156271kB
16. 345.710 345.710 ↓ 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..345.710 rows=1,371,121 loops=1)

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

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

  • Sort Key: entriessumpooltva.ecritures_autoid
  • Sort Method: quicksort Memory: 217323kB
18. 172.187 3,811.306 ↓ 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,504.108..3,811.306 rows=2,539,058 loops=1)

19. 3,004.239 3,639.119 ↓ 1.3 2,539,058 1

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

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

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

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

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

23. 19,138.166 21,436.334 ↓ 0.0 0 1

HashAggregate (cost=1,510,588.75..1,513,613.90 rows=134,451 width=100) (actual time=21,436.334..21,436.334 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,298.168 2,298.168 ↑ 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,298.168 rows=27,280,980 loops=1)

25. 0.184 0.390 ↑ 1.0 1,819 1

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

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

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

Planning time : 1.530 ms