explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 3H0M

Settings
# exclusive inclusive rows x rows loops node
1. 0.013 3,847.237 ↑ 1.0 1 1

Nested Loop Left Join (cost=215,517.69..431,925.84 rows=1 width=8) (actual time=3,847.230..3,847.237 rows=1 loops=1)

  • Filter: ((cp.cod_pac IS NULL) OR (cd.folio_diag IS NULL))
2. 0.021 3,847.222 ↑ 2,036.0 1 1

Nested Loop Left Join (cost=215,517.26..415,352.19 rows=2,036 width=22) (actual time=3,847.217..3,847.222 rows=1 loops=1)

  • Join Filter: ((cp.cod_pac)::double precision = pac.cod_pac)
3. 0.023 3,253.995 ↑ 1.0 1 1

Nested Loop Anti Join (cost=198,552.27..249,485.57 rows=1 width=8) (actual time=3,253.991..3,253.995 rows=1 loops=1)

4. 0.009 3,253.942 ↑ 1.0 1 1

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

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

Nested Loop Anti Join (cost=198,551.40..249,282.03 rows=1 width=8) (actual time=3,253.850..3,253.853 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.040..0.043 rows=1 loops=1)

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

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

8. 0.075 3,253.804 ↓ 0.0 0 1

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

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

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

Index Scan using agenda_idx3 on agenda a (cost=0.43..54.81 rows=2 width=8) (actual time=0.080..0.080 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. 0.030 0.030 ↓ 0.0 0 1

Index Scan using c_maestro_mov_idx1 on c_maestro_mov mov (cost=0.44..74.57 rows=1 width=6) (actual time=0.030..0.030 rows=0 loops=1)

  • Index Cond: (cod_pac = (pac.cod_pac)::numeric)
  • Filter: (((tipo_mov)::text = 'AC'::text) AND (activo = '1'::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: 2
15. 422.107 593.206 ↓ 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=593.206..593.206 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
16. 171.099 171.099 ↓ 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=171.099..171.099 rows=413,465 loops=1)

  • Index Cond: ((fecha_presu > date_trunc('day'::text, (now() - '6 mons'::interval))) AND (fecha_presu < ('now'::cstring)::date))
17. 0.002 0.002 ↓ 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.002..0.002 rows=0 loops=1)

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