explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 5H8N

Settings
# exclusive inclusive rows x rows loops node
1. 11.979 213.562 ↑ 1.0 1 1

Result (cost=2,741.68..2,741.69 rows=1 width=16) (actual time=201.585..213.562 rows=1 loops=1)

2.          

CTE lines_to_classify

3. 0.078 213.297 ↑ 3.0 99 1

Sort (cost=2,682.84..2,683.58 rows=297 width=95) (actual time=201.321..213.297 rows=99 loops=1)

  • Sort Key: d.created, l.line_position, s.id, cla.classification_label DESC, d.id
  • Sort Method: quicksort Memory: 38kB
4. 0.590 213.219 ↑ 3.0 99 1

HashAggregate (cost=2,652.82..2,670.64 rows=297 width=95) (actual time=201.078..213.219 rows=99 loops=1)

  • Group Key: l.id, cla.classification_label, d.id, s.id, e.id
  • Filter: (COALESCE((NOT bool_or(cla.is_training)), true) AND COALESCE(((max(cla.ratio) * '100'::double precision) <= '90'::double precision), true))
  • Rows Removed by Filter: 295
5. 0.076 212.629 ↑ 3.0 394 1

Nested Loop (cost=1,000.29..2,632.03 rows=1,188 width=100) (actual time=83.324..212.629 rows=394 loops=1)

6. 1.117 1.117 ↑ 1.0 1 1

Index Scan using entity_id_idx on entity e (cost=0.00..2.22 rows=1 width=16) (actual time=1.082..1.117 rows=1 loops=1)

  • Index Cond: (id = 'c5dfd6f1-3f0b-4043-8e46-c813b62583c6'::uuid)
7. 194.578 211.436 ↑ 3.0 394 1

Gather (cost=1,000.29..2,617.93 rows=1,188 width=100) (actual time=82.239..211.436 rows=394 loops=1)

  • Workers Planned: 5
  • Workers Launched: 5
8. 0.078 16.858 ↑ 3.6 66 6 / 6

Nested Loop Left Join (cost=0.29..1,499.13 rows=238 width=100) (actual time=13.062..16.858 rows=66 loops=6)

9. 0.029 16.025 ↑ 2.8 33 6 / 6

Nested Loop (cost=0.29..1,299.08 rows=91 width=76) (actual time=13.059..16.025 rows=33 loops=6)

10. 0.010 14.428 ↑ 1.1 8 6 / 6

Nested Loop (cost=0.29..338.17 rows=9 width=72) (actual time=13.029..14.428 rows=8 loops=6)

11. 0.032 13.353 ↑ 1.1 8 6 / 6

Nested Loop (cost=0.29..320.95 rows=9 width=72) (actual time=13.027..13.353 rows=8 loops=6)

12. 0.016 13.261 ↓ 1.6 8 6 / 6

Parallel Append (cost=0.29..122.08 rows=5 width=64) (actual time=13.022..13.261 rows=8 loops=6)

13. 0.421 1.965 ↓ 3.2 45 1 / 6

Parallel Bitmap Heap Scan on invoice_202010 i_21 (cost=46.72..73.09 rows=14 width=64) (actual time=10.390..11.791 rows=45 loops=1)

  • Recheck Cond: ((entity_id = 'c5dfd6f1-3f0b-4043-8e46-c813b62583c6'::uuid) AND (exported_status = 'AVAILABLE'::text))
  • Filter: (source_file = 'pdf'::text)
  • Heap Blocks: exact=41
14. 0.002 1.544 ↓ 0.0 0 1 / 6

BitmapAnd (cost=46.72..46.72 rows=24 width=0) (actual time=9.266..9.267 rows=0 loops=1)

15. 0.116 0.116 ↓ 1.5 175 1 / 6

Bitmap Index Scan on invoice_202010_entity_id_idx (cost=0.00..4.46 rows=116 width=0) (actual time=0.697..0.697 rows=175 loops=1)

  • Index Cond: (entity_id = 'c5dfd6f1-3f0b-4043-8e46-c813b62583c6'::uuid)
16. 1.426 1.426 ↓ 2.2 4,118 1 / 6

Bitmap Index Scan on invoice_202010_exported_status_idx (cost=0.00..42.00 rows=1,896 width=0) (actual time=8.556..8.556 rows=4,118 loops=1)

  • Index Cond: (exported_status = 'AVAILABLE'::text)
17. 0.046 0.188 ↓ 0.0 0 1 / 6

Parallel Bitmap Heap Scan on invoice_202009 i_20 (cost=4.04..5.15 rows=1 width=64) (actual time=1.128..1.130 rows=0 loops=1)

  • Recheck Cond: ((entity_id = 'c5dfd6f1-3f0b-4043-8e46-c813b62583c6'::uuid) AND (exported_status = 'AVAILABLE'::text))
  • Filter: (source_file = 'pdf'::text)
18. 0.000 0.142 ↓ 0.0 0 1 / 6

BitmapAnd (cost=4.04..4.04 rows=1 width=0) (actual time=0.853..0.854 rows=0 loops=1)

19. 0.142 0.142 ↓ 0.0 0 1 / 6

