explain.depesz.com

PostgreSQL's explain analyze made readable

Result: U6SI

Settings
# exclusive inclusive rows x rows loops node
1. 5.626 55,508.825 ↓ 451.0 451 1

Unique (cost=5.35..10.13 rows=1 width=343) (actual time=13.688..55,508.825 rows=451 loops=1)

2.          

CTE plan

3. 5.979 5.979 ↓ 5,786.0 5,786 1

Index Scan using mod_plan_foto_idx_periodo on mod_plan_foto (cost=0.43..4.85 rows=1 width=27) (actual time=0.074..5.979 rows=5,786 loops=1)

  • Index Cond: ((periodo)::text = to_char((('now'::cstring)::date - '1 mon'::interval), 'YYYYMM'::text))
  • Filter: ((campo)::text <> 'diag'::text)
  • Rows Removed by Filter: 2630
4. 672.443 55,503.199 ↓ 8,416.0 8,416 1

Nested Loop (cost=0.50..5.27 rows=1 width=343) (actual time=13.686..55,503.199 rows=8,416 loops=1)

  • Join Filter: ((total_diag.rut_med = ppto.rut_med) AND (total_diag.cod_suc = ppto.cod_suc))
  • Rows Removed by Join Filter: 4418400
5. 626.722 48,182.116 ↓ 8,416.0 8,416 1

Nested Loop (cost=0.50..5.19 rows=1 width=271) (actual time=13.636..48,182.116 rows=8,416 loops=1)

  • Join Filter: ((total_diag.rut_med = ttl.rut_med) AND (total_diag.cod_suc = ttl.cod_suc))
  • Rows Removed by Join Filter: 4418400
6. 667.187 40,906.754 ↓ 8,416.0 8,416 1

Nested Loop (cost=0.50..5.15 rows=1 width=244) (actual time=13.601..40,906.754 rows=8,416 loops=1)

  • Join Filter: ((total_diag.rut_med = dev.rut_med) AND (total_diag.cod_suc = dev.cod_suc))
  • Rows Removed by Join Filter: 4418400
7. 659.187 33,346.863 ↓ 8,416.0 8,416 1

Nested Loop (cost=0.50..5.12 rows=1 width=217) (actual time=13.564..33,346.863 rows=8,416 loops=1)

  • Join Filter: ((total_diag.rut_med = efe.rut_med) AND (total_diag.cod_suc = efe.cod_suc))
  • Rows Removed by Join Filter: 4418400
8. 614.314 25,778.140 ↓ 8,416.0 8,416 1

Nested Loop (cost=0.50..5.08 rows=1 width=190) (actual time=13.509..25,778.140 rows=8,416 loops=1)

  • Join Filter: ((total_diag.rut_med = implan.rut_med) AND (total_diag.cod_suc = implan.cod_suc))
  • Rows Removed by Join Filter: 4418400
9. 595.983 17,143.378 ↓ 8,416.0 8,416 1

Nested Loop (cost=0.50..5.04 rows=1 width=163) (actual time=13.469..17,143.378 rows=8,416 loops=1)

  • Join Filter: ((total_diag.rut_med = orto.rut_med) AND (total_diag.cod_suc = orto.cod_suc))
  • Rows Removed by Join Filter: 4418400
10. 619.717 9,267.555 ↓ 8,416.0 8,416 1

Nested Loop (cost=0.50..5.00 rows=1 width=136) (actual time=13.432..9,267.555 rows=8,416 loops=1)

  • Join Filter: ((total_diag.rut_med = etto.rut_med) AND (total_diag.cod_suc = etto.cod_suc))
  • Rows Removed by Join Filter: 4418400
11. 642.097 1,755.134 ↓ 8,416.0 8,416 1

Nested Loop (cost=0.50..4.96 rows=1 width=109) (actual time=13.395..1,755.134 rows=8,416 loops=1)

  • Join Filter: ((total_diag.rut_med = mod.rut_med) AND (total_diag.cod_suc = mod.cod_suc))
  • Rows Removed by Join Filter: 4418400
12. 2.408 16.853 ↓ 526.0 526 1

