Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 317349FB20F for ; Sat, 28 Jul 2007 19:39:07 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 87865-08 for ; Sat, 28 Jul 2007 19:39:00 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from hm32.locaweb.com.br (hm32-3.locaweb.com.br [200.234.205.225]) by postgresql.org (Postfix) with SMTP id A76219FB20D for ; Sat, 28 Jul 2007 19:39:03 -0300 (ADT) Received: (qmail 7171 invoked from network); 28 Jul 2007 22:38:59 -0000 Received: from unknown (10.1.10.142) by hm32.locaweb.com.br with QMQP; 28 Jul 2007 22:38:59 -0000 Received: from unknown (HELO brunolaptop) (bruno@ravnus.com@201.29.113.232) by hm456.locaweb.com.br with SMTP; 28 Jul 2007 22:39:18 -0000 From: "Bruno Rodrigues Siqueira" To: "'Ragnar'" Cc: Subject: RES: RES: select on 1milion register = 6s Date: Sat, 28 Jul 2007 19:38:54 -0300 Message-ID: <002a01c7d168$16b4a550$e900a8c0@brunolaptop> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 11 Thread-Index: AcfRZzcfIP/OlKLzQiSEkwrJqtvt3wAAMFEg X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 In-Reply-To: <1185662176.5778.314.camel@localhost.localdomain> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=1.259 tagged_above=0 required=5 tests=AWL=1.258, BAYES_50=0.001 X-Spam-Level: * X-Archive-Number: 200707/407 X-Sequence-Number: 26091 Data_encerramento is a timestamp column I will try your tip. Thanks -----Mensagem original----- De: pgsql-performance-owner@postgresql.org [mailto:pgsql-performance-owner@postgresql.org] Em nome de Ragnar Enviada em: s=E1bado, 28 de julho de 2007 19:36 Para: Bruno Rodrigues Siqueira Cc: pgsql-performance@postgresql.org Assunto: Re: RES: [PERFORM] select on 1milion register =3D 6s On lau, 2007-07-28 at 17:12 -0300, Bruno Rodrigues Siqueira wrote: > where >=20 > to_char( data_encerramento ,'yyyy-mm')=20 > between '2006-12' and '2007-01' assuming data_encerramento is a date column, try: WHERE data_encerramento between '2006-12-01' and '2007-01-31' =20 gnari ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend