explain.depesz.com

PostgreSQL's explain analyze made readable

Result: QpuH

Settings
# exclusive inclusive rows x rows loops node
1. 0.012 2,942.739 ↓ 1.4 10 1

Limit (cost=1,756,273.75..1,756,410.34 rows=7 width=397) (actual time=2,942.560..2,942.739 rows=10 loops=1)

2. 0.037 2,942.727 ↓ 1.4 10 1

Result (cost=1,756,273.75..1,756,410.34 rows=7 width=397) (actual time=2,942.559..2,942.727 rows=10 loops=1)

3. 0.155 2,942.510 ↓ 1.4 10 1

Sort (cost=1,756,273.75..1,756,273.77 rows=7 width=722) (actual time=2,942.508..2,942.510 rows=10 loops=1)

  • Sort Key: j1_file_id.created DESC NULLS LAST, t.id NULLS FIRST
  • Sort Method: top-N heapsort Memory: 33kB
4. 0.201 2,942.355 ↓ 12.3 86 1

Nested Loop Left Join (cost=4.90..1,756,273.66 rows=7 width=722) (actual time=165.967..2,942.355 rows=86 loops=1)

5. 0.047 2,941.982 ↓ 12.3 86 1

Nested Loop (cost=4.90..1,756,262.84 rows=7 width=199) (actual time=165.958..2,941.982 rows=86 loops=1)

6. 0.011 0.011 ↑ 1.0 1 1

Index Scan using entity_id_idx on entity tj25_entity (cost=0.00..2.02 rows=1 width=16) (actual time=0.009..0.011 rows=1 loops=1)

  • Index Cond: (id = 'ef603dce-991b-4871-b9bf-75f1c51ddad2'::uuid)
7. 0.117 2,941.924 ↓ 12.3 86 1

Nested Loop Left Join (cost=4.90..1,756,260.76 rows=7 width=215) (actual time=165.947..2,941.924 rows=86 loops=1)

8. 0.094 2,941.549 ↓ 12.3 86 1

Nested Loop Left Join (cost=4.34..1,756,221.22 rows=7 width=206) (actual time=165.935..2,941.549 rows=86 loops=1)

9. 0.000 2,941.197 ↓ 12.3 86 1

Nested Loop (cost=3.78..1,756,188.80 rows=7 width=197) (actual time=165.925..2,941.197 rows=86 loops=1)

10. 12.001 2,892.503 ↓ 21.3 26,501 1

Nested Loop Left Join (cost=3.78..1,754,143.86 rows=1,247 width=197) (actual time=0.110..2,892.503 rows=26,501 loops=1)

11. 16.166 2,774.498 ↓ 21.3 26,501 1

Nested Loop Left Join (cost=3.22..1,747,099.90 rows=1,247 width=188) (actual time=0.100..2,774.498 rows=26,501 loops=1)

12. 18.620 2,652.328 ↓ 21.3 26,501 1

Nested Loop Left Join (cost=2.66..1,741,325.35 rows=1,247 width=179) (actual time=0.092..2,652.328 rows=26,501 loops=1)

13. 15.077 2,527.704 ↓ 21.3 26,501 1

Nested Loop Left Join (cost=2.10..1,734,281.39 rows=1,247 width=170) (actual time=0.083..2,527.704 rows=26,501 loops=1)

14. 46.446 2,380.122 ↓ 21.3 26,501 1

Nested Loop Left Join (cost=1.54..1,727,237.43 rows=1,247 width=161) (actual time=0.072..2,380.122 rows=26,501 loops=1)

15. 4.861 2,227.672 ↓ 21.3 26,501 1

Nested Loop Left Join (cost=0.56..1,724,747.44 rows=1,247 width=136) (actual time=0.059..2,227.672 rows=26,501 loops=1)

16. 18.159 2,090.306 ↓ 21.3 26,501 1

Nested Loop Left Join (cost=0.00..1,718,972.89 rows=1,247 width=127) (actual time=0.051..2,090.306 rows=26,501 loops=1)

17. 248.251 1,992.644 ↓ 21.3 26,501 1

Seq Scan on document t (cost=0.00..1,716,931.07 rows=1,247 width=119) (actual time=0.044..1,992.644 rows=26,501 loops=1)

  • Filter: ((NOT deleted) AND ((SubPlan 6) = 'duplicate'::text))
  • Rows Removed by Filter: 222698
18.          

SubPlan (forSeq Scan)

19. 1,744.393 1,744.393 ↑ 5.0 1 249,199

Index Scan using field_document_id_name_idx on field field_4 (cost=0.56..6.66 rows=5 width=9) (actual time=0.007..0.007 rows=1 loops=249,199)

  • Index Cond: ((document_id = t.id) AND (name = 'type_document'::text))
20. 79.503 79.503 ↑ 1.0 1 26,501

Index Scan using file_id_idx on file j1_file_id (cost=0.00..1.64 rows=1 width=24) (actual time=0.003..0.003 rows=1 loops=26,501)

  • Index Cond: (id = t.file_id)
21. 132.505 132.505 ↑ 3.0 1 26,501

Index Scan using field_document_id_name_idx on field j10_id (cost=0.56..4.60 rows=3 width=25) (actual time=0.004..0.005 rows=1 loops=26,501)

  • Index Cond: ((document_id = t.id) AND (name = 'num_facture'::text))