Merge Join (cost=0.07..0.10 rows=1 width=54) (actual time=13.215..16.853 rows=526 loops=1)

  • Merge Cond: ((total_diag.rut_med = citas.rut_med) AND (total_diag.cod_suc = citas.cod_suc))
13. 0.694 11.658 ↓ 526.0 526 1

Sort (cost=0.03..0.04 rows=1 width=27) (actual time=11.336..11.658 rows=526 loops=1)

  • Sort Key: total_diag.rut_med, total_diag.cod_suc
  • Sort Method: quicksort Memory: 49kB
14. 10.964 10.964 ↓ 526.0 526 1

CTE Scan on plan total_diag (cost=0.00..0.02 rows=1 width=27) (actual time=0.080..10.964 rows=526 loops=1)

  • Filter: ((nombre)::text = '[TotalD]'::text)
  • Rows Removed by Filter: 5260
15. 1.270 2.787 ↓ 526.0 526 1

Sort (cost=0.03..0.04 rows=1 width=27) (actual time=1.873..2.787 rows=526 loops=1)

  • Sort Key: citas.rut_med, citas.cod_suc
  • Sort Method: quicksort Memory: 49kB
16. 1.517 1.517 ↓ 526.0 526 1

CTE Scan on plan citas (cost=0.00..0.02 rows=1 width=27) (actual time=0.005..1.517 rows=526 loops=1)

  • Filter: ((nombre)::text = '[Citas]'::text)
  • Rows Removed by Filter: 5260
17. 1,096.184 1,096.184 ↓ 8,416.0 8,416 526

Index Scan using mod_plan_foto_idx_periodo on mod_plan_foto mod (cost=0.43..4.85 rows=1 width=55) (actual time=0.021..2.084 rows=8,416 loops=526)

  • Index Cond: ((periodo)::text = to_char((('now'::cstring)::date - '1 mon'::interval), 'YYYYMM'::text))
18. 6,892.704 6,892.704 ↓ 526.0 526 8,416

CTE Scan on plan etto (cost=0.00..0.02 rows=1 width=27) (actual time=0.001..0.819 rows=526 loops=8,416)

  • Filter: ((nombre)::text = '[ETTO]'::text)
  • Rows Removed by Filter: 5260
19. 7,279.840 7,279.840 ↓ 526.0 526 8,416

CTE Scan on plan orto (cost=0.00..0.03 rows=1 width=27) (actual time=0.001..0.865 rows=526 loops=8,416)

  • Filter: (((nombre)::text = '[ETTO]'::text) AND ((campo)::text = 'primeros'::text))
  • Rows Removed by Filter: 5260
20. 8,020.448 8,020.448 ↓ 526.0 526 8,416

CTE Scan on plan implan (cost=0.00..0.03 rows=1 width=27) (actual time=0.001..0.953 rows=526 loops=8,416)

  • Filter: (((campo)::text = 'primeros'::text) AND ((nombre)::text = '[IMPLAN]'::text))
  • Rows Removed by Filter: 5260
21. 6,909.536 6,909.536 ↓ 526.0 526 8,416

CTE Scan on plan efe (cost=0.00..0.02 rows=1 width=27) (actual time=0.001..0.821 rows=526 loops=8,416)

  • Filter: ((nombre)::text = '[EFE]'::text)
  • Rows Removed by Filter: 5260
22. 6,892.704 6,892.704 ↓ 526.0 526 8,416

CTE Scan on plan dev (cost=0.00..0.02 rows=1 width=27) (actual time=0.002..0.819 rows=526 loops=8,416)

  • Filter: ((nombre)::text = '[Dev]'::text)
  • Rows Removed by Filter: 5260
23. 6,648.640 6,648.640 ↓ 526.0 526 8,416

CTE Scan on plan ttl (cost=0.00..0.02 rows=1 width=27) (actual time=0.002..0.790 rows=526 loops=8,416)

  • Filter: ((nombre)::text = '[TotalFacturado]'::text)
  • Rows Removed by Filter: 5260
24. 6,648.640 6,648.640 ↓ 526.0 526 8,416

CTE Scan on plan ppto (cost=0.00..0.02 rows=1 width=27) (actual time=0.002..0.790 rows=526 loops=8,416)

  • Filter: ((nombre)::text = '[Presupuesto]'::text)
  • Rows Removed by Filter: 5260