Bitmap Index Scan on invoice_202009_entity_id_idx (cost=0.00..1.84 rows=44 width=0) (actual time=0.852..0.852 rows=0 loops=1)

  • Index Cond: (entity_id = 'c5dfd6f1-3f0b-4043-8e46-c813b62583c6'::uuid)
20. 0.000 0.000 ↓ 0.0 0 / 6

Bitmap Index Scan on invoice_202009_exported_status_idx (cost=0.00..1.95 rows=75 width=0) (never executed)

  • Index Cond: (exported_status = 'AVAILABLE'::text)
21. 0.298 0.298 ↓ 0.0 0 1 / 6

Parallel Index Scan using invoice_202003_exported_status_idx on invoice_202003 i_14 (cost=0.29..2.50 rows=1 width=64) (actual time=1.788..1.789 rows=0 loops=1)

  • Index Cond: (exported_status = 'AVAILABLE'::text)
  • Filter: ((source_file = 'pdf'::text) AND (entity_id = 'c5dfd6f1-3f0b-4043-8e46-c813b62583c6'::uuid))
22. 0.231 0.231 ↓ 0.0 0 1 / 6

Parallel Index Scan using invoice_202001_exported_status_idx on invoice_202001 i_12 (cost=0.29..1.40 rows=1 width=64) (actual time=1.388..1.388 rows=0 loops=1)

  • Index Cond: (exported_status = 'AVAILABLE'::text)
  • Filter: ((source_file = 'pdf'::text) AND (entity_id = 'c5dfd6f1-3f0b-4043-8e46-c813b62583c6'::uuid))
23. 0.172 0.172 ↓ 0.0 0 1 / 6

Parallel Index Scan using invoice_202002_exported_status_idx on invoice_202002 i_13 (cost=0.29..1.40 rows=1 width=64) (actual time=1.035..1.035 rows=0 loops=1)

  • Index Cond: (exported_status = 'AVAILABLE'::text)
  • Filter: ((source_file = 'pdf'::text) AND (entity_id = 'c5dfd6f1-3f0b-4043-8e46-c813b62583c6'::uuid))
24. 1.163 1.163 ↓ 0.0 0 1 / 6

Parallel Index Scan using invoice_202006_exported_status_idx on invoice_202006 i_17 (cost=0.29..4.18 rows=1 width=64) (actual time=6.979..6.979 rows=0 loops=1)

  • Index Cond: (exported_status = 'AVAILABLE'::text)
  • Filter: ((source_file = 'pdf'::text) AND (entity_id = 'c5dfd6f1-3f0b-4043-8e46-c813b62583c6'::uuid))
  • Rows Removed by Filter: 21
25. 1.736 1.736 ↓ 0.0 0 1 / 6

Parallel Index Scan using invoice_202007_exported_status_idx on invoice_202007 i_18 (cost=0.29..2.54 rows=1 width=64) (actual time=10.418..10.418 rows=0 loops=1)

  • Index Cond: (exported_status = 'AVAILABLE'::text)
  • Filter: ((source_file = 'pdf'::text) AND (entity_id = 'c5dfd6f1-3f0b-4043-8e46-c813b62583c6'::uuid))
  • Rows Removed by Filter: 28
26. 0.203 0.203 ↓ 0.0 0 1 / 6

Parallel Index Scan using invoice_201912_exported_status_idx on invoice_201912 i_11 (cost=0.29..2.50 rows=1 width=64) (actual time=1.215..1.215 rows=0 loops=1)

  • Index Cond: (exported_status = 'AVAILABLE'::text)
  • Filter: ((source_file = 'pdf'::text) AND (entity_id = 'c5dfd6f1-3f0b-4043-8e46-c813b62583c6'::uuid))
  • Rows Removed by Filter: 1
27. 1.131 1.131 ↓ 0.0 0 1 / 6

Parallel Index Scan using invoice_202005_exported_status_idx on invoice_202005 i_16 (cost=0.29..2.50 rows=1 width=64) (actual time=6.789..6.789 rows=0 loops=1)

  • Index Cond: (exported_status = 'AVAILABLE'::text)
  • Filter: ((source_file = 'pdf'::text) AND (entity_id = 'c5dfd6f1-3f0b-4043-8e46-c813b62583c6'::uuid))
28. 3.084 3.084 ↓ 0.0 0 1 / 6

Parallel Index Scan using invoice_202008_exported_status_idx on invoice_202008 i_19 (cost=0.29..2.50 rows=1 width=64) (actual time=18.501..18.501 rows=0 loops=1)

  • Index Cond: (exported_status = 'AVAILABLE'::text)
  • Filter: ((source_file = 'pdf'::text) AND (entity_id = 'c5dfd6f1-3f0b-4043-8e46-c813b62583c6'::uuid))
  • Rows Removed by Filter: 2
29. 0.069 0.069 ↓ 0.0 0 1 / 6

Parallel Index Scan using invoice_201911_exported_status_idx on invoice_201911 i_10 (cost=0.29..1.40 rows=1 width=64) (actual time=0.413..0.413 rows=0 loops=1)

  • Index Cond: (exported_status = 'AVAILABLE'::text)
  • Filter: ((source_file = 'pdf'::text) AND (entity_id = 'c5dfd6f1-3f0b-4043-8e46-c813b62583c6'::uuid))
