From: | raul andrez gutierrez alejo <raulandrez(at)gmail(dot)com> |
---|---|
To: | William Diaz Pabón <widipa(at)gmail(dot)com> |
Cc: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, PostgreSQL Español Ayuda <pgsql-es-ayuda(at)postgresql(dot)org> |
Subject: | Re: Consulta no usa los indices |
Date: | 2014-03-14 16:49:52 |
Message-ID: | CAHQFj73DgM-0FBibbQPF+nFs53CwnUJEgVQwrLcX6aUhf6B9sg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-es-ayuda |
exclusive es el tiempo en que retorna el primer dato, inclusive el el
tiempo en que retorna el ultimo dato.
2014-03-14 11:18 GMT-05:00 William Diaz Pabón <widipa(at)gmail(dot)com>:
> Raul, de la pagina que me pasaste, que significa el exclusive<http://explain.depesz.com/s/1GRQ#colorize-exclusive>
> inclusive <http://explain.depesz.com/s/1GRQ#colorize-inclusive>
>
>
> 2014-03-14 11:09 GMT-05:00 raul andrez gutierrez alejo <
> raulandrez(at)gmail(dot)com>:
>
> el proeblema no es (estado)::text = 'ACTIVO'::text), es Hash Cond:
>> ((cpp.caracteristica_predio)::text = (cpt.caracteristica_predio)::text)
>>
>> http://explain.depesz.com/s/1GRQ
>>
>>
>> El 14 de marzo de 2014, 11:04, William Diaz Pabón <widipa(at)gmail(dot)com>escribió:
>>
>> Hash Join (cost=62.82..2455.25 rows=102826 width=11) (actual time=
>>> 6.006..186.428 rows=100738 loops=1)
>>> Output: t.consecutivo, cpp.oi_predio
>>> Hash Cond: ((cpp.caracteristica_predio)::text =
>>> (cpt.caracteristica_predio)::text)
>>> Join Filter: (((cpp.vigencia)::text = ''::text) OR (cpp.vigencia IS
>>> NULL) OR ((cpp.vigencia)::text = (t.vigencia)::text))
>>> -> Seq Scan on caracteristica_predio_oi_predio cpp
>>> (cost=0.00..162.44 rows=8595 width=29) (actual time=0.019..12.759
>>> rows=8595 loops=1)
>>> Output: cpp.consecutivo, cpp.caracteristica_predio,
>>> cpp.oi_predio, cpp.vigencia, cpp.estado
>>> Filter: ((estado)::text = 'ACTIVO'::text)
>>> -> Hash (cost=59.97..59.97 rows=228 width=13) (actual time=
>>> 5.970..5.970 rows=228 loops=1)
>>> Output: t.consecutivo, t.vigencia, cpt.caracteristica_predio
>>> -> Hash Join (cost=7.13..59.97 rows=228 width=13) (actual
>>> time=0.755..5.571 rows=228 loops=1)
>>> Output: t.consecutivo, t.vigencia,
>>> cpt.caracteristica_predio
>>> Hash Cond: ((t.consecutivo)::text = (cpt.tarifa)::text)
>>> -> Seq Scan on tarifa t (cost=0.00..44.66 rows=1573
>>> width=10) (actual time=0.006..2.402 rows=1573 loops=1)
>>> Output: t.consecutivo, t.avaluo_inicial,
>>> t.avaluo_final, t.destino_economico, t.tipo_predio, t.tarifa, t.estado,
>>> t.area_construida_inicial, t.area_construida_final, t.area_terreno_inicial,
>>> t.area_terreno_final, t.estrato, t.tipo, t.fecha_cambio, t.registrado_por,
>>> t.fecha_creacion, t.usuario_creacion, t.vigencia,
>>> t.porcentaje_limite_incremento, t.uso_predio
>>> Filter: ((estado)::text = 'ACTIVO'::text)
>>> -> Hash (cost=4.28..4.28 rows=228 width=8) (actual
>>> time=0.691..0.691 rows=228 loops=1)
>>> Output: cpt.tarifa, cpt.caracteristica_predio
>>> -> Seq Scan on caracteristica_predio_tarifa cpt
>>> (cost=0.00..4.28 rows=228 width=8) (actual time=0.008..0.306 rows=228
>>> loops=1)
>>> Output: cpt.tarifa, cpt.caracteristica_predio
>>> Total runtime: 308.551 ms
>>>
>>>
>>>
>>> El 14 de marzo de 2014, 11:02, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>escribió:
>>>
>>> William Diaz Pabón escribió:
>>>> > Ok, gracias.
>>>> >
>>>> > Esta es la consulta con alias, espero que sea más legible:
>>>> >
>>>> >
>>>> > SELECT
>>>> > t.consecutivo AS tarifa,
>>>> > cpp.oi_predio
>>>> > FROM tarifa AS t
>>>> > JOIN caracteristica_predio_tarifa AS cpt ON cpt.tarifa::text =
>>>> > t.consecutivo::text
>>>> >
>>>> > JOIN caracteristica_predio_oi_predio AS cpp ON
>>>> > cpp.caracteristica_predio::text = cpt.caracteristica_predio::text
>>>> > AND cpp.estado::text = 'ACTIVO'::text
>>>> > AND (cpp.vigencia::text = ''::text OR
>>>> > cpp.vigencia IS NULL OR
>>>> > cpp.vigencia::text = t.vigencia::text)
>>>> > WHERE t.estado::text = 'ACTIVO'::text
>>>>
>>>> Sí, es mucho más legible. ¿Puedes mandar un EXPLAIN ANALYZE de la
>>>> consulta?
>>>>
>>>> --
>>>> Álvaro Herrera http://www.2ndQuadrant.com/
>>>> PostgreSQL Development, 24x7 Support, Training & Services
>>>>
>>>
>>>
>>>
>>> --
>>> Éxitos.
>>>
>>> Cordialmente,
>>>
>>>
>>> *William Diaz Pabón*
>>>
>>> *, Especialista en Soluciones Informáticas*
>>>
>>> Bogotá, Colombia
>>> Tel: +57 (300) 3917774
>>>
>>> http://planetapleno.blogspot.com/
>>> http://tutorialestecnicos.blogspot.com/
>>>
>>
>>
>>
>> --
>> Raul Andres Gutierrez Alejo
>>
>
>
>
> --
> Éxitos.
>
> Cordialmente,
>
>
> *William Diaz Pabón*
>
> *, Especialista en Soluciones Informáticas*
>
> Bogotá, Colombia
> Tel: +57 (300) 3917774
>
> http://planetapleno.blogspot.com/
> http://tutorialestecnicos.blogspot.com/
>
--
Raul Andres Gutierrez Alejo
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2014-03-14 16:50:59 | Re: Fwd: Consulta no usa los indices |
Previous Message | Gilberto Castillo | 2014-03-14 16:49:40 | Re: Consulta no usa los indices |