explain.depesz.com

PostgreSQL's explain analyze made readable

Result: I58Q

Settings
# exclusive inclusive rows x rows loops node
1. 25.335 25,744.541 ↓ 15.0 15 1

Unique (cost=5.60..10.61 rows=1 width=342) (actual time=11.367..25,744.541 rows=15 loops=1)

2.          

CTE plan

3. 9.447 9.447 ↓ 330.0 330 1

Index Scan using mod_plan_foto_idx_periodo on mod_plan_foto (cost=0.43..5.09 rows=1 width=27) (actual time=0.127..9.447 rows=330 loops=1)

  • Index Cond: ((periodo)::text = to_char((('now'::cstring)::date - '1 mon'::interval), 'YYYYMM'::text))
  • Filter: (((campo)::text <> 'diag'::text) AND (cod_suc = 1))
  • Rows Removed by Filter: 17926
4. 1,074.717 25,719.206 ↓ 245,760.0 245,760 1

Nested Loop (cost=0.50..5.51 rows=1 width=342) (actual time=11.366..25,719.206 rows=245,760 loops=1)

  • Join Filter: (total_diag.rut_med = ppto.rut_med)
  • Rows Removed by Join Filter: 3440640
5. 314.485 12,848.009 ↓ 122,880.0 122,880 1

Nested Loop (cost=0.50..5.43 rows=1 width=238) (actual time=11.324..12,848.009 rows=122,880 loops=1)

  • Join Filter: (total_diag.rut_med = ttl.rut_med)
  • Rows Removed by Join Filter: 1720320
6. 146.960 6,635.284 ↓ 61,440.0 61,440 1

Nested Loop (cost=0.50..5.39 rows=1 width=215) (actual time=11.294..6,635.284 rows=61,440 loops=1)

  • Join Filter: (total_diag.rut_med = dev.rut_med)
  • Rows Removed by Join Filter: 860160
7. 71.908 3,477.764 ↓ 30,720.0 30,720 1

Nested Loop (cost=0.50..5.35 rows=1 width=192) (actual time=11.265..3,477.764 rows=30,720 loops=1)

  • Join Filter: (total_diag.rut_med = efe.rut_med)
  • Rows Removed by Join Filter: 430080
8. 40.442 1,900.576 ↓ 15,360.0 15,360 1

Nested Loop (cost=0.50..5.32 rows=1 width=169) (actual time=11.236..1,900.576 rows=15,360 loops=1)

  • Join Filter: (total_diag.rut_med = implan.rut_med)
  • Rows Removed by Join Filter: 215040
9. 21.627 1,046.054 ↓ 7,680.0 7,680 1

Nested Loop (cost=0.50..5.28 rows=1 width=146) (actual time=11.203..1,046.054 rows=7,680 loops=1)

  • Join Filter: (total_diag.rut_med = orto.rut_med)
  • Rows Removed by Join Filter: 107520
10. 10.113 636.587 ↓ 3,840.0 3,840 1

Nested Loop (cost=0.50..5.24 rows=1 width=123) (actual time=11.170..636.587 rows=3,840 loops=1)

  • Join Filter: (total_diag.rut_med = etto.rut_med)
  • Rows Removed by Join Filter: 53760
11. 8.411 436.394 ↓ 1,920.0 1,920 1

Nested Loop (cost=0.50..5.20 rows=1 width=100) (actual time=11.137..436.394 rows=1,920 loops=1)

  • Join Filter: (total_diag.rut_med = mod.rut_med)
  • Rows Removed by Join Filter: 26880
12. 0.403 10.503 ↓ 60.0 60 1

Merge Join (cost=0.07..0.10 rows=1 width=54) (actual time=9.900..10.503 rows=60 loops=1)

  • Merge Cond: (total_diag.rut_med = citas.rut_med)
13. 0.076 9.791 ↓ 30.0 30 1

Sort (cost=0.04..0.04 rows=1 width=27) (actual time=9.752..9.791 rows=30 loops=1)

  • Sort Key: total_diag.rut_med
  • Sort Method: quicksort Memory: 26kB