30. 0.147 0.147 ↓ 0.0 0 1 / 6

Parallel Index Scan using invoice_202004_exported_status_idx on invoice_202004 i_15 (cost=0.29..1.40 rows=1 width=64) (actual time=0.885..0.885 rows=0 loops=1)

  • Index Cond: (exported_status = 'AVAILABLE'::text)
  • Filter: ((source_file = 'pdf'::text) AND (entity_id = 'c5dfd6f1-3f0b-4043-8e46-c813b62583c6'::uuid))
31. 0.266 0.266 ↓ 0.0 0 1 / 6

Parallel Index Scan using invoice_201909_exported_status_idx on invoice_201909 i_8 (cost=0.28..2.50 rows=1 width=64) (actual time=1.597..1.597 rows=0 loops=1)

  • Index Cond: (exported_status = 'AVAILABLE'::text)
  • Filter: ((source_file = 'pdf'::text) AND (entity_id = 'c5dfd6f1-3f0b-4043-8e46-c813b62583c6'::uuid))
32. 0.302 0.302 ↓ 0.0 0 1 / 6

Parallel Index Scan using invoice_201910_exported_status_idx on invoice_201910 i_9 (cost=0.28..2.50 rows=1 width=64) (actual time=1.812..1.812 rows=0 loops=1)

  • Index Cond: (exported_status = 'AVAILABLE'::text)
  • Filter: ((source_file = 'pdf'::text) AND (entity_id = 'c5dfd6f1-3f0b-4043-8e46-c813b62583c6'::uuid))
33. 0.981 0.981 ↓ 0.0 0 1 / 6

Parallel Index Scan using invoice_201907_exported_status_idx on invoice_201907 i_6 (cost=0.28..1.40 rows=1 width=64) (actual time=5.885..5.885 rows=0 loops=1)

  • Index Cond: (exported_status = 'AVAILABLE'::text)
  • Filter: ((source_file = 'pdf'::text) AND (entity_id = 'c5dfd6f1-3f0b-4043-8e46-c813b62583c6'::uuid))
34. 1.036 1.036 ↓ 0.0 0 1 / 6

Parallel Index Scan using invoice_201905_exported_status_idx on invoice_201905 i_4 (cost=0.28..1.40 rows=1 width=64) (actual time=6.216..6.217 rows=0 loops=1)

  • Index Cond: (exported_status = 'AVAILABLE'::text)
  • Filter: ((source_file = 'pdf'::text) AND (entity_id = 'c5dfd6f1-3f0b-4043-8e46-c813b62583c6'::uuid))
35. 0.061 0.061 ↓ 0.0 0 1 / 6

Parallel Index Scan using invoice_201906_exported_status_idx on invoice_201906 i_5 (cost=0.28..1.40 rows=1 width=64) (actual time=0.368..0.368 rows=0 loops=1)

  • Index Cond: (exported_status = 'AVAILABLE'::text)
  • Filter: ((source_file = 'pdf'::text) AND (entity_id = 'c5dfd6f1-3f0b-4043-8e46-c813b62583c6'::uuid))
36. 0.070 0.070 ↓ 0.0 0 1 / 6

Parallel Index Scan using invoice_201908_exported_status_idx on invoice_201908 i_7 (cost=0.28..1.40 rows=1 width=64) (actual time=0.418..0.418 rows=0 loops=1)

  • Index Cond: (exported_status = 'AVAILABLE'::text)
  • Filter: ((source_file = 'pdf'::text) AND (entity_id = 'c5dfd6f1-3f0b-4043-8e46-c813b62583c6'::uuid))
37. 0.040 0.040 ↓ 0.0 0 1 / 6

Parallel Index Scan using invoice_201901_exported_status_idx on invoice_201901 i_1 (cost=0.28..1.39 rows=1 width=64) (actual time=0.242..0.242 rows=0 loops=1)

  • Index Cond: (exported_status = 'AVAILABLE'::text)
  • Filter: ((source_file = 'pdf'::text) AND (entity_id = 'c5dfd6f1-3f0b-4043-8e46-c813b62583c6'::uuid))
38. 0.054 0.054 ↓ 0.0 0 1 / 6

Parallel Index Scan using invoice_201902_exported_status_idx on invoice_201902 i_2 (cost=0.28..1.39 rows=1 width=64) (actual time=0.326..0.326 rows=0 loops=1)

  • Index Cond: (exported_status = 'AVAILABLE'::text)
  • Filter: ((source_file = 'pdf'::text) AND (entity_id = 'c5dfd6f1-3f0b-4043-8e46-c813b62583c6'::uuid))
39. 0.001 0.001 ↓ 0.0 0 1 / 6

Parallel Index Scan using invoice_167001_exported_status_idx on invoice_167001 i (cost=0.14..2.36 rows=1 width=64) (actual time=0.003..0.003 rows=0 loops=1)

  • Index Cond: (exported_status = 'AVAILABLE'::text)
  • Filter: ((source_file = 'pdf'::text) AND (entity_id = 'c5dfd6f1-3f0b-4043-8e46-c813b62583c6'::uuid))
40. 0.001 0.001 ↓ 0.0 0 1 / 6

