explain.depesz.com

PostgreSQL's explain analyze made readable

Result: fBC : PREX

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.263 346.880 ↓ 2.7 347 1

Unique (cost=50,119.88..50,127.94 rows=129 width=307) (actual time=346.594..346.880 rows=347 loops=1)

2.          

CTE niveau_rem

3. 0.003 0.003 ↑ 1.0 1 1

Result (cost=0.00..0.01 rows=1 width=80) (actual time=0.003..0.003 rows=1 loops=1)

4.          

CTE fees_amount

5. 0.629 228.864 ↓ 76.5 306 1

GroupAggregate (cost=21,699.96..21,700.04 rows=4 width=36) (actual time=228.068..228.864 rows=306 loops=1)

  • Group Key: "*SELECT* 1".agent
6. 0.857 228.235 ↓ 587.0 2,348 1

Sort (cost=21,699.96..21,699.97 rows=4 width=36) (actual time=228.057..228.235 rows=2,348 loops=1)

  • Sort Key: "*SELECT* 1".agent
  • Sort Method: quicksort Memory: 207kB
7. 0.197 227.378 ↓ 587.0 2,348 1

Append (cost=353.07..21,699.92 rows=4 width=36) (actual time=37.989..227.378 rows=2,348 loops=1)

8. 0.055 38.170 ↓ 284.0 284 1

Subquery Scan on *SELECT* 1 (cost=353.07..353.10 rows=1 width=36) (actual time=37.987..38.170 rows=284 loops=1)

9. 0.108 38.115 ↓ 284.0 284 1

Unique (cost=353.07..353.09 rows=1 width=52) (actual time=37.985..38.115 rows=284 loops=1)

10. 0.387 38.007 ↓ 295.0 295 1

Sort (cost=353.07..353.08 rows=1 width=52) (actual time=37.984..38.007 rows=295 loops=1)

  • Sort Key: ref_transaction.id_transaction, ref_transaction.id_int_agent_in, ref_transaction.id_ext_agent_in, ref_margin.id_ss_transaction, (COALESCE((ref_sub_transaction.date_paid)::date, (ref_transaction.date_paid)::date)), (round((((COALESCE((ref_margin.amount_base_rec / 2.0), '0'::numeric))::double precision * ('1'::double precision + (COALESCE(ref_transaction.total_vat, '0'::double precision) / '100'::double precision))))::numeric(10,4), 2))
  • Sort Method: quicksort Memory: 48kB
11. 2.379 37.620 ↓ 295.0 295 1

Nested Loop (cost=49.48..353.06 rows=1 width=52) (actual time=4.962..37.620 rows=295 loops=1)

  • Join Filter: ((ref_transaction.id_transaction = ref_margin.id_transaction) AND (ref_transaction.id_int_agent_in = ref_margin.id_int_agent))
12. 5.472 29.427 ↓ 306.0 306 1

Merge Join (cost=49.05..344.67 rows=1 width=52) (actual time=4.903..29.427 rows=306 loops=1)

  • Merge Cond: (ref_transaction.id_transaction = ref_sub_transaction.id_transaction)
  • Join Filter: ((COALESCE((ref_sub_transaction.date_paid)::date, (ref_transaction.date_paid)::date) <= CURRENT_DATE) AND (COALESCE((ref_sub_transaction.date_paid)::date, (ref_transaction.date_paid)::date) >= ((((((CASE WHEN (date_part('month'::text, (CURRENT_DATE)::timestamp without time zone) < (ref_subsidiary_1.month_fiscal_start)::double precision) THEN (date_part('year'::text, (CURRENT_DATE)::timestamp without time zone) - '1'::double precision) ELSE date_part('year'::text, (CURRENT_DATE)::timestamp without time zone) END)::text || '-'::text) || (ref_subsidiary_1.month_fiscal_start)::text) || '-'::text) || (ref_subsidiary_1.day_fiscal_start)::text))::date))
  • Rows Removed by Join Filter: 286
13. 1.932 23.146 ↓ 26.6 2,443 1

Nested Loop (cost=0.43..13,455.05 rows=92 width=40) (actual time=0.096..23.146 rows=2,443 loops=1)

14. 21.214 21.214 ↓ 26.6 2,443 1

Index Scan using ref_transaction_xperf14 on ref_transaction (cost=0.43..13,452.84 rows=92 width=32) (actual time=0.066..21.214 rows=2,443 loops=1)

  • Index Cond: (id_filiale = 3)
  • Filter: is_active
  • Rows Removed by Filter: 5867
15. 0.000 0.000 ↑ 1.0 1 2,443

Materialize (cost=0.00..1.07 rows=1 width=12) (actual time=0.000..0.000 rows=1 loops=2,443)

16. 0.023 0.023 ↑ 1.0 1 1

Seq Scan on ref_subsidiary ref_subsidiary_1 (cost=0.00..1.06 rows=1 width=12) (actual time=0.022..0.023 rows=1 loops=1)

  • Filter: (id_wis = 3)
  • Rows Removed by Filter: 4
17. 0.476 0.809 ↑ 1.0 592 1

Sort (cost=48.62..50.13 rows=606 width=20) (actual time=0.628..0.809 rows=592 loops=1)

  • Sort Key: ref_sub_transaction.id_transaction
  • Sort Method: quicksort Memory: 70kB
18. 0.333 0.333 ↑ 1.0 592 1

Seq Scan on ref_sub_transaction (cost=0.00..20.61 rows=606 width=20) (actual time=0.014..0.333 rows=592 loops=1)

  • Filter: (id_filiale = 3)
  • Rows Removed by Filter: 3
19. 5.814 5.814 ↑ 1.0 1 306

Index Scan using ref_margin_xperf04 on ref_margin (cost=0.43..8.35 rows=1 width=22) (actual time=0.013..0.019 rows=1 loops=306)

  • Index Cond: ((id_ss_transaction = ref_sub_transaction.id_ss_transaction) AND (id_ss_transaction IS NOT NULL))
  • Filter: ((id_filiale = 3) AND ((ss_type_margin)::text = 'Agent'::text) AND ((type_margin)::text = 'IN'::text) AND (ref_sub_transaction.id_transaction = id_transaction))
  • Rows Removed by Filter: 6
20. 0.052 24.133 ↓ 284.0 284 1

Subquery Scan on *SELECT* 2 (cost=353.07..353.10 rows=1 width=36) (actual time=23.955..24.133 rows=284 loops=1)

21. 0.107 24.081 ↓ 284.0 284 1

Unique (cost=353.07..353.09 rows=1 width=52) (actual time=23.953..24.081 rows=284 loops=1)

