explain.depesz.com

PostgreSQL's explain analyze made readable

Result: VLsh

Settings
# exclusive inclusive rows x rows loops node
1. 627.664 3,607.919 ↓ 1.0 52,357 1

Merge Join (cost=0.82..187,543.64 rows=52,306 width=441) (actual time=0.436..3,607.919 rows=52,357 loops=1)

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

Index Scan Backward using empresas_pk on empresas (cost=0.29..3,930.46 rows=52,216 width=90) (actual time=0.320..375.582 rows=52,216 loops=1)

3. 772.178 772.178 ↓ 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.020..772.178 rows=52,357 loops=1)

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

SubPlan (forMerge Join)

5. 261.785 1,832.495 ↑ 1.0 1 52,357

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

6. 1,570.710 1,570.710 ↑ 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.030..0.030 rows=1 loops=52,357)

  • Index Cond: (nro_patronal = empresas_sucursales.nro_patronal)