explain.depesz.com

PostgreSQL's explain analyze made readable

Result: DBAO

Settings
# exclusive inclusive rows x rows loops node
1. 0.012 9,522.739 ↑ 1.0 1 1

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

  • Filter: ((cp.cod_pac IS NULL) OR (cd.folio_diag IS NULL))
2. 0.052 9,522.724 ↑ 2,036.0 1 1

Nested Loop Left Join (cost=289,320.30..922,806.12 rows=2,036 width=22) (actual time=9,522.718..9,522.724 rows=1 loops=1)

  • Join Filter: ((cp.cod_pac)::double precision = pac.cod_pac)
3. 0.014 8,921.553 ↑ 1.0 1 1

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

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

Nested Loop Anti Join (cost=198,551.84..249,336.86 rows=1 width=8) (actual time=3,362.131..3,362.136 rows=1 loops=1)

  • Join Filter: (a.cod_pac = pac.cod_pac)
5. 0.003 3,362.049 ↑ 1.0 1 1

Nested Loop Anti Join (cost=198,551.40..249,282.03 rows=1 width=8) (actual time=3,362.046..3,362.049 rows=1 loops=1)

  • Join Filter: ((cp_1.cod_pac)::double precision = pac.cod_pac)
6. 0.050 0.050 ↑ 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.047..0.050 rows=1 loops=1)

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

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

8. 0.096 3,361.995 ↓ 0.0 0 1

Hash Join (cost=198,550.54..238,073.33 rows=8,919 width=14) (actual time=3,361.995..3,361.995 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 3,361.891 ↓ 0.0 0 1

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

  • Buckets: 32768 Batches: 1 Memory Usage: 256kB
11. 3,361.889 3,361.889 ↓ 0.0 0 1

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

  • Filter: ((cod_pac)::double precision = '1254944'::double precision)
  • Rows Removed by Filter: 3994963
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.078 0.078 ↓ 0.0 0 1

Index Scan using agenda_idx3 on agenda a (cost=0.43..54.81 rows=2 width=8) (actual time=0.078..0.078 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,913.516 5,559.403 ↓ 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=5,559.403..5,559.403 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: 3682784
  • Heap Blocks: exact=235370
15. 645.887 645.887 ↑ 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=645.887..645.887 rows=3,683,183 loops=1)

  • Index Cond: ((tipo_mov)::text = 'AC'::text)
16. 427.242 601.119 ↓ 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=601.119..601.119 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: 393719
  • Heap Blocks: exact=16270
17. 173.877 173.877 ↓ 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=173.877..173.877 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)
Planning time : 3.642 ms