From: | Emanuel Calvo Franco <postgres(dot)arg(at)gmail(dot)com> |
---|---|
To: | Ernesto Quiñones <ernestoq(at)gmail(dot)com> |
Cc: | pgsql-es-ayuda <pgsql-es-ayuda(at)postgresql(dot)org> |
Subject: | Re: querys pesados |
Date: | 2009-05-07 18:16:52 |
Message-ID: | f205bb120905071116t3c80c7f3vd69261af9d975180@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-es-ayuda |
El día 7 de mayo de 2009 15:08, Ernesto Quiñones <ernestoq(at)gmail(dot)com> escribió:
> ya tienen indices ambas columnas
> gracias
>
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>>> GroupAggregate (cost=6793590.06..7973814.93 rows=15228708 width=106)
>>> (actual time=2811295.104..5198116.245 rows=5750514 loops=1)
>>> -> Sort (cost=6793590.06..6831661.83 rows=15228708 width=106)
>>> (actual time=2811295.056..5119747.291 rows=15228708 loops=1)
>>> Sort Key: a.flgcobrollamada, a.flgcelular, a.flgstatuscdr,
>>> a.codmesfactura, a.codciudaddestino, a.codnpa, a.tipllamada,
>>> a.codsubmotivoestadocliente, a.codestadocliente, a.codpuntoventa,
>>> a.codciclofacturacioncliente, b.codpaisubigeocliente,
>>> b.codpaisfacturacion, a.codoperador, a.codempresaut,
>>> (to_date(substr((a.codhora)::text, 1, 8), 'yyyymmdd'::text)),
>>> a.tipconexion, a.tipacceso
>>> Sort Method: external merge Disk: 1971456kB
>>> -> Hash Join (cost=6819.01..1437289.10 rows=15228708
>>> width=106) (actual time=1302.791..196625.524 rows=15228708 loops=1)
>>> Hash Cond: ((a.codcliente)::text =
>>> (b.codcliente)::text)
>>> -> Seq Scan on f_consumo a (cost=0.00..429172.08
>>> rows=15228708 width=112) (actual time=4.052..65973.189 rows=15228708
>>> loops=1)
>>> -> Hash (cost=4555.45..4555.45 rows=123245 width=18)
>>> (actual time=1298.143..1298.143 rows=123245 loops=1)
>>> -> Seq Scan on lcl_maecliente b
>>> (cost=0.00..4555.45 rows=123245 width=18) (actual time=14.092..953.654
>>> rows=123245 loops=1)
>>> Total runtime: 5217852.883 ms
>>> (10 filas)
>>>
"to_date(SUBSTR(CAST(a.codhora AS text),1,8),'yyyymmdd')"
esta función en la agregación no es buena idea,
por que no haces la converción sobre un restult set obtenido de la
consulta (creo que esto con el sum también podrías hacerlo).
--
Emanuel Calvo Franco
Sumate al ARPUG !
( www.arpug.com.ar)
ArPUG / AOSUG Member
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2009-05-07 18:22:40 | Re: querys pesados |
Previous Message | Ernesto Quiñones | 2009-05-07 18:13:50 | Re: querys pesados |