14. 9.715 9.715 ↓ 30.0 30 1

CTE Scan on plan total_diag (cost=0.00..0.03 rows=1 width=27) (actual time=0.148..9.715 rows=30 loops=1)

  • Filter: (((nombre)::text = '[TotalD]'::text) AND (cod_suc = 1))
  • Rows Removed by Filter: 300
15. 0.201 0.309 ↓ 59.0 59 1

Sort (cost=0.04..0.04 rows=1 width=27) (actual time=0.143..0.309 rows=59 loops=1)

  • Sort Key: citas.rut_med
  • Sort Method: quicksort Memory: 26kB
16. 0.108 0.108 ↓ 30.0 30 1

CTE Scan on plan citas (cost=0.00..0.03 rows=1 width=27) (actual time=0.007..0.108 rows=30 loops=1)

  • Filter: ((cod_suc = 1) AND ((nombre)::text = '[Citas]'::text))
  • Rows Removed by Filter: 300
17. 417.480 417.480 ↓ 480.0 480 60

Index Scan using mod_plan_foto_idx_periodo on mod_plan_foto mod (cost=0.43..5.09 rows=1 width=54) (actual time=0.065..6.958 rows=480 loops=60)

  • Index Cond: ((periodo)::text = to_char((('now'::cstring)::date - '1 mon'::interval), 'YYYYMM'::text))
  • Filter: (cod_suc = 1)
  • Rows Removed by Filter: 17776
18. 190.080 190.080 ↓ 30.0 30 1,920

CTE Scan on plan etto (cost=0.00..0.03 rows=1 width=27) (actual time=0.003..0.099 rows=30 loops=1,920)

  • Filter: ((cod_suc = 1) AND ((nombre)::text = '[ETTO]'::text))
  • Rows Removed by Filter: 300
19. 387.840 387.840 ↓ 30.0 30 3,840

CTE Scan on plan orto (cost=0.00..0.03 rows=1 width=27) (actual time=0.003..0.101 rows=30 loops=3,840)

  • Filter: ((cod_suc = 1) AND ((nombre)::text = '[ETTO]'::text) AND ((campo)::text = 'primeros'::text))
  • Rows Removed by Filter: 300
20. 814.080 814.080 ↓ 30.0 30 7,680

CTE Scan on plan implan (cost=0.00..0.03 rows=1 width=27) (actual time=0.002..0.106 rows=30 loops=7,680)

  • Filter: ((cod_suc = 1) AND ((campo)::text = 'primeros'::text) AND ((nombre)::text = '[IMPLAN]'::text))
  • Rows Removed by Filter: 300
21. 1,505.280 1,505.280 ↓ 30.0 30 15,360

CTE Scan on plan efe (cost=0.00..0.03 rows=1 width=27) (actual time=0.002..0.098 rows=30 loops=15,360)

  • Filter: ((cod_suc = 1) AND ((nombre)::text = '[EFE]'::text))
  • Rows Removed by Filter: 300
22. 3,010.560 3,010.560 ↓ 30.0 30 30,720

CTE Scan on plan dev (cost=0.00..0.03 rows=1 width=27) (actual time=0.001..0.098 rows=30 loops=30,720)

  • Filter: ((cod_suc = 1) AND ((nombre)::text = '[Dev]'::text))
  • Rows Removed by Filter: 300
23. 5,898.240 5,898.240 ↓ 30.0 30 61,440

CTE Scan on plan ttl (cost=0.00..0.03 rows=1 width=27) (actual time=0.001..0.096 rows=30 loops=61,440)

  • Filter: ((cod_suc = 1) AND ((nombre)::text = '[TotalFacturado]'::text))
  • Rows Removed by Filter: 300
24. 11,796.480 11,796.480 ↓ 30.0 30 122,880

CTE Scan on plan ppto (cost=0.00..0.03 rows=1 width=27) (actual time=0.001..0.096 rows=30 loops=122,880)

  • Filter: ((cod_suc = 1) AND ((nombre)::text = '[Presupuesto]'::text))
  • Rows Removed by Filter: 300
Planning time : 36.460 ms