explain.depesz.com

PostgreSQL's explain analyze made readable

Result: QSz7W

Settings
# exclusive inclusive rows x rows loops node
1. 0.013 46,415.659 ↓ 100.0 100 1

Limit (cost=835,738.96..835,738.97 rows=1 width=24) (actual time=46,415.584..46,415.659 rows=100 loops=1)

2. 0.041 46,415.646 ↓ 100.0 100 1

Unique (cost=835,738.96..835,738.97 rows=1 width=24) (actual time=46,415.584..46,415.646 rows=100 loops=1)

3. 4,936.525 46,415.605 ↓ 106.0 106 1

Sort (cost=835,738.96..835,738.96 rows=1 width=24) (actual time=46,415.581..46,415.605 rows=106 loops=1)

  • Sort Key: t.idturno, t.turnosistemaexterno, p.nrofcr, tp.procesado
  • Sort Method: external merge Disk: 61704kB
4. 2,376.649 41,479.080 ↓ 2,013,018.0 2,013,018 1

Nested Loop (cost=29,832.93..835,738.95 rows=1 width=24) (actual time=401.008..41,479.080 rows=2,013,018 loops=1)

5. 2,705.196 31,464.795 ↓ 1,909,409.0 1,909,409 1

Nested Loop (cost=29,832.50..835,736.06 rows=1 width=24) (actual time=400.988..31,464.795 rows=1,909,409 loops=1)

6. 4,908.553 13,484.327 ↓ 1,909,409.0 1,909,409 1

Hash Left Join (cost=29,832.08..835,730.84 rows=1 width=21) (actual time=400.959..13,484.327 rows=1,909,409 loops=1)

  • Hash Cond: (t.idturno = tp.idturno)
  • Filter: ((tp.procesado = 0) OR (tp.procesado = (-1)) OR (tp.procesado IS NULL))
  • Rows Removed by Filter: 967664
7. 8,175.125 8,175.125 ↑ 1.0 2,877,073 1

Seq Scan on turno t (cost=0.00..736,653.32 rows=2,884,308 width=17) (actual time=0.010..8,175.125 rows=2,877,073 loops=1)

  • Filter: ((turnosistemaexterno IS NOT NULL) AND (estadoinfres = ANY ('{D,L,X}'::bpchar[])))
  • Rows Removed by Filter: 1304822
8. 209.234 400.649 ↓ 1.0 967,664 1

Hash (cost=13,957.59..13,957.59 rows=967,559 width=8) (actual time=400.649..400.649 rows=967,664 loops=1)

  • Buckets: 131072 Batches: 2 Memory Usage: 18915kB
9. 191.415 191.415 ↓ 1.0 967,664 1

Seq Scan on turnosprocesados tp (cost=0.00..13,957.59 rows=967,559 width=8) (actual time=0.029..191.415 rows=967,664 loops=1)

10. 15,275.272 15,275.272 ↑ 1.0 1 1,909,409

Index Scan using pk_paciente on paciente p (cost=0.42..5.22 rows=1 width=11) (actual time=0.008..0.008 rows=1 loops=1,909,409)

  • Index Cond: (idpaciente = t.idpaciente)
11. 7,637.636 7,637.636 ↑ 2.0 1 1,909,409

Index Only Scan using ie_turnodocumento_idturno on turnodocumento td (cost=0.43..2.86 rows=2 width=4) (actual time=0.004..0.004 rows=1 loops=1,909,409)

  • Index Cond: (idturno = t.idturno)
  • Heap Fetches: 1140
Planning time : 1.683 ms
Execution time : 46,431.459 ms