22. 0.361 23.974 ↓ 295.0 295 1

Sort (cost=353.07..353.08 rows=1 width=52) (actual time=23.952..23.974 rows=295 loops=1)

  • Sort Key: ref_transaction_1.id_transaction, ref_transaction_1.id_int_agent_out, ref_transaction_1.id_ext_agent_out, ref_margin_1.id_ss_transaction, (COALESCE((ref_sub_transaction_1.date_paid)::date, (ref_transaction_1.date_paid)::date)), (round((((COALESCE((ref_margin_1.amount_base_rec / 2.0), '0'::numeric))::double precision * ('1'::double precision + (COALESCE(ref_transaction_1.total_vat, '0'::double precision) / '100'::double precision))))::numeric(10,4), 2))
  • Sort Method: quicksort Memory: 48kB
23. 1.815 23.613 ↓ 295.0 295 1

Nested Loop (cost=49.48..353.06 rows=1 width=52) (actual time=3.009..23.613 rows=295 loops=1)

  • Join Filter: ((ref_transaction_1.id_transaction = ref_margin_1.id_transaction) AND (ref_transaction_1.id_int_agent_out = ref_margin_1.id_int_agent))
24. 3.785 17.514 ↓ 306.0 306 1

Merge Join (cost=49.05..344.67 rows=1 width=52) (actual time=2.964..17.514 rows=306 loops=1)

  • Merge Cond: (ref_transaction_1.id_transaction = ref_sub_transaction_1.id_transaction)
  • Join Filter: ((COALESCE((ref_sub_transaction_1.date_paid)::date, (ref_transaction_1.date_paid)::date) <= CURRENT_DATE) AND (COALESCE((ref_sub_transaction_1.date_paid)::date, (ref_transaction_1.date_paid)::date) >= ((((((CASE WHEN (date_part('month'::text, (CURRENT_DATE)::timestamp without time zone) < (ref_subsidiary_2.month_fiscal_start)::double precision) THEN (date_part('year'::text, (CURRENT_DATE)::timestamp without time zone) - '1'::double precision) ELSE date_part('year'::text, (CURRENT_DATE)::timestamp without time zone) END)::text || '-'::text) || (ref_subsidiary_2.month_fiscal_start)::text) || '-'::text) || (ref_subsidiary_2.day_fiscal_start)::text))::date))
  • Rows Removed by Join Filter: 286
25. 1.386 13.071 ↓ 26.6 2,443 1

Nested Loop (cost=0.43..13,455.05 rows=92 width=40) (actual time=0.057..13.071 rows=2,443 loops=1)

26. 11.685 11.685 ↓ 26.6 2,443 1

Index Scan using ref_transaction_xperf14 on ref_transaction ref_transaction_1 (cost=0.43..13,452.84 rows=92 width=32) (actual time=0.033..11.685 rows=2,443 loops=1)

  • Index Cond: (id_filiale = 3)
  • Filter: is_active
  • Rows Removed by Filter: 5867
27. 0.000 0.000 ↑ 1.0 1 2,443

Materialize (cost=0.00..1.07 rows=1 width=12) (actual time=0.000..0.000 rows=1 loops=2,443)

28. 0.015 0.015 ↑ 1.0 1 1

Seq Scan on ref_subsidiary ref_subsidiary_2 (cost=0.00..1.06 rows=1 width=12) (actual time=0.014..0.015 rows=1 loops=1)

  • Filter: (id_wis = 3)
  • Rows Removed by Filter: 4
29. 0.382 0.658 ↑ 1.0 592 1

Sort (cost=48.62..50.13 rows=606 width=20) (actual time=0.524..0.658 rows=592 loops=1)

  • Sort Key: ref_sub_transaction_1.id_transaction
  • Sort Method: quicksort Memory: 70kB
30. 0.276 0.276 ↑ 1.0 592 1

Seq Scan on ref_sub_transaction ref_sub_transaction_1 (cost=0.00..20.61 rows=606 width=20) (actual time=0.014..0.276 rows=592 loops=1)

  • Filter: (id_filiale = 3)
  • Rows Removed by Filter: 3
31. 4.284 4.284 ↑ 1.0 1 306

Index Scan using ref_margin_xperf04 on ref_margin ref_margin_1 (cost=0.43..8.35 rows=1 width=22) (actual time=0.009..0.014 rows=1 loops=306)

  • Index Cond: ((id_ss_transaction = ref_sub_transaction_1.id_ss_transaction) AND (id_ss_transaction IS NOT NULL))
  • Filter: ((id_filiale = 3) AND ((ss_type_margin)::text = 'Agent'::text) AND ((type_margin)::text = 'OUT'::text) AND (ref_sub_transaction_1.id_transaction = id_transaction))
  • Rows Removed by Filter: 6
32. 0.152 88.089 ↓ 890.0 890 1

Subquery Scan on *SELECT* 3 (cost=10,521.05..10,521.08 rows=1 width=36) (actual time=87.558..88.089 rows=890 loops=1)

33. 0.296 87.937 ↓ 890.0 890 1

Unique (cost=10,521.05..10,521.07 rows=1 width=52) (actual time=87.556..87.937 rows=890 loops=1)

34. 1.076 87.641 ↓ 890.0 890 1

Sort (cost=10,521.05..10,521.05 rows=1 width=52) (actual time=87.555..87.641 rows=890 loops=1)

  • Sort Key: ref_transaction_2.id_transaction, ref_transaction_2.id_int_agent_in, ref_transaction_2.id_ext_agent_in, ref_margin_2.id_ss_transaction, ((ref_transaction_2.date_paid)::date), (round((((((COALESCE(ref_margin_2.amount_base_rec, '0'::numeric))::double precision * ('1'::double precision + (COALESCE(ref_transaction_2.total_vat, '0'::double precision) / '100'::double precision))))::numeric(10,4) - (SubPlan 2)) / 2.0), 2))
  • Sort Method: quicksort Memory: 94kB
35. 27.967 86.565 ↓ 890.0 890 1

Nested Loop (cost=1,000.86..10,521.04 rows=1 width=52) (actual time=2.455..86.565 rows=890 loops=1)

  • Join Filter: ((ref_transaction_2.date_paid)::date >= ((((((CASE WHEN (date_part('month'::text, (CURRENT_DATE)::timestamp without time zone) < (ref_subsidiary_3.month_fiscal_start)::double precision) THEN (date_part('year'::text, (CURRENT_DATE)::timestamp without time zone) - '1'::double precision) ELSE date_part('year'::text, (CURRENT_DATE)::timestamp without time zone) END)::text || '-'::text) || (ref_subsidiary_3.month_fiscal_start)::text) || '-'::text) || (ref_subsidiary_3.day_fiscal_start)::text))::date)
  • Rows Removed by Join Filter: 965
36. 0.000 10.238 ↓ 1,855.0 1,855 1

Gather (cost=1,000.86..10,492.33 rows=1 width=46) (actual time=2.294..10.238 rows=1,855 loops=1)

  • Workers Planned: 1
  • Workers Launched: 1
37. 17.223 29.496 ↓ 928.0 928 2

Nested Loop (cost=0.86..9,492.23 rows=1 width=46) (actual time=0.124..29.496 rows=928 loops=2)

38. 12.257 12.257 ↓ 1.0 928 2

Parallel Index Scan using ref_margin_xperf01 on ref_margin ref_margin_2 (cost=0.43..1,906.61 rows=902 width=22) (actual time=0.049..12.257 rows=928 loops=2)

  • Index Cond: (id_filiale = 3)
  • Filter: ((id_ss_transaction IS NULL) AND ((ss_type_margin)::text = 'Agent'::text) AND ((type_margin)::text = 'IN'::text))
  • Rows Removed by Filter: 6638
39. 0.016 0.016 ↑ 1.0 1 1,855

Index Scan using ref_transaction_xperf14 on ref_transaction ref_transaction_2 (cost=0.43..8.40 rows=1 width=32) (actual time=0.015..0.016 rows=1 loops=1,855)

  • Index Cond: ((id_filiale = 3) AND (id_transaction = ref_margin_2.id_transaction))
  • Filter: (is_active AND (ref_margin_2.id_int_agent = id_int_agent_in) AND ((date_paid)::date <= CURRENT_DATE))
  • Rows Removed by Filter: 3
40. 7.420 7.420 ↑ 1.0 1 1,855

Seq Scan on ref_subsidiary ref_subsidiary_3 (cost=0.00..1.06 rows=1 width=12) (actual time=0.004..0.004 rows=1 loops=1,855)

  • Filter: (id_wis = 3)
  • Rows Removed by Filter: 4
41.          

SubPlan (forNested Loop)

42. 9.790 40.940 ↑ 1.0 1 890

Aggregate (cost=27.52..27.55 rows=1 width=32) (actual time=0.046..0.046 rows=1 loops=890)

43. 5.340 31.150 ↓ 0.0 0 890

Bitmap Heap Scan on ref_margin a (cost=23.50..27.52 rows=1 width=6) (actual time=0.035..0.035 rows=0 loops=890)

  • Recheck Cond: ((id_transaction = ref_margin_2.id_transaction) AND (id_int_agent = ref_transaction_2.id_int_agent_in))
  • Filter: ((id_ss_transaction IS NOT NULL) AND ((type_margin)::text = 'IN'::text))
  • Rows Removed by Filter: 2
  • Heap Blocks: exact=1811
44. 3.560 25.810 ↓ 0.0 0 890

BitmapAnd (cost=23.50..23.50 rows=1 width=0) (actual time=0.029..0.029 rows=0 loops=890)

45. 8.900 8.900 ↓ 1.3 16 890

Bitmap Index Scan on ref_margin_xperf02 (cost=0.00..4.52 rows=12 width=0) (actual time=0.010..0.010 rows=16 loops=890)

  • Index Cond: (id_transaction = ref_margin_2.id_transaction)
46. 13.350 13.350 ↑ 2.6 120 890

Bitmap Index Scan on ref_margin_xperf07 (cost=0.00..18.73 rows=307 width=0) (actual time=0.015..0.015 rows=120 loops=890)

  • Index Cond: (id_int_agent = ref_transaction_2.id_int_agent_in)
47. 0.154 76.789 ↓ 890.0 890 1

Subquery Scan on *SELECT* 4 (cost=10,472.59..10,472.62 rows=1 width=36) (actual time=76.256..76.789 rows=890 loops=1)

48. 0.296 76.635 ↓ 890.0 890 1

Unique (cost=10,472.59..10,472.61 rows=1 width=52) (actual time=76.254..76.635 rows=890 loops=1)

49. 0.990 76.339 ↓ 890.0 890 1

Sort (cost=10,472.59..10,472.60 rows=1 width=52) (actual time=76.253..76.339 rows=890 loops=1)

  • Sort Key: ref_transaction_3.id_transaction, ref_transaction_3.id_int_agent_out, ref_transaction_3.id_ext_agent_out, ref_margin_3.id_ss_transaction, ((ref_transaction_3.date_paid)::date), (round((((((COALESCE(ref_margin_3.amount_base_rec, '0'::numeric))::double precision * ('1'::double precision + (COALESCE(ref_transaction_3.total_vat, '0'::double precision) / '100'::double precision))))::numeric(10,4) - (SubPlan 3)) / 2.0), 2))
  • Sort Method: quicksort Memory: 94kB
50. 25.916 75.349 ↓ 890.0 890 1

Nested Loop (cost=1,000.86..10,472.58 rows=1 width=52) (actual time=2.505..75.349 rows=890 loops=1)

  • Join Filter: ((ref_transaction_3.date_paid)::date >= ((((((CASE WHEN (date_part('month'::text, (CURRENT_DATE)::timestamp without time zone) < (ref_subsidiary_4.month_fiscal_start)::double precision) THEN (date_part('year'::text, (CURRENT_DATE)::timestamp without time zone) - '1'::double precision) ELSE date_part('year'::text, (CURRENT_DATE)::timestamp without time zone) END)::text || '-'::text) || (ref_subsidiary_4.month_fiscal_start)::text) || '-'::text) || (ref_subsidiary_4.day_fiscal_start)::text))::date)
  • Rows Removed by Join Filter: 965
51. 0.000 7.303 ↓ 1,855.0 1,855 1

Gather (cost=1,000.86..10,443.87 rows=1 width=46) (actual time=2.052..7.303 rows=1,855 loops=1)

  • Workers Planned: 1
  • Workers Launched: 1
52. 18.216 24.793 ↓ 928.0 928 2

Nested Loop (cost=0.86..9,443.77 rows=1 width=46) (actual time=0.152..24.793 rows=928 loops=2)

53. 6.559 6.559 ↓ 1.0 928 2

Parallel Index Scan using ref_margin_xperf01 on ref_margin ref_margin_3 (cost=0.43..1,906.61 rows=896 width=22) (actual time=0.075..6.559 rows=928 loops=2)

  • Index Cond: (id_filiale = 3)
  • Filter: ((id_ss_transaction IS NULL) AND ((ss_type_margin)::text = 'Agent'::text) AND ((type_margin)::text = 'OUT'::text))
  • Rows Removed by Filter: 6638
54. 0.018 0.018 ↑ 1.0 1 1,855

Index Scan using ref_transaction_xperf14 on ref_transaction ref_transaction_3 (cost=0.43..8.40 rows=1 width=32) (actual time=0.017..0.018 rows=1 loops=1,855)

  • Index Cond: ((id_filiale = 3) AND (id_transaction = ref_margin_3.id_transaction))
  • Filter: (is_active AND (ref_margin_3.id_int_agent = id_int_agent_out) AND ((date_paid)::date <= CURRENT_DATE))
  • Rows Removed by Filter: 3
55. 7.420 7.420 ↑ 1.0 1 1,855

Seq Scan on ref_subsidiary ref_subsidiary_4 (cost=0.00..1.06 rows=1 width=12) (actual time=0.003..0.004 rows=1 loops=1,855)

  • Filter: (id_wis = 3)
  • Rows Removed by Filter: 4
56.          

SubPlan (forNested Loop)

57. 8.010 34.710 ↑ 1.0 1 890

Aggregate (cost=27.52..27.55 rows=1 width=32) (actual time=0.039..0.039 rows=1 loops=890)

58. 5.340 26.700 ↓ 0.0 0 890

Bitmap Heap Scan on ref_margin a_1 (cost=23.50..27.52 rows=1 width=6) (actual time=0.029..0.030 rows=0 loops=890)

  • Recheck Cond: ((id_transaction = ref_margin_3.id_transaction) AND (id_int_agent = ref_transaction_3.id_int_agent_out))
  • Filter: ((id_ss_transaction IS NOT NULL) AND ((type_margin)::text = 'OUT'::text))
  • Rows Removed by Filter: 2
  • Heap Blocks: exact=1799
59. 2.670 21.360 ↓ 0.0 0 890

BitmapAnd (cost=23.50..23.50 rows=1 width=0) (actual time=0.024..0.024 rows=0 loops=890)

60. 8.010 8.010 ↓ 1.3 16 890

Bitmap Index Scan on ref_margin_xperf02 (cost=0.00..4.52 rows=12 width=0) (actual time=0.009..0.009 rows=16 loops=890)

  • Index Cond: (id_transaction = ref_margin_3.id_transaction)
61. 10.680 10.680 ↑ 3.2 95 890

Bitmap Index Scan on ref_margin_xperf07 (cost=0.00..18.73 rows=307 width=0) (actual time=0.012..0.012 rows=95 loops=890)

  • Index Cond: (id_int_agent = ref_transaction_3.id_int_agent_out)
62. 1.296 346.617 ↓ 2.7 347 1

