Received: from localhost (unknown [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 5F4CF9F9FA9 for ; Wed, 5 Sep 2007 07:00:15 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 16363-06 for ; Wed, 5 Sep 2007 07:00:04 -0300 (ADT) X-Greylist: delayed 00:06:43.582522 by SQLgrey-1.7.5 Received: from web26209.mail.ukl.yahoo.com (web26209.mail.ukl.yahoo.com [217.12.10.246]) by postgresql.org (Postfix) with SMTP id 6B9FD9F9E20 for ; Wed, 5 Sep 2007 07:00:07 -0300 (ADT) Received: (qmail 65405 invoked by uid 60001); 5 Sep 2007 09:53:22 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.fr; h=X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=umFvazfrYa80HyOiVmK83kPRvmpI2ZBSNt+gBZpmAgw9FmELdhK6L9RHqHFEDIWvMcFd5LIxt1sInU/Fc1EP8V/UUunKc6tECvdwuMJEo3H0eyI4qo86N4gZPvt6GtfFgCue+YZwceBAOnci21uIc9FaWb6XEnV/vvPBGa4PeIE=; X-YMail-OSG: WthWlnAVM1m3NyGgkr93k0PrRuS0KghCB3UqVJ8AzcyRq88hlxxCcenihta.hmUCEg-- Received: from [194.254.156.248] by web26209.mail.ukl.yahoo.com via HTTP; Wed, 05 Sep 2007 09:53:22 GMT X-Mailer: YahooMailRC/651.50 YahooMailWebService/0.7.134 Date: Wed, 5 Sep 2007 09:53:22 +0000 (GMT) From: JS Ubei Subject: optimize query with a maximum(date) extraction To: pgsql-performance@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Message-ID: <302443.65402.qm@web26209.mail.ukl.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200709/37 X-Sequence-Number: 26582 Hi all,=0A=0AI need to improve a query like :=0A=0ASELECT id, min(the_date)= , max(the_date) FROM my_table GROUP BY id;=0A=0AStupidly, I create a B-tree= index on my_table(the_date), witch is logically not used in my query, beca= use it's not with a constant ? isn't it ?=0A=0AI know that I can't create a= function index with an aggregative function.=0A=0AHow I can do ?=0A=0Athan= ks,=0A=0Ajsubei=0A=0A=0A=0A=0A _______________________________________= ______________________________________ =0ANe gardez plus qu'une seule adres= se mail ! Copiez vos mails vers Yahoo! Mail