explain.depesz.com

PostgreSQL's explain analyze made readable

Result: JkJ

Settings
# exclusive inclusive rows x rows loops node
1. 0.155 2,670.647 ↑ 1.0 100 1

Limit (cost=190,067.72..190,067.97 rows=100 width=736) (actual time=2,670.418..2,670.647 rows=100 loops=1)

2. 279.288 2,670.492 ↑ 523.1 100 1

Sort (cost=190,067.72..190,198.48 rows=52,306 width=736) (actual time=2,670.415..2,670.492 rows=100 loops=1)

  • Sort Key: empresas_sucursales.nro_patronal
  • Sort Method: top-N heapsort Memory: 86kB
3. 742.708 2,391.204 ↓ 1.0 52,357 1

Merge Join (cost=0.70..187,545.56 rows=52,306 width=440) (actual time=0.101..2,391.204 rows=52,357 loops=1)

  • Merge Cond: (empresas.id = empresas_sucursales.empresa_id)
4. 166.303 166.303 ↑ 1.0 52,216 1

Index Scan Backward using empresas_pk on empresas (cost=0.29..3,932.39 rows=52,216 width=89) (actual time=0.018..166.303 rows=52,216 loops=1)

5. 487.410 487.410 ↓ 1.0 52,357 1

Index Scan Backward using empresas_sucursales_empresa_id_nro_patronal_idx on empresas_sucursales (cost=0.41..5,779.34 rows=52,306 width=359) (actual time=0.014..487.410 rows=52,357 loops=1)

  • Filter: (type = 1)
  • Rows Removed by Filter: 6653
6.          

SubPlan (forMerge Join)

7. 261.785 994.783 ↑ 1.0 1 52,357

Limit (cost=0.42..3.37 rows=1 width=20) (actual time=0.018..0.019 rows=1 loops=52,357)

8. 732.998 732.998 ↑ 2.0 1 52,357

Index Scan using cambio_situacion_empresa_nro_patronal_fecha_creacion_id_cam_idx on cambio_situacion_empresa (cost=0.42..6.32 rows=2 width=20) (actual time=0.014..0.014 rows=1 loops=52,357)

  • Index Cond: (nro_patronal = empresas_sucursales.nro_patronal)