Sort (cost=28,419.82..28,420.15 rows=129 width=307) (actual time=346.592..346.617 rows=347 loops=1)

  • Sort Key: ref_people.firstname, ref_people.name, ref_people.id_ext, ref_people.id_int, ref_people.email_pro, ((COALESCE(ref_people.date_first_activation, ref_people.date_apply))::date), ((COALESCE((SubPlan 6), COALESCE(ref_people.date_first_activation, ref_people.date_apply)))::date), (((COALESCE((SubPlan 8), COALESCE(ref_people.date_first_activation, ref_people.date_apply)))::date + '1 year'::interval)), (CASE WHEN ((((COALESCE((SubPlan 10), COALESCE(ref_people.date_first_activation, ref_people.date_apply)))::date + '1 year'::interval) >= ((((((CASE WHEN (date_part('month'::text, (CURRENT_DATE)::timestamp without time zone) < (ref_subsidiary.month_fiscal_start)::double precision) THEN (date_part('year'::text, (CURRENT_DATE)::timestamp without time zone) - '1'::double precision) ELSE date_part('year'::text, (CURRENT_DATE)::timestamp without time zone) END)::text || '-'::text) || (ref_subsidiary.month_fiscal_start)::text) || '-'::text) || (ref_subsidiary.day_fiscal_start)::text))::date) AND (((COALESCE((SubPlan 12), COALESCE(ref_people.date_first_activation, ref_people.date_apply)))::date + '1 year'::interval) <= (((((((CASE WHEN (date_part('month'::text, (CURRENT_DATE)::timestamp without time zone) < (ref_subsidiary.month_fiscal_start)::double precision) THEN (date_part('year'::text, (CURRENT_DATE)::timestamp without time zone) - '1'::double precision) ELSE date_part('year'::text, (CURRENT_DATE)::timestamp without time zone) END)::text || '-'::text) || (ref_subsidiary.month_fiscal_start)::text) || '-'::text) || (ref_subsidiary.day_fiscal_start)::text))::date + '1 year'::interval))) THEN 'prorata'::text ELSE ''::text END), (((((((CASE WHEN (date_part('month'::text, (CURRENT_DATE)::timestamp without time zone) < (ref_subsidiary.month_fiscal_start)::double precision) THEN (date_part('year'::text, (CURRENT_DATE)::timestamp without time zone) - '1'::double precision) ELSE date_part('year'::text, (CURRENT_DATE)::timestamp without time zone) END)::text || '-'::text) || (ref_subsidiary.month_fiscal_start)::text) || '-'::text) || (ref_subsidiary.day_fiscal_start)::text))::date), (age((((((((CASE WHEN (date_part('month'::text, (CURRENT_DATE)::timestamp without time zone) < (ref_subsidiary.month_fiscal_start)::double precision) THEN (date_part('year'::text, (CURRENT_DATE)::timestamp without time zone) - '1'::double precision) ELSE date_part('year'::text, (CURRENT_DATE)::timestamp without time zone) END)::text || '-'::text) || (ref_subsidiary.month_fiscal_start)::text) || '-'::text) || (ref_subsidiary.day_fiscal_start)::text))::date)::timestamp with time zone, ((COALESCE((SubPlan 14), COALESCE(ref_people.date_first_activation, ref_people.date_apply)))::date)::timestamp with time zone)), (((((date_part('year'::text, (((((((CASE WHEN (date_part('month'::text, (CURRENT_DATE)::timestamp without time zone) < (ref_subsidiary.month_fiscal_start)::double precision) THEN (date_part('year'::text, (CURRENT_DATE)::timestamp without time zone) - '1'::double precision) ELSE date_part('year'::text, (CURRENT_DATE)::timestamp without time zone) END)::text || '-'::text) || (ref_subsidiary.month_fiscal_start)::text) || '-'::text) || (ref_subsidiary.day_fiscal_start)::text))::date)::timestamp without time zone) - date_part('year'::text, ((COALESCE((SubPlan 16), COALESCE(ref_people.date_first_activation, ref_people.date_apply)))::date)::timestamp without time zone)))::integer * 12) + ((date_part('month'::text, (((((((CASE WHEN (date_part('month'::text, (CURRENT_DATE)::timestamp without time zone) < (ref_subsidiary.month_fiscal_start)::double precision) THEN (date_part('year'::text, (CURRENT_DATE)::timestamp without time zone) - '1'::double precision) ELSE date_part('year'::text, (CURRENT_DATE)::timestamp without time zone) END)::text || '-'::text) || (ref_subsidiary.month_fiscal_start)::text) || '-'::text) || (ref_subsidiary.day_fiscal_start)::text))::date)::timestamp without time zone) - date_part('month'::text, ((COALESCE((SubPlan 18), COALESCE(ref_people.date_first_activation, ref_people.date_apply)))::date)::timestamp without time zone)))::integer)), (CASE WHEN ((((date_part('year'::text, (((((((CASE WHEN (date_part('month'::text, (CURRENT_DATE)::timestamp without time zone) < (ref_subsidiary.month_fiscal_start)::double precision) THEN (date_part('year'::text, (CURRENT_DATE)::timestamp without time zone) - '1'::double precision) ELSE date_part('year'::text, (CURRENT_DATE)::timestamp without time zone) END)::text || '-'::text) || (ref_subsidiary.month_fiscal_start)::text) || '-'::text) || (ref_subsidiary.day_fiscal_start)::text))::date + '1 year'::interval)) - date_part('year'::text, ((COALESCE((SubPlan 20), COALESCE(ref_people.date_first_activation, ref_people.date_apply)))::date)::timestamp without time zone)) * '12'::double precision) + ((('6'::double precision - date_part('month'::text, ((COALESCE((SubPlan 22), COALESCE(ref_people.date_first_activation, ref_people.date_apply)))::date)::timestamp without time zone)))::integer)::double precision) < '12'::double precision) THEN 'non soumis à maintien de qualif'::text ELSE 'soumis'::text END), ref_people.id_qualification, ref_people.code_qualification, (CASE WHEN (ref_people.id_qualification = 1) THEN niveau_rem.niv_bronze WHEN (ref_people.id_qualification = 2) THEN niveau_rem.niv_argent WHEN (ref_people.id_qualification = 3) THEN niveau_rem.niv_or WHEN (ref_people.id_qualification = 4) THEN niveau_rem.niv_platinium WHEN (ref_people.id_qualification = 5) THEN niveau_rem.niv_platinium_assoc ELSE '0'::numeric END), (CASE WHEN ((((COALESCE((SubPlan 24), COALESCE(ref_people.date_first_activation, ref_people.date_apply)))::date + '1 year'::interval) >= ((((((CASE WHEN (date_part('month'::text, (CURRENT_DATE)::timestamp without time zone) < (ref_subsidiary.month_fiscal_start)::double precision) THEN (date_part('year'::text, (CURRENT_DATE)::timestamp without time zone) - '1'::double precision) ELSE date_part('year'::text, (CURRENT_DATE)::timestamp without time zone) END)::text || '-'::text) || (ref_subsidiary.month_fiscal_start)::text) || '-'::text) || (ref_subsidiary.day_fiscal_start)::text))::date) AND (((COALESCE((SubPlan 26), COALESCE(ref_people.date_first_activation, ref_people.date_apply)))::date + '1 year'::interval) <= (((((((CASE WHEN (date_part('month'::text, (CURRENT_DATE)::timestamp without time zone) < (ref_subsidiary.month_fiscal_start)::double precision) THEN (date_part('year'::text, (CURRENT_DATE)::timestamp without time zone) - '1'::double precision) ELSE date_part('year'::text, (CURRENT_DATE)::timestamp without time zone) END)::text || '-'::text) || (ref_subsidiary.month_fiscal_start)::text) || '-'::text) || (ref_subsidiary.day_fiscal_start)::text))::date + '1 year'::interval))) THEN (((CASE WHEN (ref_people.id_qualification = 1) THEN niveau_rem.niv_bronze WHEN (ref_people.id_qualification = 2) THEN niveau_rem.niv_argent WHEN (ref_people.id_qualification = 3) THEN niveau_rem.niv_or WHEN (ref_people.id_qualification = 4) THEN niveau_rem.niv_platinium WHEN (ref_people.id_qualification = 5) THEN niveau_rem.niv_platinium_assoc ELSE niveau_rem.niv_bronze END / '12'::numeric) * (((((date_part('year'::text, (((((((CASE WHEN (date_part('month'::text, (CURRENT_DATE)::timestamp without time zone) < (ref_subsidiary.month_fiscal_start)::double precision) THEN (date_part('year'::text, (CURRENT_DATE)::timestamp without time zone) - '1'::double precision) ELSE date_part('year'::text, (CURRENT_DATE)::timestamp without time zone) END)::text || '-'::text) || (ref_subsidiary.month_fiscal_start)::text) || '-'::text) || (ref_subsidiary.day_fiscal_start)::text))::date)::timestamp without time zone) - date_part('year'::text, ((COALESCE((SubPlan 28), COALESCE(ref_people.date_first_activation, ref_people.date_apply)))::date)::timestamp without time zone)))::integer * 12) + ((date_part('month'::text, (((((((CASE WHEN (date_part('month'::text, (CURRENT_DATE)::timestamp without time zone) < (ref_subsidiary.month_fiscal_start)::double precision) THEN (date_part('year'::text, (CURRENT_DATE)::timestamp without time zone) - '1'::double precision) ELSE date_part('year'::text, (CURRENT_DATE)::timestamp without time zone) END)::text || '-'::text) || (ref_subsidiary.month_fiscal_start)::text) || '-'::text) || (ref_subsidiary.day_fiscal_start)::text))::date)::timestamp without time zone) - date_part('month'::text, ((COALESCE((SubPlan 30), COALESCE(ref_people.date_first_activation, ref_people.date_apply)))::date)::timestamp without time zone)))::integer))::numeric))::numeric(10,2) WHEN (((COALESCE((SubPlan 32), COALESCE(ref_people.date_first_activation, ref_people.date_apply)))::date + '1 year'::interval) <= ((((((CASE WHEN (date_part('month'::text, (CURRENT_DATE)::timestamp without time zone) < (ref_subsidiary.month_fiscal_start)::double precision) THEN (date_part('year'::text, (CURRENT_DATE)::timestamp without time zone) - '1'::double precision) ELSE date_part('year'::text, (CURRENT_DATE)::timestamp without time zone) END)::text || '-'::text) || (ref_subsidiary.month_fiscal_start)::text) || '-'::text) || (ref_subsidiary.day_fiscal_start)::text))::date) THEN CASE WHEN (ref_people.id_qualification = 1) THEN niveau_rem.niv_bronze WHEN (ref_people.id_qualification = 2) THEN niveau_rem.niv_argent WHEN (ref_people.id_qualification = 3) THEN niveau_rem.niv_or WHEN (ref_people.id_qualification = 4) THEN niveau_rem.niv_platinium WHEN (ref_people.id_qualification = 5) THEN niveau_rem.niv_platinium_assoc ELSE niveau_rem.niv_bronze END ELSE '0'::numeric END), ((SubPlan 33)), ((SubPlan 34)), ((SubPlan 35)), ((SubPlan 36)), ((SubPlan 37)), ((SubPlan 38)), ((COALESCE((SubPlan 39), '0'::numeric))::numeric(10,2))
  • Sort Method: quicksort Memory: 117kB
