explain.depesz.com

PostgreSQL's explain analyze made readable

Result: PjP5F

Settings
# exclusive inclusive rows x rows loops node
1. 0.172 3,536.669 ↑ 1.0 100 1

Limit (cost=190,065.80..190,066.05 rows=100 width=737) (actual time=3,536.395..3,536.669 rows=100 loops=1)

2. 251.093 3,536.497 ↑ 523.1 100 1

Sort (cost=190,065.80..190,196.57 rows=52,306 width=737) (actual time=3,536.393..3,536.497 rows=100 loops=1)

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

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

  • Merge Cond: (empresas.id = empresas_sucursales.empresa_id)
4. 347.050 347.050 ↑ 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.042..347.050 rows=52,216 loops=1)

5. 610.632 610.632 ↓ 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.012..610.632 rows=52,357 loops=1)

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

SubPlan (forMerge Join)

7. 261.785 1,675.424 ↑ 1.0 1 52,357

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

8. 1,413.639 1,413.639 ↑ 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.027..0.027 rows=1 loops=52,357)

  • Index Cond: (nro_patronal = empresas_sucursales.nro_patronal)