Received: from localhost (unknown [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 44C4E9F9DEB for ; Sat, 8 Sep 2007 05:00:35 -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 33047-09 for ; Sat, 8 Sep 2007 05:00:26 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from wx-out-0506.google.com (wx-out-0506.google.com [66.249.82.239]) by postgresql.org (Postfix) with ESMTP id 1E7249F9DB3 for ; Sat, 8 Sep 2007 05:00:24 -0300 (ADT) Received: by wx-out-0506.google.com with SMTP id r21so628920wxc for ; Sat, 08 Sep 2007 01:00:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=ciPYSUSB1AgQqRjQUY2xOXVDVRiQ2JOYAX03pVCGvig=; b=W/0hceotV7bmKrh5CSHGtQNbSB14lh/morIFEavySn+KoM/XrfSpV68kGu3B//LZKuK4Zdz3garx75JJaHZ8sTntw1g3BRyTT4mkaAXT3UE4X7C8apo0Ou8U0xyPtyXZmwH9MpJzSNuH6CgNq1HTe6upidq1L55KuNNupMCMKF8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=bZ1+IRxUrrPD6GRN7ubbIs3nFA877PSTtewGH0sTn2pmN2Y3SDfZlj8nbfJsBvSrgfDRy1wczopWiifs0owPn2ba19zRr9U4LOzct5Buyh/rz/xmi1d9YF0Xzs6FzgwrKB8DITu29yvqsZ53rPy4Lw6+jTYmEoN0dk417sQfinc= Received: by 10.90.92.10 with SMTP id p10mr5440063agb.1189238423135; Sat, 08 Sep 2007 01:00:23 -0700 (PDT) Received: by 10.70.90.15 with HTTP; Sat, 8 Sep 2007 01:00:22 -0700 (PDT) Message-ID: <5482c80a0709080100i266bc41ajae0b34825cc9af5e@mail.gmail.com> Date: Sat, 8 Sep 2007 10:00:22 +0200 From: Dimitri To: "JS Ubei" Subject: Re: optimize query with a maximum(date) extraction Cc: pgsql-performance@postgresql.org In-Reply-To: <302443.65402.qm@web26209.mail.ukl.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <302443.65402.qm@web26209.mail.ukl.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200709/142 X-Sequence-Number: 26687 BTW, will it improve something if you change your index to "my_table( id, the_date )"? Rgds, -Dimitri On 9/5/07, JS Ubei wrote: > Hi all, > > I need to improve a query like : > > SELECT id, min(the_date), max(the_date) FROM my_table GROUP BY id; > > Stupidly, I create a B-tree index on my_table(the_date), witch is logically > not used in my query, because it's not with a constant ? isn't it ? > > I know that I can't create a function index with an aggregative function. > > How I can do ? > > thanks, > > jsubei > > > > > > _____________________________________________________________________________ > Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail > > ---------------------------(end of broadcast)--------------------------- > TIP 5: don't forget to increase your free space map settings >