Re: Ayuda Consulta de fechas

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: motum hesa <motums(at)gmail(dot)com>
Cc: Ayuda <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: Re: Ayuda Consulta de fechas
Date: 2011-07-21 21:29:57
Message-ID: 1311283734-sup-9210@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

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 <alvherre(at)alvh(dot)no-ip(dot)org>

In response to

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Miguel Angel Hernandez Moreno 2011-07-21 21:40:44 Re: RECUPERAR UN BACKUP MYSQL
Previous Message Miguel Angel Hernandez Moreno 2011-07-21 21:21:59 Re: RECUPERAR UN BACKUP MYSQL