explain.depesz.com

PostgreSQL's explain analyze made readable

Result: HBrd

Settings
# exclusive inclusive rows x rows loops node
1. 0.010 2,512.027 ↓ 1.4 10 1

Limit (cost=972,542.85..972,636.45 rows=7 width=397) (actual time=2,511.845..2,512.027 rows=10 loops=1)

2. 0.058 2,512.017 ↓ 1.4 10 1

Result (cost=972,542.85..972,636.45 rows=7 width=397) (actual time=2,511.843..2,512.017 rows=10 loops=1)

3. 0.154 2,511.789 ↓ 1.4 10 1

Sort (cost=972,542.85..972,542.86 rows=7 width=722) (actual time=2,511.787..2,511.789 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.156 2,511.635 ↓ 12.0 84 1

Nested Loop Left Join (cost=4.89..972,542.75 rows=7 width=722) (actual time=154.007..2,511.635 rows=84 loops=1)

5. 0.037 2,511.227 ↓ 12.0 84 1

Nested Loop (cost=4.89..972,531.94 rows=7 width=199) (actual time=153.997..2,511.227 rows=84 loops=1)

6. 0.013 0.013 ↑ 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.011..0.013 rows=1 loops=1)

  • Index Cond: (id = 'ef603dce-991b-4871-b9bf-75f1c51ddad2'::uuid)
7. 0.107 2,511.177 ↓ 12.0 84 1

Nested Loop Left Join (cost=4.89..972,529.85 rows=7 width=215) (actual time=153.983..2,511.177 rows=84 loops=1)

8. 0.103 2,510.818 ↓ 12.0 84 1

Nested Loop Left Join (cost=4.33..972,515.41 rows=7 width=206) (actual time=153.975..2,510.818 rows=84 loops=1)

9. 0.000 2,510.463 ↓ 12.0 84 1

Nested Loop (cost=3.77..972,497.47 rows=7 width=197) (actual time=153.966..2,510.463 rows=84 loops=1)

10. 26.075 2,461.835 ↓ 21.3 26,501 1

Nested Loop Left Join (cost=3.77..970,452.53 rows=1,247 width=197) (actual time=0.139..2,461.835 rows=26,501 loops=1)

11. 27.485 2,356.257 ↓ 21.3 26,501 1

Nested Loop Left Join (cost=3.21..967,880.12 rows=1,247 width=188) (actual time=0.127..2,356.257 rows=26,501 loops=1)

12. 31.349 2,249.269 ↓ 21.3 26,501 1

Nested Loop Left Join (cost=2.66..964,683.98 rows=1,247 width=179) (actual time=0.117..2,249.269 rows=26,501 loops=1)

13. 18.152 2,138.417 ↓ 21.3 26,501 1

Nested Loop Left Join (cost=2.10..961,487.83 rows=1,247 width=170) (actual time=0.107..2,138.417 rows=26,501 loops=1)

14. 43.085 2,014.261 ↓ 21.3 26,501 1

Nested Loop Left Join (cost=1.54..958,291.69 rows=1,247 width=161) (actual time=0.098..2,014.261 rows=26,501 loops=1)

15. 18.100 1,865.172 ↓ 21.3 26,501 1

Nested Loop Left Join (cost=0.56..955,801.70 rows=1,247 width=136) (actual time=0.079..1,865.172 rows=26,501 loops=1)

16. 14.030 1,741.068 ↓ 21.3 26,501 1

Nested Loop Left Join (cost=0.00..952,605.56 rows=1,247 width=127) (actual time=0.067..1,741.068 rows=26,501 loops=1)

17. 152.353 1,647.535 ↓ 21.3 26,501 1

Seq Scan on document t (cost=0.00..950,563.73 rows=1,247 width=119) (actual time=0.058..1,647.535 rows=26,501 loops=1)

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

SubPlan (forSeq Scan)

19. 1,495.182 1,495.182 ↑ 2.0 1 249,197

Index Scan using field_unique_in_document on field field_4 (cost=0.56..3.59 rows=2 width=9) (actual time=0.005..0.006 rows=1 loops=249,197)

  • 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. 106.004 106.004 ↑ 1.0 1 26,501

Index Scan using field_unique_in_document on field j10_id (cost=0.56..2.56 rows=1 width=25) (actual time=0.004..0.004 rows=1 loops=26,501)

  • Index Cond: ((document_id = t.id) AND (name = 'num_facture'::text))
22. 26.501 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. 79.503 79.503 ↓ 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.003..0.003 rows=0 loops=26,501)

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

Index Scan using field_unique_in_document on field j12_id (cost=0.56..2.56 rows=1 width=25) (actual time=0.004..0.004 rows=1 loops=26,501)

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

Index Scan using field_unique_in_document on field j13_id (cost=0.56..2.56 rows=1 width=25) (actual time=0.003..0.003 rows=1 loops=26,501)

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

Index Scan using field_unique_in_document on field j14_id (cost=0.56..2.56 rows=1 width=25) (actual time=0.003..0.003 rows=1 loops=26,501)

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

Index Scan using field_unique_in_document on field j15_id (cost=0.56..3.57 rows=2 width=25) (actual time=0.003..0.003 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.252 0.252 ↑ 1.0 1 84

Index Scan using field_unique_in_document on field j16_id (cost=0.56..2.56 rows=1 width=25) (actual time=0.003..0.003 rows=1 loops=84)

  • Index Cond: ((document_id = t.id) AND (name = 'destinataire'::text))
30. 0.252 0.252 ↑ 2.0 1 84

Index Scan using field_unique_in_document on field j17_id (cost=0.56..3.57 rows=2 width=25) (actual time=0.003..0.003 rows=1 loops=84)

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

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

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

SubPlan (forResult)

33. 0.060 0.060 ↑ 2.0 1 10

Index Scan using field_unique_in_document on field (cost=0.56..3.59 rows=2 width=9) (actual time=0.006..0.006 rows=1 loops=10)

  • Index Cond: ((document_id = t.id) AND (name = 'type_document'::text))
34. 0.030 0.030 ↑ 1.0 1 10

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

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

Index Scan using field_unique_in_document on field field_2 (cost=0.56..2.58 rows=1 width=9) (actual time=0.003..0.003 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_unique_in_document 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.030 ↓ 0.0 0 10

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

  • Group Key: jsonb_array_elements_text(i.classification)
38. 0.020 0.020 ↑ 100.0 1 10

ProjectSet (cost=0.00..0.52 rows=100 width=32) (actual time=0.001..0.002 rows=1 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 : 9.258 ms
Execution time : 2,512.405 ms