22. 0.000 106.004 ↓ 0.0 0 26,501

Bitmap Heap Scan on invoice j11_id (cost=0.98..2.00 rows=1 width=41) (actual time=0.004..0.004 rows=0 loops=26,501)

  • Recheck Cond: (document_id = t.id)
  • Heap Blocks: exact=9926
23. 106.004 106.004 ↓ 0.0 0 26,501

Bitmap Index Scan on invoice_unique_in_document_id (cost=0.00..0.98 rows=1 width=0) (actual time=0.004..0.004 rows=0 loops=26,501)

  • Index Cond: (document_id = t.id)
24. 132.505 132.505 ↑ 4.0 1 26,501

Index Scan using field_document_id_name_idx on field j12_id (cost=0.56..5.61 rows=4 width=25) (actual time=0.005..0.005 rows=1 loops=26,501)

  • Index Cond: ((document_id = t.id) AND (name = 'montant_total_ttc'::text))
25. 106.004 106.004 ↑ 4.0 1 26,501

Index Scan using field_document_id_name_idx on field j13_id (cost=0.56..5.61 rows=4 width=25) (actual time=0.004..0.004 rows=1 loops=26,501)

  • Index Cond: ((document_id = t.id) AND (name = 'montant_total_ht'::text))
26. 106.004 106.004 ↑ 3.0 1 26,501

Index Scan using field_document_id_name_idx on field j14_id (cost=0.56..4.60 rows=3 width=25) (actual time=0.004..0.004 rows=1 loops=26,501)

  • Index Cond: ((document_id = t.id) AND (name = 'montant_total_tva'::text))
27. 106.004 106.004 ↑ 4.0 1 26,501

Index Scan using field_document_id_name_idx on field j15_id (cost=0.56..5.61 rows=4 width=25) (actual time=0.004..0.004 rows=1 loops=26,501)

  • Index Cond: ((document_id = t.id) AND (name = 'fournisseur'::text))
28. 53.002 53.002 ↓ 0.0 0 26,501

Index Scan using file_id_idx on file bj25_file (cost=0.00..1.64 rows=1 width=32) (actual time=0.002..0.002 rows=0 loops=26,501)

  • Index Cond: (id = t.file_id)
  • Filter: (entity_id = 'ef603dce-991b-4871-b9bf-75f1c51ddad2'::uuid)
  • Rows Removed by Filter: 1
29. 0.258 0.258 ↑ 3.0 1 86

Index Scan using field_document_id_name_idx on field j16_id (cost=0.56..4.60 rows=3 width=25) (actual time=0.003..0.003 rows=1 loops=86)

  • Index Cond: ((document_id = t.id) AND (name = 'destinataire'::text))
30. 0.258 0.258 ↑ 4.0 1 86

Index Scan using field_document_id_name_idx on field j17_id (cost=0.56..5.61 rows=4 width=25) (actual time=0.003..0.003 rows=1 loops=86)

  • Index Cond: ((document_id = t.id) AND (name = 'currency'::text))
31. 0.172 0.172 ↓ 0.0 0 86

Index Scan using invoice_id_idx on invoice i (cost=0.00..1.52 rows=1 width=501) (actual time=0.002..0.002 rows=0 loops=86)

  • Index Cond: (id = t.id)
32.          

SubPlan (forResult)

33. 0.080 0.080 ↑ 5.0 1 10

Index Scan using field_document_id_name_idx on field (cost=0.56..6.66 rows=5 width=9) (actual time=0.007..0.008 rows=1 loops=10)

  • Index Cond: ((document_id = t.id) AND (name = 'type_document'::text))
34. 0.030 0.030 ↓ 0.0 0 10

Index Scan using field_document_id_name_idx on field field_1 (cost=0.56..2.58 rows=1 width=9) (actual time=0.003..0.003 rows=0 loops=10)

  • Index Cond: ((document_id = t.id) AND (name = 'user_tag'::text))
35. 0.040 0.040 ↑ 4.0 1 10

Index Scan using field_document_id_name_idx on field field_2 (cost=0.56..5.64 rows=4 width=9) (actual time=0.004..0.004 rows=1 loops=10)

  • Index Cond: ((document_id = t.id) AND (name = 'invoice_type'::text))
36. 0.020 0.020 ↓ 0.0 0 10

Index Scan using field_document_id_name_idx on field field_3 (cost=0.56..2.58 rows=1 width=9) (actual time=0.002..0.002 rows=0 loops=10)

  • Index Cond: ((document_id = t.id) AND (name = 'comment'::text))
37. 0.010 0.010 ↓ 0.0 0 10

HashAggregate (cost=0.77..2.02 rows=100 width=32) (actual time=0.001..0.001 rows=0 loops=10)

  • Group Key: jsonb_array_elements_text(i.classification)
38. 0.000 0.000 ↓ 0.0 0 10

ProjectSet (cost=0.00..0.52 rows=100 width=32) (actual time=0.000..0.000 rows=0 loops=10)

39. 0.000 0.000 ↑ 1.0 1 10

Result (cost=0.00..0.01 rows=1 width=0) (actual time=0.000..0.000 rows=1 loops=10)

Planning time : 5.665 ms
Execution time : 2,943.029 ms