Parallel Index Scan using invoice_202011_exported_status_idx on invoice_202011 i_22 (cost=0.14..2.36 rows=1 width=64) (actual time=0.003..0.003 rows=0 loops=1)

  • Index Cond: (exported_status = 'AVAILABLE'::text)
  • Filter: ((source_file = 'pdf'::text) AND (entity_id = 'c5dfd6f1-3f0b-4043-8e46-c813b62583c6'::uuid))
41. 0.001 0.001 ↓ 0.0 0 1 / 6

Parallel Index Scan using invoice_default_entity_id on invoice_default i_23 (cost=0.14..2.36 rows=1 width=64) (actual time=0.004..0.005 rows=0 loops=1)

  • Index Cond: (entity_id = 'c5dfd6f1-3f0b-4043-8e46-c813b62583c6'::uuid)
  • Filter: ((source_file = 'pdf'::text) AND (exported_status = 'AVAILABLE'::text))
42. 0.044 0.044 ↓ 0.0 0 1 / 6

Parallel Seq Scan on invoice_201903 i_3 (cost=0.00..1.02 rows=1 width=64) (actual time=0.262..0.262 rows=0 loops=1)

  • Filter: ((source_file = 'pdf'::text) AND (exported_status = 'AVAILABLE'::text) AND (entity_id = 'c5dfd6f1-3f0b-4043-8e46-c813b62583c6'::uuid))
  • Rows Removed by Filter: 2
43. 0.015 0.060 ↑ 24.0 1 45 / 6

Append (cost=0.00..39.53 rows=24 width=24) (actual time=0.007..0.008 rows=1 loops=45)

44. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using document_167001_id_idx on document_167001 d (cost=0.00..0.14 rows=1 width=24) (never executed)

  • Index Cond: (id = i_21.document_id)
  • Filter: (((status)::text <> ALL ('{IGNORED,ERRORED}'::text[])) AND (error_status = 'VALIDATED'::text))
45. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using document_201901_id_idx on document_201901 d_1 (cost=0.00..1.24 rows=1 width=24) (never executed)

  • Index Cond: (id = i_21.document_id)
  • Filter: (((status)::text <> ALL ('{IGNORED,ERRORED}'::text[])) AND (error_status = 'VALIDATED'::text))
46. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using document_201902_id_idx on document_201902 d_2 (cost=0.00..1.22 rows=1 width=24) (never executed)

  • Index Cond: (id = i_21.document_id)
  • Filter: (((status)::text <> ALL ('{IGNORED,ERRORED}'::text[])) AND (error_status = 'VALIDATED'::text))
47. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using document_201903_id_idx on document_201903 d_3 (cost=0.00..0.72 rows=1 width=24) (never executed)

  • Index Cond: (id = i_21.document_id)
  • Filter: (((status)::text <> ALL ('{IGNORED,ERRORED}'::text[])) AND (error_status = 'VALIDATED'::text))
48. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using document_201905_id_idx on document_201905 d_4 (cost=0.00..1.50 rows=1 width=24) (never executed)

  • Index Cond: (id = i_21.document_id)
  • Filter: (((status)::text <> ALL ('{IGNORED,ERRORED}'::text[])) AND (error_status = 'VALIDATED'::text))
49. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using document_201906_id_idx on document_201906 d_5 (cost=0.00..1.75 rows=1 width=24) (never executed)

  • Index Cond: (id = i_21.document_id)
  • Filter: (((status)::text <> ALL ('{IGNORED,ERRORED}'::text[])) AND (error_status = 'VALIDATED'::text))
50. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using document_201907_id_idx on document_201907 d_6 (cost=0.00..1.94 rows=1 width=24) (never executed)

  • Index Cond: (id = i_21.document_id)
  • Filter: (((status)::text <> ALL ('{IGNORED,ERRORED}'::text[])) AND (error_status = 'VALIDATED'::text))
51. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using document_201908_id_idx on document_201908 d_7 (cost=0.00..1.75 rows=1 width=24) (never executed)

  • Index Cond: (id = i_21.document_id)
  • Filter: (((status)::text <> ALL ('{IGNORED,ERRORED}'::text[])) AND (error_status = 'VALIDATED'::text))
52. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using document_201909_id_idx on document_201909 d_8 (cost=0.00..1.78 rows=1 width=24) (never executed)

  • Index Cond: (id = i_21.document_id)
  • Filter: (((status)::text <> ALL ('{IGNORED,ERRORED}'::text[])) AND (error_status = 'VALIDATED'::text))
53. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using document_201910_id_idx on document_201910 d_9 (cost=0.00..1.94 rows=1 width=24) (never executed)

  • Index Cond: (id = i_21.document_id)
  • Filter: (((status)::text <> ALL ('{IGNORED,ERRORED}'::text[])) AND (error_status = 'VALIDATED'::text))
54. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using document_201911_id_idx on document_201911 d_10 (cost=0.00..1.94 rows=1 width=24) (never executed)

  • Index Cond: (id = i_21.document_id)
  • Filter: (((status)::text <> ALL ('{IGNORED,ERRORED}'::text[])) AND (error_status = 'VALIDATED'::text))
55. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using document_201912_id_idx on document_201912 d_11 (cost=0.00..2.06 rows=1 width=24) (never executed)

  • Index Cond: (id = i_21.document_id)
  • Filter: (((status)::text <> ALL ('{IGNORED,ERRORED}'::text[])) AND (error_status = 'VALIDATED'::text))
56. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using document_202001_id_idx on document_202001 d_12 (cost=0.00..2.06 rows=1 width=24) (never executed)

  • Index Cond: (id = i_21.document_id)
  • Filter: (((status)::text <> ALL ('{IGNORED,ERRORED}'::text[])) AND (error_status = 'VALIDATED'::text))
57. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using document_202002_id_idx on document_202002 d_13 (cost=0.00..2.06 rows=1 width=24) (never executed)

  • Index Cond: (id = i_21.document_id)
  • Filter: (((status)::text <> ALL ('{IGNORED,ERRORED}'::text[])) AND (error_status = 'VALIDATED'::text))
58. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using document_202003_id_idx on document_202003 d_14 (cost=0.00..2.15 rows=1 width=24) (never executed)

  • Index Cond: (id = i_21.document_id)
  • Filter: (((status)::text <> ALL ('{IGNORED,ERRORED}'::text[])) AND (error_status = 'VALIDATED'::text))
59. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using document_202004_id_idx on document_202004 d_15 (cost=0.00..1.94 rows=1 width=24) (never executed)

  • Index Cond: (id = i_21.document_id)
  • Filter: (((status)::text <> ALL ('{IGNORED,ERRORED}'::text[])) AND (error_status = 'VALIDATED'::text))
60. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using document_202005_id_idx on document_202005 d_16 (cost=0.00..2.06 rows=1 width=24) (never executed)

  • Index Cond: (id = i_21.document_id)
  • Filter: (((status)::text <> ALL ('{IGNORED,ERRORED}'::text[])) AND (error_status = 'VALIDATED'::text))
61. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using document_202006_id_idx on document_202006 d_17 (cost=0.00..2.06 rows=1 width=24) (never executed)

  • Index Cond: (id = i_21.document_id)
  • Filter: (((status)::text <> ALL ('{IGNORED,ERRORED}'::text[])) AND (error_status = 'VALIDATED'::text))
62. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using document_202007_id_idx on document_202007 d_18 (cost=0.00..2.11 rows=1 width=24) (never executed)

  • Index Cond: (id = i_21.document_id)
  • Filter: (((status)::text <> ALL ('{IGNORED,ERRORED}'::text[])) AND (error_status = 'VALIDATED'::text))
63. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using document_202008_id_idx on document_202008 d_19 (cost=0.00..2.06 rows=1 width=24) (never executed)

  • Index Cond: (id = i_21.document_id)
  • Filter: (((status)::text <> ALL ('{IGNORED,ERRORED}'::text[])) AND (error_status = 'VALIDATED'::text))
64. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using document_202009_id_idx on document_202009 d_20 (cost=0.00..2.15 rows=1 width=24) (never executed)

  • Index Cond: (id = i_21.document_id)
  • Filter: (((status)::text <> ALL ('{IGNORED,ERRORED}'::text[])) AND (error_status = 'VALIDATED'::text))
65. 0.045 0.045 ↑ 1.0 1 45 / 6

Index Scan using document_202010_id_idx on document_202010 d_21 (cost=0.00..2.08 rows=1 width=24) (actual time=0.005..0.006 rows=1 loops=45)

  • Index Cond: (id = i_21.document_id)
  • Filter: (((status)::text <> ALL ('{IGNORED,ERRORED}'::text[])) AND (error_status = 'VALIDATED'::text))
66. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using document_202011_id_idx on document_202011 d_22 (cost=0.00..0.35 rows=1 width=24) (never executed)

  • Index Cond: (id = i_21.document_id)
  • Filter: (((status)::text <> ALL ('{IGNORED,ERRORED}'::text[])) AND (error_status = 'VALIDATED'::text))
67. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using document_default_id_idx on document_default d_23 (cost=0.00..0.35 rows=1 width=24) (never executed)

  • Index Cond: (id = i_21.document_id)
  • Filter: (((status)::text <> ALL ('{IGNORED,ERRORED}'::text[])) AND (error_status = 'VALIDATED'::text))
68. 1.065 1.065 ↑ 1.0 1 45 / 6

Index Scan using supplier_id_idx on supplier s (cost=0.00..1.91 rows=1 width=16) (actual time=0.142..0.142 rows=1 loops=45)

  • Index Cond: (id = i_21.supplier_id)
69. 0.143 1.567 ↑ 23.8 4 45 / 6

Append (cost=0.00..105.82 rows=95 width=36) (actual time=0.153..0.209 rows=4 loops=45)

70. 0.007 0.007 ↓ 0.0 0 45 / 6

Index Scan using invoice_line_167001_invoice_id_idx on invoice_line_167001 l (cost=0.00..0.35 rows=1 width=36) (actual time=0.001..0.001 rows=0 loops=45)

  • Index Cond: (invoice_id = i_21.id)
71. 0.023 0.023 ↓ 0.0 0 45 / 6

