From: | MIGUEL CANCHAS <mcanchas(at)tsr(dot)com(dot)pe> |
---|---|
To: | pgsql-es-ayuda(at)postgresql(dot)org |
Subject: | por que SEQ SCAN Y NO INDEX SCAN |
Date: | 2008-04-18 14:06:39 |
Message-ID: | 410117BB01F4D611B73A00010331DD2403B58C68@tsnt.tsr.com.pe |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-es-ayuda |
Tengo esta consulta, segun tengo entendido tendria que hacerse un index scan
y no un seq scan , por que ?
Tengo indices en las tablas que corresponde a las uniones que hago
EXPLAIN ANALYSE SELECT
public.hrt1.idpartida,
public.hrt1.anio_partida,
public.hrt1.idbarca,
public.hrt1.idcliente,
public.hrt1.guia,
public.hrt1.fecha_partida,
public.hrt1.idservicio,
public.hrt1.idcolor,
public.hrt1.xreceta,
public.hrt1.obs_partida,
public.hrt1.idope_arma,
public.hrt1.fecha_arma,
public.hrt1.hini_arma,
public.hrt1.hfin_arma,
public.hrt1.idope_emba1,
public.hrt1.idope_emba2,
public.hrt1.fecha_emba,
public.hrt1.hini_emba,
public.hrt1.hfin_emba,
public.hrt1.receta_partida,
public.hrt1.hora_partida,
public.hrt1.ubica_partida,
public.hrt1.acabado_partida,
public.mclientes.nomcliente,
public.mcolores.nomcolor
FROM
public.hrt1
INNER JOIN public.mclientes ON (public.hrt1.idcliente =
public.mclientes.idcliente)
INNER JOIN public.mcolores ON (public.hrt1.idcolor =
public.mcolores.idcolor)
******************////////////////////////*******************************///
/////////////
"Hash Join (cost=10633.05..21300.76 rows=64519 width=270) (actual
time=289.696..2494.552 rows=57075 loops=1)"
" Hash Cond: (hrt1.idcliente = mclientes.idcliente)"
" -> Hash Join (cost=10537.18..20237.10 rows=64519 width=246) (actual
time=286.788..2425.791 rows=57819 loops=1)"
" Hash Cond: ((hrt1.idcolor)::text = (mcolores.idcolor)::text)"
" -> Seq Scan on hrt1 (cost=0.00..3009.19 rows=64519 width=227)
(actual time=0.006..55.586 rows=64519 loops=1)"
" -> Hash (cost=7338.30..7338.30 rows=150230 width=33) (actual
time=285.213..285.213 rows=150230 loops=1)"
" -> Seq Scan on mcolores (cost=0.00..7338.30 rows=150230
width=33) (actual time=20.015..164.537 rows=150230 loops=1)"
" -> Hash (cost=75.39..75.39 rows=1639 width=32) (actual
time=2.890..2.890 rows=1639 loops=1)"
" -> Seq Scan on mclientes (cost=0.00..75.39 rows=1639 width=32)
(actual time=0.345..1.739 rows=1639 loops=1)"
"Total runtime: 2510.053 ms"
From | Date | Subject | |
---|---|---|---|
Next Message | Marcos Saldivar | 2008-04-18 14:38:59 | JAVA ORM con soporte para PostgreSQL |
Previous Message | Patricio Castro | 2008-04-18 13:36:36 | Re: RE: [pgsql-es-ayuda] Conexión - Semi off-topic |