explain.depesz.com

PostgreSQL's explain analyze made readable

Result: uCQ4

Settings
# exclusive inclusive rows x rows loops node
1. 0.015 8,178.673 ↑ 1.0 1 1

Nested Loop Left Join (cost=289,320.73..939,379.77 rows=1 width=8) (actual time=8,178.665..8,178.673 rows=1 loops=1)

  • Filter: ((cp.cod_pac IS NULL) OR (cd.folio_diag IS NULL))
2. 0.048 8,178.655 ↑ 2,036.0 1 1

Nested Loop Left Join (cost=289,320.30..922,806.12 rows=2,036 width=22) (actual time=8,178.648..8,178.655 rows=1 loops=1)

  • Join Filter: ((cp.cod_pac)::double precision = pac.cod_pac)
3. 0.016 7,529.633 ↑ 1.0 1 1

Nested Loop Anti Join (cost=272,355.31..756,939.51 rows=1 width=8) (actual time=7,529.627..7,529.633 rows=1 loops=1)

  • Join Filter: ((mov.cod_pac)::double precision = pac.cod_pac)
4. 0.009 2,703.264 ↑ 1.0 1 1

Nested Loop Anti Join (cost=198,551.84..249,336.86 rows=1 width=8) (actual time=2,703.258..2,703.264 rows=1 loops=1)

  • Join Filter: (a.cod_pac = pac.cod_pac)
5. 0.005 2,703.176 ↑ 1.0 1 1

Nested Loop Anti Join (cost=198,551.40..249,282.03 rows=1 width=8) (actual time=2,703.171..2,703.176 rows=1 loops=1)

  • Join Filter: ((cp_1.cod_pac)::double precision = pac.cod_pac)
6. 0.043 0.043 ↑ 1.0 1 1

Index Only Scan using paciente_pkey on paciente pac (cost=0.43..8.45 rows=1 width=8) (actual time=0.038..0.043 rows=1 loops=1)

  • Index Cond: (cod_pac = '1254944'::double precision)
  • Heap Fetches: 1
7. 0.001 2,703.128 ↓ 0.0 0 1

Nested Loop (cost=198,550.98..249,273.55 rows=3,342 width=6) (actual time=2,703.128..2,703.128 rows=0 loops=1)

8. 0.096 2,703.127 ↓ 0.0 0 1

Hash Join (cost=198,550.54..238,073.33 rows=8,919 width=14) (actual time=2,703.127..2,703.127 rows=0 loops=1)

  • Hash Cond: (ct.folio_presu = cp_1.folio_presu)
9. 0.008 0.008 ↑ 1,783,898.0 1 1

Seq Scan on cabe_tratamiento ct (cost=0.00..32,743.98 rows=1,783,898 width=16) (actual time=0.008..0.008 rows=1 loops=1)

10. 0.002 2,703.023 ↓ 0.0 0 1

Hash (cost=198,289.49..198,289.49 rows=20,884 width=14) (actual time=2,703.023..2,703.023 rows=0 loops=1)

  • Buckets: 32,768 Batches: 1 Memory Usage: 256kB
11. 2,703.021 2,703.021 ↓ 0.0 0 1

Seq Scan on cabe_presu cp_1 (cost=0.00..198,289.49 rows=20,884 width=14) (actual time=2,703.021..2,703.021 rows=0 loops=1)

  • Filter: ((cod_pac)::double precision = '1254944'::double precision)
  • Rows Removed by Filter: 3,994,963
12. 0.000 0.000 ↓ 0.0 0

Index Scan using deta_tratamiento_folio_trata_idx on deta_tratamiento dt (cost=0.43..1.25 rows=1 width=8) (never executed)

  • Index Cond: (folio_trata = ct.folio_trata)
  • Filter: ((cod_sucursal > date_part('epoch'::text, date_trunc('day'::text, (now() - '6 mons'::interval)))) AND (cod_sucursal < date_part('epoch'::text, (('now'::cstring)::date)::timestamp without time zone)))
13. 0.079 0.079 ↓ 0.0 0 1

Index Scan using agenda_idx3 on agenda a (cost=0.43..54.81 rows=2 width=8) (actual time=0.079..0.079 rows=0 loops=1)

  • Index Cond: (cod_pac = '1254944'::double precision)
  • Filter: ((cod_serv = '3'::double precision) AND (fec_agen < ('now'::cstring)::date) AND (fec_agen > date_trunc('day'::text, (now() - '6 mons'::interval))))
  • Rows Removed by Filter: 3
14. 4,092.041 4,826.353 ↓ 0.0 0 1

Bitmap Heap Scan on c_maestro_mov mov (cost=73,803.48..507,602.62 rows=85 width=6) (actual time=4,826.353..4,826.353 rows=0 loops=1)

  • Recheck Cond: ((tipo_mov)::text = 'AC'::text)
  • Filter: ((activo = '1'::double precision) AND ((cod_pac)::double precision = '1254944'::double precision) AND ((fecha_tra)::double precision < date_part('epoch'::text, (('now'::cstring)::date)::timestamp without time zone)) AND ((fecha_tra)::double precision > date_part('epoch'::text, date_trunc('day'::text, ((now())::date - '6 mons'::interval)))))
  • Rows Removed by Filter: 3,682,784
  • Heap Blocks: exact=235,370
15. 734.312 734.312 ↑ 1.0 3,683,183 1

Bitmap Index Scan on c_maestro_mov_idx_tipo_mov (cost=0.00..73,803.46 rows=3,693,736 width=0) (actual time=734.312..734.312 rows=3,683,183 loops=1)

  • Index Cond: ((tipo_mov)::text = 'AC'::text)
16. 478.225 648.974 ↓ 0.0 0 1

Bitmap Heap Scan on cabe_presu cp (cost=16,964.98..165,836.08 rows=2,036 width=14) (actual time=648.974..648.974 rows=0 loops=1)

  • Recheck Cond: ((fecha_presu > date_trunc('day'::text, (now() - '6 mons'::interval))) AND (fecha_presu < ('now'::cstring)::date))
  • Filter: ((cod_pac)::double precision = '1254944'::double precision)
  • Rows Removed by Filter: 393,719
  • Heap Blocks: exact=16,270
17. 170.749 170.749 ↓ 1.0 413,465 1

Bitmap Index Scan on cabe_presu_idx (cost=0.00..16,964.47 rows=407,203 width=0) (actual time=170.749..170.749 rows=413,465 loops=1)

  • Index Cond: ((fecha_presu > date_trunc('day'::text, (now() - '6 mons'::interval))) AND (fecha_presu < ('now'::cstring)::date))
18. 0.003 0.003 ↓ 0.0 0 1

Index Scan using cabe_diag_idx on cabe_diag cd (cost=0.43..8.13 rows=1 width=8) (actual time=0.003..0.003 rows=0 loops=1)

  • Index Cond: (folio_diag = cp.folio_diag)
  • Filter: (cod_esp <> '23'::numeric)