Index Scan using invoice_line_201901_invoice_id_idx on invoice_line_201901 l_1 (cost=0.00..3.67 rows=5 width=36) (actual time=0.003..0.003 rows=0 loops=45)

  • Index Cond: (invoice_id = i_21.id)
72. 0.023 0.023 ↓ 0.0 0 45 / 6

Index Scan using invoice_line_201902_invoice_id_idx on invoice_line_201902 l_2 (cost=0.00..2.23 rows=3 width=36) (actual time=0.003..0.003 rows=0 loops=45)

  • Index Cond: (invoice_id = i_21.id)
73. 0.007 0.007 ↓ 0.0 0 45 / 6

Index Scan using invoice_line_201903_invoice_id_idx on invoice_line_201903 l_3 (cost=0.00..0.17 rows=3 width=36) (actual time=0.001..0.001 rows=0 loops=45)

  • Index Cond: (invoice_id = i_21.id)
74. 0.015 0.015 ↓ 0.0 0 45 / 6

Index Scan using invoice_line_201905_invoice_id_idx on invoice_line_201905 l_4 (cost=0.00..3.86 rows=4 width=36) (actual time=0.002..0.002 rows=0 loops=45)

  • Index Cond: (invoice_id = i_21.id)
75. 0.023 0.023 ↓ 0.0 0 45 / 6

Index Scan using invoice_line_201906_invoice_id_idx on invoice_line_201906 l_5 (cost=0.00..4.45 rows=4 width=36) (actual time=0.003..0.003 rows=0 loops=45)

  • Index Cond: (invoice_id = i_21.id)
76. 0.023 0.023 ↓ 0.0 0 45 / 6

Index Scan using invoice_line_201907_invoice_id_idx on invoice_line_201907 l_6 (cost=0.00..4.77 rows=4 width=36) (actual time=0.003..0.003 rows=0 loops=45)

  • Index Cond: (invoice_id = i_21.id)
77. 0.015 0.015 ↓ 0.0 0 45 / 6

Index Scan using invoice_line_201908_invoice_id_idx on invoice_line_201908 l_7 (cost=0.00..4.31 rows=4 width=36) (actual time=0.002..0.002 rows=0 loops=45)

  • Index Cond: (invoice_id = i_21.id)
78. 0.015 0.015 ↓ 0.0 0 45 / 6

Index Scan using invoice_line_201909_invoice_id_idx on invoice_line_201909 l_8 (cost=0.00..4.75 rows=4 width=36) (actual time=0.002..0.002 rows=0 loops=45)

  • Index Cond: (invoice_id = i_21.id)
79. 0.015 0.015 ↓ 0.0 0 45 / 6

Index Scan using invoice_line_201910_invoice_id_idx on invoice_line_201910 l_9 (cost=0.00..4.94 rows=4 width=36) (actual time=0.002..0.002 rows=0 loops=45)

  • Index Cond: (invoice_id = i_21.id)
80. 0.015 0.015 ↓ 0.0 0 45 / 6

Index Scan using invoice_line_201911_invoice_id_idx on invoice_line_201911 l_10 (cost=0.00..4.98 rows=4 width=36) (actual time=0.002..0.002 rows=0 loops=45)

  • Index Cond: (invoice_id = i_21.id)
81. 0.045 0.045 ↓ 0.0 0 45 / 6

Index Scan using invoice_line_201912_invoice_id_idx on invoice_line_201912 l_11 (cost=0.00..5.20 rows=4 width=36) (actual time=0.006..0.006 rows=0 loops=45)

  • Index Cond: (invoice_id = i_21.id)
82. 0.037 0.037 ↓ 0.0 0 45 / 6

Index Scan using invoice_line_202001_invoice_id_idx on invoice_line_202001 l_12 (cost=0.00..6.29 rows=5 width=36) (actual time=0.005..0.005 rows=0 loops=45)

  • Index Cond: (invoice_id = i_21.id)
83. 0.045 0.045 ↓ 0.0 0 45 / 6

Index Scan using invoice_line_202002_invoice_id_idx on invoice_line_202002 l_13 (cost=0.00..6.31 rows=5 width=36) (actual time=0.006..0.006 rows=0 loops=45)

  • Index Cond: (invoice_id = i_21.id)
84. 0.390 0.390 ↓ 0.0 0 45 / 6

Index Scan using invoice_line_202003_invoice_id_idx on invoice_line_202003 l_14 (cost=0.00..8.45 rows=7 width=36) (actual time=0.052..0.052 rows=0 loops=45)

  • Index Cond: (invoice_id = i_21.id)
85. 0.023 0.023 ↓ 0.0 0 45 / 6

Index Scan using invoice_line_202004_invoice_id_idx on invoice_line_202004 l_15 (cost=0.00..5.01 rows=4 width=36) (actual time=0.003..0.003 rows=0 loops=45)

  • Index Cond: (invoice_id = i_21.id)
86. 0.045 0.045 ↓ 0.0 0 45 / 6

Index Scan using invoice_line_202005_invoice_id_idx on invoice_line_202005 l_16 (cost=0.00..6.15 rows=5 width=36) (actual time=0.006..0.006 rows=0 loops=45)

  • Index Cond: (invoice_id = i_21.id)
87. 0.052 0.052 ↓ 0.0 0 45 / 6

