explain.depesz.com

PostgreSQL's explain analyze made readable

Result: gFmZ

Settings
# exclusive inclusive rows x rows loops node
1. 0.010 8,717.591 ↑ 1.0 1 1

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

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

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

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

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

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

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

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

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

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

Index Only Scan using idx_cod_pac_double on paciente pac (cost=0.43..8.45 rows=1 width=8) (actual time=0.022..0.026 rows=1 loops=1)

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

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

8. 0.101 3,394.956 ↓ 0.0 0 1

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

  • Hash Cond: (ct.folio_presu = cp_1.folio_presu)
9. 0.007 0.007 ↑ 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.007..0.007 rows=1 loops=1)

10. 0.001 3,394.848 ↓ 0.0 0 1

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

  • Buckets: 32768 Batches: 1 Memory Usage: 256kB
11. 3,394.847 3,394.847 ↓ 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,394.847..3,394.847 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.072 0.072 ↓ 0.0 0 1

Index Scan using agenda_idx3 on agenda a (cost=0.43..54.81 rows=2 width=8) (actual time=0.072..0.072 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,352.830 4,868.140 ↓ 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,868.140..4,868.140 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. 515.310 515.310 ↑ 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=515.310..515.310 rows=3,683,183 loops=1)

  • Index Cond: ((tipo_mov)::text = 'AC'::text)
16. 328.391 454.299 ↓ 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=454.299..454.299 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. 125.908 125.908 ↓ 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=125.908..125.908 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.004 0.004 ↓ 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.004..0.004 rows=0 loops=1)

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