Excerpts from motum hesa's message of mié jul 20 20:37:52 -0400 2011:
> Hola a menos que me equivoque no vi en los archivos que revise de la
> lista que trataran este tema, Tengo la siguiente consulta
> 
> select nombre, tipo, max(idtbl) , min(idtbl)
>     from tabla_grande where  fechacreacion between '2011-07-01 05:00:00'
> and '2011-07-21 04:59:00' group by nombre, tipo order by nombre
> 
> El problema es que tarda demasiado en traerme datos, y pues solo
> quiero el max y el min, le hice un explain y me arrojo lo siguiente.
> 
> "Sort  (cost=432277.66..432377.66 rows=40000 width=18)"
> "  Sort Key: public.tabla_grande.nombre"
> "  ->  HashAggregate  (cost=428620.12..429220.12 rows=40000 width=18)"
> "        ->  Append  (cost=0.00..410897.41 rows=1772271 width=18)"
> "              ->  Index Scan using ind_fecha on tabla_grande
> (cost=0.00..410897.41 rows=1772271 width=18)"
> "                    Index Cond: ((fechacreacion >= '2011-07-01
> 05:00:00'::timestamp without time zone) AND (fechacreacion <=
> '2011-07-12 04:59:00'::timestamp without time zone))"

Muestra el \d de la tabla y qué índices tiene.

-- 
Álvaro Herrera <alvhe...@alvh.no-ip.org>
-
Enviado a la lista de correo pgsql-es-ayuda (pgsql-es-ayuda@postgresql.org)
Para cambiar tu suscripci�n:
http://www.postgresql.org/mailpref/pgsql-es-ayuda

Responder a