63. 26.704 345.321 ↓ 2.7 347 1

Nested Loop (cost=0.41..28,415.30 rows=129 width=307) (actual time=229.988..345.321 rows=347 loops=1)

64. 0.004 0.038 ↑ 1.0 1 1

Nested Loop (cost=0.00..1.09 rows=1 width=92) (actual time=0.033..0.038 rows=1 loops=1)

65. 0.008 0.008 ↑ 1.0 1 1

CTE Scan on niveau_rem (cost=0.00..0.02 rows=1 width=80) (actual time=0.007..0.008 rows=1 loops=1)

66. 0.026 0.026 ↑ 1.0 1 1

Seq Scan on ref_subsidiary (cost=0.00..1.06 rows=1 width=12) (actual time=0.023..0.026 rows=1 loops=1)

  • Filter: (id_wis = 3)
  • Rows Removed by Filter: 4
67. 2.695 2.695 ↓ 2.7 347 1

Index Scan using ref_people_xperf06 on ref_people (cost=0.41..3,072.42 rows=129 width=95) (actual time=0.040..2.695 rows=347 loops=1)

  • Index Cond: ((id_filiale = 3) AND (id_type = 5))
  • Filter: ((id_qualification > 0) AND (id_statut <> 2))
  • Rows Removed by Filter: 956
68.          

SubPlan (forNested Loop)

69. 0.347 2.776 ↑ 1.0 1 347

Result (cost=6.01..6.02 rows=1 width=8) (actual time=0.008..0.008 rows=1 loops=347)

70.          

Initplan (forResult)

71. 0.347 2.429 ↑ 1.0 1 347

Limit (cost=0.28..6.01 rows=1 width=8) (actual time=0.007..0.007 rows=1 loops=347)

72. 2.082 2.082 ↑ 2.0 1 347

Index Scan using ref_qualification_xperf3 on ref_qualification (cost=0.28..11.74 rows=2 width=8) (actual time=0.006..0.006 rows=1 loops=347)

  • Index Cond: ((id_int = ref_people.id_int) AND (date_histo IS NOT NULL))
  • Filter: is_active
73. 0.000 1.388 ↑ 1.0 1 347

Result (cost=6.01..6.02 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=347)

74.          

Initplan (forResult)

75. 0.347 1.388 ↑ 1.0 1 347

Limit (cost=0.28..6.01 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=347)

76. 1.041 1.041 ↑ 2.0 1 347

Index Scan using ref_qualification_xperf3 on ref_qualification ref_qualification_1 (cost=0.28..11.74 rows=2 width=8) (actual time=0.003..0.003 rows=1 loops=347)

  • Index Cond: ((id_int = ref_people.id_int) AND (date_histo IS NOT NULL))
  • Filter: is_active
77. 0.347 1.388 ↑ 1.0 1 347

Result (cost=6.01..6.02 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=347)

78.          

Initplan (forResult)

79. 0.000 1.041 ↑ 1.0 1 347

Limit (cost=0.28..6.01 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=347)

80. 1.041 1.041 ↑ 2.0 1 347

Index Scan using ref_qualification_xperf3 on ref_qualification ref_qualification_2 (cost=0.28..11.74 rows=2 width=8) (actual time=0.003..0.003 rows=1 loops=347)

  • Index Cond: ((id_int = ref_people.id_int) AND (date_histo IS NOT NULL))
  • Filter: is_active
81. 0.295 1.770 ↑ 1.0 1 295

Result (cost=6.01..6.02 rows=1 width=8) (actual time=0.006..0.006 rows=1 loops=295)

82.          

Initplan (forResult)

83. 0.295 1.475 ↑ 1.0 1 295

Limit (cost=0.28..6.01 rows=1 width=8) (actual time=0.005..0.005 rows=1 loops=295)

84. 1.180 1.180 ↑ 2.0 1 295

Index Scan using ref_qualification_xperf3 on ref_qualification ref_qualification_3 (cost=0.28..11.74 rows=2 width=8) (actual time=0.004..0.004 rows=1 loops=295)

  • Index Cond: ((id_int = ref_people.id_int) AND (date_histo IS NOT NULL))
  • Filter: is_active
85. 0.347 2.082 ↑ 1.0 1 347

Result (cost=6.01..6.02 rows=1 width=8) (actual time=0.005..0.006 rows=1 loops=347)

86.          

Initplan (forResult)

87. 0.347 1.735 ↑ 1.0 1 347

Limit (cost=0.28..6.01 rows=1 width=8) (actual time=0.005..0.005 rows=1 loops=347)

88. 1.388 1.388 ↑ 2.0 1 347

Index Scan using ref_qualification_xperf3 on ref_qualification ref_qualification_4 (cost=0.28..11.74 rows=2 width=8) (actual time=0.004..0.004 rows=1 loops=347)

  • Index Cond: ((id_int = ref_people.id_int) AND (date_histo IS NOT NULL))
  • Filter: is_active
89. 0.347 1.735 ↑ 1.0 1 347

Result (cost=6.01..6.02 rows=1 width=8) (actual time=0.005..0.005 rows=1 loops=347)

90.          

Initplan (forResult)

91. 0.347 1.388 ↑ 1.0 1 347

Limit (cost=0.28..6.01 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=347)

92. 1.041 1.041 ↑ 2.0 1 347

Index Scan using ref_qualification_xperf3 on ref_qualification ref_qualification_5 (cost=0.28..11.74 rows=2 width=8) (actual time=0.003..0.003 rows=1 loops=347)

  • Index Cond: ((id_int = ref_people.id_int) AND (date_histo IS NOT NULL))
  • Filter: is_active
93. 0.347 1.735 ↑ 1.0 1 347

Result (cost=6.01..6.02 rows=1 width=8) (actual time=0.005..0.005 rows=1 loops=347)

94.          

Initplan (forResult)

95. 0.347 1.388 ↑ 1.0 1 347

Limit (cost=0.28..6.01 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=347)

96. 1.041 1.041 ↑ 2.0 1 347

Index Scan using ref_qualification_xperf3 on ref_qualification ref_qualification_6 (cost=0.28..11.74 rows=2 width=8) (actual time=0.003..0.003 rows=1 loops=347)

  • Index Cond: ((id_int = ref_people.id_int) AND (date_histo IS NOT NULL))
  • Filter: is_active
97. 0.347 1.735 ↑ 1.0 1 347

Result (cost=6.01..6.02 rows=1 width=8) (actual time=0.005..0.005 rows=1 loops=347)

98.          

Initplan (forResult)

99. 0.347 1.388 ↑ 1.0 1 347

Limit (cost=0.28..6.01 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=347)

100. 1.041 1.041 ↑ 2.0 1 347

Index Scan using ref_qualification_xperf3 on ref_qualification ref_qualification_7 (cost=0.28..11.74 rows=2 width=8) (actual time=0.003..0.003 rows=1 loops=347)

  • Index Cond: ((id_int = ref_people.id_int) AND (date_histo IS NOT NULL))
  • Filter: is_active
101. 0.347 1.388 ↑ 1.0 1 347

Result (cost=6.01..6.02 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=347)

102.          

Initplan (forResult)

103. 0.000 1.041 ↑ 1.0 1 347

Limit (cost=0.28..6.01 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=347)

104. 1.041 1.041 ↑ 2.0 1 347

Index Scan using ref_qualification_xperf3 on ref_qualification ref_qualification_8 (cost=0.28..11.74 rows=2 width=8) (actual time=0.003..0.003 rows=1 loops=347)

  • Index Cond: ((id_int = ref_people.id_int) AND (date_histo IS NOT NULL))
  • Filter: is_active
105. 0.347 1.388 ↑ 1.0 1 347

Result (cost=6.01..6.02 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=347)

106.          

Initplan (forResult)

107. 0.000 1.041 ↑ 1.0 1 347

Limit (cost=0.28..6.01 rows=1 width=8) (actual time=0.003..0.003 rows=1 loops=347)

108. 1.041 1.041 ↑ 2.0 1 347

Index Scan using ref_qualification_xperf3 on ref_qualification ref_qualification_9 (cost=0.28..11.74 rows=2 width=8) (actual time=0.003..0.003 rows=1 loops=347)

  • Index Cond: ((id_int = ref_people.id_int) AND (date_histo IS NOT NULL))
  • Filter: is_active
109. 0.000 1.475 ↑ 1.0 1 295

Result (cost=6.01..6.02 rows=1 width=8) (actual time=0.005..0.005 rows=1 loops=295)

110.          

Initplan (forResult)

111. 0.295 1.475 ↑ 1.0 1 295

Limit (cost=0.28..6.01 rows=1 width=8) (actual time=0.004..0.005 rows=1 loops=295)

112. 1.180 1.180 ↑ 2.0 1 295

Index Scan using ref_qualification_xperf3 on ref_qualification ref_qualification_10 (cost=0.28..11.74 rows=2 width=8) (actual time=0.003..0.004 rows=1 loops=295)

  • Index Cond: ((id_int = ref_people.id_int) AND (date_histo IS NOT NULL))
  • Filter: is_active
113. 0.230 1.380 ↑ 1.0 1 230

Result (cost=6.01..6.02 rows=1 width=8) (actual time=0.006..0.006 rows=1 loops=230)

114.          

Initplan (forResult)

115. 0.230 1.150 ↑ 1.0 1 230

Limit (cost=0.28..6.01 rows=1 width=8) (actual time=0.005..0.005 rows=1 loops=230)

116. 0.920 0.920 ↑ 2.0 1 230

Index Scan using ref_qualification_xperf3 on ref_qualification ref_qualification_11 (cost=0.28..11.74 rows=2 width=8) (actual time=0.004..0.004 rows=1 loops=230)

  • Index Cond: ((id_int = ref_people.id_int) AND (date_histo IS NOT NULL))
  • Filter: is_active
117. 0.000 1.150 ↑ 1.0 1 230

Result (cost=6.01..6.02 rows=1 width=8) (actual time=0.005..0.005 rows=1 loops=230)

118.          

Initplan (forResult)

119. 0.230 1.150 ↑ 1.0 1 230

Limit (cost=0.28..6.01 rows=1 width=8) (actual time=0.004..0.005 rows=1 loops=230)

120. 0.920 0.920 ↑ 2.0 1 230

Index Scan using ref_qualification_xperf3 on ref_qualification ref_qualification_12 (cost=0.28..11.74 rows=2 width=8) (actual time=0.004..0.004 rows=1 loops=230)

  • Index Cond: ((id_int = ref_people.id_int) AND (date_histo IS NOT NULL))
  • Filter: is_active
121. 0.117 0.585 ↑ 1.0 1 117

Result (cost=6.01..6.02 rows=1 width=8) (actual time=0.005..0.005 rows=1 loops=117)

122.          

Initplan (forResult)

123. 0.117 0.468 ↑ 1.0 1 117

Limit (cost=0.28..6.01 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=117)

124. 0.351 0.351 ↑ 2.0 1 117

Index Scan using ref_qualification_xperf3 on ref_qualification ref_qualification_13 (cost=0.28..11.74 rows=2 width=8) (actual time=0.003..0.003 rows=1 loops=117)

  • Index Cond: ((id_int = ref_people.id_int) AND (date_histo IS NOT NULL))
  • Filter: is_active
125. 2.082 27.760 ↑ 1.0 1 347

Aggregate (cost=21.12..21.13 rows=1 width=8) (actual time=0.080..0.080 rows=1 loops=347)

126. 5.146 25.678 ↓ 4.0 4 347

Nested Loop (cost=0.71..21.12 rows=1 width=4) (actual time=0.021..0.074 rows=4 loops=347)

127. 5.205 5.205 ↓ 7.5 15 347

Index Only Scan using ref_genealogy_xperf3 on ref_genealogy (cost=0.42..4.47 rows=2 width=4) (actual time=0.011..0.015 rows=15 loops=347)

  • Index Cond: ((id_int = ref_people.id_int) AND (id_filiale = ref_people.id_filiale) AND (level >= 1) AND (level <= 5))
  • Heap Fetches: 0
128. 15.327 15.327 ↓ 0.0 0 5,109

Index Scan using ref_people_xperf01 on ref_people filleul (cost=0.29..8.31 rows=1 width=4) (actual time=0.003..0.003 rows=0 loops=5,109)

  • Index Cond: (id_int = ref_genealogy.id_int_level)
  • Filter: ((id_statut <> 2) AND (id_type = 5))
  • Rows Removed by Filter: 1
129. 1.041 7.634 ↑ 1.0 1 347

Aggregate (cost=21.31..21.32 rows=1 width=8) (actual time=0.022..0.022 rows=1 loops=347)

130. 0.172 6.593 ↑ 1.0 1 347

Nested Loop (cost=0.71..21.31 rows=1 width=4) (actual time=0.010..0.019 rows=1 loops=347)

131. 1.735 1.735 ↓ 2.5 5 347

Index Only Scan using ref_genealogy_xperf3 on ref_genealogy ref_genealogy_1 (cost=0.42..4.66 rows=2 width=4) (actual time=0.004..0.005 rows=5 loops=347)

  • Index Cond: ((id_int = ref_people.id_int) AND (level = 1))
  • Heap Fetches: 0
132. 4.686 4.686 ↓ 0.0 0 1,562

Index Scan using ref_people_xperf01 on ref_people filleul_1 (cost=0.29..8.31 rows=1 width=4) (actual time=0.002..0.003 rows=0 loops=1,562)

  • Index Cond: (id_int = ref_genealogy_1.id_int_level)
  • Filter: ((id_statut <> 2) AND (id_type = 5))
  • Rows Removed by Filter: 1
133. 0.694 6.593 ↑ 1.0 1 347

Aggregate (cost=21.31..21.32 rows=1 width=8) (actual time=0.019..0.019 rows=1 loops=347)

134. 1.515 5.899 ↑ 1.0 1 347

Nested Loop (cost=0.71..21.31 rows=1 width=4) (actual time=0.007..0.017 rows=1 loops=347)

135. 1.388 1.388 ↓ 2.0 4 347

Index Only Scan using ref_genealogy_xperf3 on ref_genealogy ref_genealogy_2 (cost=0.42..4.66 rows=2 width=4) (actual time=0.003..0.004 rows=4 loops=347)

  • Index Cond: ((id_int = ref_people.id_int) AND (level = 2))
  • Heap Fetches: 0
136. 2.996 2.996 ↓ 0.0 0 1,498

Index Scan using ref_people_xperf01 on ref_people filleul_2 (cost=0.29..8.31 rows=1 width=4) (actual time=0.002..0.002 rows=0 loops=1,498)

  • Index Cond: (id_int = ref_genealogy_2.id_int_level)
  • Filter: ((id_statut <> 2) AND (id_type = 5))
  • Rows Removed by Filter: 1
137. 0.694 5.552 ↑ 1.0 1 347

Aggregate (cost=21.31..21.32 rows=1 width=8) (actual time=0.016..0.016 rows=1 loops=347)

138. 0.344 4.858 ↑ 1.0 1 347

Nested Loop (cost=0.71..21.31 rows=1 width=4) (actual time=0.005..0.014 rows=1 loops=347)

139. 1.388 1.388 ↓ 1.5 3 347

Index Only Scan using ref_genealogy_xperf3 on ref_genealogy ref_genealogy_3 (cost=0.42..4.66 rows=2 width=4) (actual time=0.003..0.004 rows=3 loops=347)

  • Index Cond: ((id_int = ref_people.id_int) AND (level = 3))
  • Heap Fetches: 0
140. 3.126 3.126 ↓ 0.0 0 1,042

Index Scan using ref_people_xperf01 on ref_people filleul_3 (cost=0.29..8.31 rows=1 width=4) (actual time=0.003..0.003 rows=0 loops=1,042)

  • Index Cond: (id_int = ref_genealogy_3.id_int_level)
  • Filter: ((id_statut <> 2) AND (id_type = 5))
  • Rows Removed by Filter: 1
141. 0.694 3.817 ↑ 1.0 1 347

Aggregate (cost=12.98..12.99 rows=1 width=8) (actual time=0.011..0.011 rows=1 loops=347)

142. 0.120 3.123 ↓ 0.0 0 347

Nested Loop (cost=0.71..12.98 rows=1 width=4) (actual time=0.004..0.009 rows=0 loops=347)

143. 1.041 1.041 ↓ 2.0 2 347

Index Only Scan using ref_genealogy_xperf3 on ref_genealogy ref_genealogy_4 (cost=0.42..4.65 rows=1 width=4) (actual time=0.003..0.003 rows=2 loops=347)

  • Index Cond: ((id_int = ref_people.id_int) AND (level = 4))
  • Heap Fetches: 0
144. 1.962 1.962 ↓ 0.0 0 654

Index Scan using ref_people_xperf01 on ref_people filleul_4 (cost=0.29..8.31 rows=1 width=4) (actual time=0.002..0.003 rows=0 loops=654)

  • Index Cond: (id_int = ref_genealogy_4.id_int_level)
  • Filter: ((id_statut <> 2) AND (id_type = 5))
  • Rows Removed by Filter: 1
145. 0.347 2.776 ↑ 1.0 1 347

Aggregate (cost=12.98..12.99 rows=1 width=8) (actual time=0.008..0.008 rows=1 loops=347)

146. 0.329 2.429 ↓ 0.0 0 347

Nested Loop (cost=0.71..12.98 rows=1 width=4) (actual time=0.004..0.007 rows=0 loops=347)

147. 1.041 1.041 ↑ 1.0 1 347

Index Only Scan using ref_genealogy_xperf3 on ref_genealogy ref_genealogy_5 (cost=0.42..4.65 rows=1 width=4) (actual time=0.003..0.003 rows=1 loops=347)

  • Index Cond: ((id_int = ref_people.id_int) AND (level = 5))
  • Heap Fetches: 0
148. 1.059 1.059 ↓ 0.0 0 353

Index Scan using ref_people_xperf01 on ref_people filleul_5 (cost=0.29..8.31 rows=1 width=4) (actual time=0.002..0.003 rows=0 loops=353)

  • Index Cond: (id_int = ref_genealogy_5.id_int_level)
  • Filter: ((id_statut <> 2) AND (id_type = 5))
  • Rows Removed by Filter: 1
149. 0.694 239.777 ↑ 1.0 1 347

Aggregate (cost=0.10..0.10 rows=1 width=32) (actual time=0.691..0.691 rows=1 loops=347)

150. 239.083 239.083 ↑ 1.0 1 347

CTE Scan on fees_amount (cost=0.00..0.09 rows=1 width=32) (actual time=0.677..0.689 rows=1 loops=347)

  • Filter: (agent = ref_people.id_int)
  • Rows Removed by Filter: 305