Index Scan using invoice_line_202006_invoice_id_idx on invoice_line_202006 l_17 (cost=0.00..6.20 rows=5 width=36) (actual time=0.007..0.007 rows=0 loops=45)

  • Index Cond: (invoice_id = i_21.id)
88. 0.045 0.045 ↓ 0.0 0 45 / 6

Index Scan using invoice_line_202007_invoice_id_idx on invoice_line_202007 l_18 (cost=0.00..6.15 rows=5 width=36) (actual time=0.006..0.006 rows=0 loops=45)

  • Index Cond: (invoice_id = i_21.id)
89. 0.023 0.023 ↓ 0.0 0 45 / 6

Index Scan using invoice_line_202008_invoice_id_idx on invoice_line_202008 l_19 (cost=0.00..5.94 rows=5 width=36) (actual time=0.003..0.003 rows=0 loops=45)

  • Index Cond: (invoice_id = i_21.id)
90. 0.045 0.045 ↓ 0.0 0 45 / 6

Index Scan using invoice_line_202009_invoice_id_idx on invoice_line_202009 l_20 (cost=0.00..6.38 rows=5 width=36) (actual time=0.006..0.006 rows=0 loops=45)

  • Index Cond: (invoice_id = i_21.id)
91. 0.480 0.480 ↓ 1.3 4 45 / 6

Index Scan using invoice_line_202010_invoice_id_idx on invoice_line_202010 l_21 (cost=0.00..4.10 rows=3 width=36) (actual time=0.012..0.064 rows=4 loops=45)

  • Index Cond: (invoice_id = i_21.id)
92. 0.007 0.007 ↓ 0.0 0 45 / 6

Index Scan using invoice_line_202011_invoice_id_idx on invoice_line_202011 l_22 (cost=0.00..0.35 rows=1 width=36) (actual time=0.001..0.001 rows=0 loops=45)

  • Index Cond: (invoice_id = i_21.id)
93. 0.007 0.007 ↓ 0.0 0 45 / 6

Index Scan using invoice_line_default_invoice_id_idx on invoice_line_default l_23 (cost=0.00..0.35 rows=1 width=36) (actual time=0.001..0.001 rows=0 loops=45)

  • Index Cond: (invoice_id = i_21.id)
94. 0.033 0.755 ↑ 32.5 2 197 / 6

Append (cost=0.00..1.55 rows=65 width=40) (actual time=0.006..0.023 rows=2 loops=197)

95. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using classification_167001_source_id_idx on classification_167001 cla (cost=0.00..0.04 rows=2 width=57) (never executed)

  • Index Cond: (source_id = l.id)
96. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using classification_201901_source_id_idx on classification_201901 cla_1 (cost=0.00..0.05 rows=3 width=40) (never executed)

  • Index Cond: (source_id = l.id)
97. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using classification_201902_source_id_idx on classification_201902 cla_2 (cost=0.00..0.05 rows=3 width=40) (never executed)

  • Index Cond: (source_id = l.id)
98. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using classification_201903_source_id_idx on classification_201903 cla_3 (cost=0.00..0.05 rows=3 width=40) (never executed)

  • Index Cond: (source_id = l.id)
99. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using classification_201905_source_id_idx on classification_201905 cla_4 (cost=0.00..0.05 rows=3 width=40) (never executed)

  • Index Cond: (source_id = l.id)
100. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using classification_201906_source_id_idx on classification_201906 cla_5 (cost=0.00..0.05 rows=3 width=40) (never executed)

  • Index Cond: (source_id = l.id)
101. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using classification_201907_source_id_idx on classification_201907 cla_6 (cost=0.00..0.05 rows=3 width=40) (never executed)

  • Index Cond: (source_id = l.id)
102. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using classification_201908_source_id_idx on classification_201908 cla_7 (cost=0.00..0.05 rows=3 width=40) (never executed)

  • Index Cond: (source_id = l.id)
103. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using classification_201909_source_id_idx on classification_201909 cla_8 (cost=0.00..0.05 rows=3 width=40) (never executed)

  • Index Cond: (source_id = l.id)
104. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using classification_201910_source_id_idx on classification_201910 cla_9 (cost=0.00..0.06 rows=3 width=40) (never executed)

  • Index Cond: (source_id = l.id)
105. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using classification_201911_source_id_idx on classification_201911 cla_10 (cost=0.00..0.06 rows=3 width=40) (never executed)

  • Index Cond: (source_id = l.id)
106. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using classification_201912_source_id_idx on classification_201912 cla_11 (cost=0.00..0.04 rows=2 width=40) (never executed)

  • Index Cond: (source_id = l.id)
107. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using classification_202001_source_id_idx on classification_202001 cla_12 (cost=0.00..0.04 rows=2 width=40) (never executed)

  • Index Cond: (source_id = l.id)
108. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using classification_202002_source_id_idx on classification_202002 cla_13 (cost=0.00..0.04 rows=2 width=40) (never executed)

  • Index Cond: (source_id = l.id)
109. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using classification_202003_source_id_idx on classification_202003 cla_14 (cost=0.00..0.06 rows=3 width=40) (never executed)

  • Index Cond: (source_id = l.id)
110. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using classification_202004_source_id_idx on classification_202004 cla_15 (cost=0.00..0.06 rows=3 width=40) (never executed)

  • Index Cond: (source_id = l.id)
111. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using classification_202005_source_id_idx on classification_202005 cla_16 (cost=0.00..0.06 rows=3 width=40) (never executed)

  • Index Cond: (source_id = l.id)
112. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using classification_202006_source_id_idx on classification_202006 cla_17 (cost=0.00..0.06 rows=3 width=40) (never executed)

  • Index Cond: (source_id = l.id)
113. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using classification_202007_source_id_idx on classification_202007 cla_18 (cost=0.00..0.06 rows=3 width=40) (never executed)

  • Index Cond: (source_id = l.id)
114. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using classification_202008_source_id_idx on classification_202008 cla_19 (cost=0.00..0.06 rows=3 width=40) (never executed)

  • Index Cond: (source_id = l.id)
115. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using classification_202009_source_id_idx on classification_202009 cla_20 (cost=0.00..0.06 rows=3 width=40) (never executed)

  • Index Cond: (source_id = l.id)
116. 0.722 0.722 ↑ 1.0 2 197 / 6

Index Scan using classification_202010_source_id_idx on classification_202010 cla_21 (cost=0.00..0.04 rows=2 width=40) (actual time=0.005..0.022 rows=2 loops=197)

  • Index Cond: (source_id = l.id)
117. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using classification_202011_source_id_idx on classification_202011 cla_22 (cost=0.00..0.04 rows=2 width=57) (never executed)

  • Index Cond: (source_id = l.id)
118. 0.000 0.000 ↓ 0.0 0 / 6

Index Scan using classification_default_source_id_idx on classification_default cla_23 (cost=0.00..0.04 rows=2 width=40) (never executed)

  • Index Cond: (source_id = l.id)
119.          

CTE documents_to_classify

120. 0.020 201.579 ↑ 42.4 7 1

WindowAgg (cost=41.00..51.39 rows=297 width=64) (actual time=201.560..201.579 rows=7 loops=1)

121. 0.011 201.559 ↑ 37.1 8 1

Group (cost=41.00..44.71 rows=297 width=48) (actual time=201.545..201.559 rows=8 loops=1)

  • Group Key: nb.nb_invoices, lc.created, lc.supplier_id, lc.document_id
122. 0.053 201.548 ↑ 7.8 38 1

Sort (cost=41.00..41.74 rows=297 width=48) (actual time=201.542..201.548 rows=38 loops=1)

  • Sort Key: nb.nb_invoices DESC, lc.created, lc.supplier_id, lc.document_id
  • Sort Method: quicksort Memory: 32kB
123. 0.038 201.495 ↑ 3.0 99 1

Hash Join (cost=22.07..28.80 rows=297 width=48) (actual time=201.446..201.495 rows=99 loops=1)

  • Hash Cond: (lc.supplier_id = nb.supplier_id)
124. 201.345 201.345 ↑ 3.0 99 1

CTE Scan on lines_to_classify lc (cost=0.00..5.94 rows=297 width=40) (actual time=201.324..201.345 rows=99 loops=1)

125. 0.010 0.112 ↑ 7.1 28 1

Hash (cost=19.57..19.57 rows=200 width=24) (actual time=0.110..0.112 rows=28 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 10kB
126. 0.006 0.102 ↑ 7.1 28 1

Subquery Scan on nb (cost=17.07..19.57 rows=200 width=24) (actual time=0.094..0.102 rows=28 loops=1)

127. 0.012 0.096 ↑ 7.1 28 1

Sort (cost=17.07..17.57 rows=200 width=24) (actual time=0.093..0.096 rows=28 loops=1)

  • Sort Key: (count(lc_1.document_id)) DESC
  • Sort Method: quicksort Memory: 27kB
128. 0.042 0.084 ↑ 7.1 28 1

HashAggregate (cost=7.42..9.43 rows=200 width=24) (actual time=0.076..0.084 rows=28 loops=1)

  • Group Key: lc_1.supplier_id
129. 0.042 0.042 ↑ 3.0 99 1

CTE Scan on lines_to_classify lc_1 (cost=0.00..5.94 rows=297 width=32) (actual time=0.001..0.042 rows=99 loops=1)

130.          

Initplan (for Result)

131. 0.003 201.583 ↑ 1.0 1 1

Limit (cost=0.00..6.68 rows=1 width=16) (actual time=201.582..201.583 rows=1 loops=1)

132. 201.580 201.580 ↑ 1.0 1 1

CTE Scan on documents_to_classify dc (cost=0.00..6.68 rows=1 width=16) (actual time=201.580..201.580 rows=1 loops=1)

  • Filter: (document_id = '1eb0c59b-dc52-ca50-b357-3320879f34c3'::uuid)
  • Rows Removed by Filter: 6
133. 0.000 0.000 ↓ 0.0 0

Limit (cost=0.00..0.02 rows=1 width=16) (never executed)

134. 0.000 0.000 ↓ 0.0 0

CTE Scan on documents_to_classify dc_1 (cost=0.00..5.94 rows=297 width=16) (never executed)

Planning time : 40.122 ms
Execution time : 214.605 ms