Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 34BA6632692 for ; Fri, 21 May 2010 15:21:21 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 51255-07 for ; Fri, 21 May 2010 18:21:13 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from ey-out-2122.google.com (ey-out-2122.google.com [74.125.78.24]) by mail.postgresql.org (Postfix) with ESMTP id 4EECE6322A1 for ; Fri, 21 May 2010 15:21:13 -0300 (ADT) Received: by ey-out-2122.google.com with SMTP id d26so108416eyd.33 for ; Fri, 21 May 2010 11:21:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type:content-transfer-encoding; bh=G3g1OO1+srjBhIOX0p2le/fu/XPNSWFpSKuTFxa8Pos=; b=hmWYsseV56nU3wcU2Z2x6ukS7RidsvyMTwMh10GvcxZpJBRbjvIL0gkAeDNJGKfpFa MaiTVy88VguqrbO7NOfV/mJqIHN5bPwpu6Krpg8RAWjul7Zth8j8Gu9U4XrKJUobqHg3 TMuIRNOlil3d5wgqI+uIU5QiKMQ9km5goDMTM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; b=NQAd/v8FxogmZB4Ian91z0eHF1hQH97scGZEfyw1qiD06tfY1Tg9M9553OAK7BoVNK lJgDDRtdNNxJMMlZdLvKFK+mTcJH9jn0vxlO2SDdp8g6rjQ++YtsO2vDLmaqGUdlPQK1 0WluWqaQKhyuFdSUJgyzhScveotAwPL92HvGo= Received: by 10.213.58.140 with SMTP id g12mr724850ebh.52.1274466071918; Fri, 21 May 2010 11:21:11 -0700 (PDT) Received: from [0.0.0.0] (5357DA75.cable.casema.nl [83.87.218.117]) by mx.google.com with ESMTPS id 15sm604402ewy.4.2010.05.21.11.21.10 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 21 May 2010 11:21:11 -0700 (PDT) Message-ID: <4BF6CF21.1030808@gmail.com> Date: Fri, 21 May 2010 20:21:21 +0200 From: Yeb Havinga User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) MIME-Version: 1.0 To: Matthew Wakeling CC: pgsql-performance@postgresql.org Subject: Re: Optimize date query for large child tables: GiST or GIN? References: <7767.1274385170@sss.pgh.pa.us> <7917.1274385834@sss.pgh.pa.us> <8132.1274386738@sss.pgh.pa.us> <20100520210106.GO21875@tamriel.snowman.net> <4BF64693.8050800@gmail.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201005/143 X-Sequence-Number: 38727 Matthew Wakeling wrote: > On Fri, 21 May 2010, Yeb Havinga wrote: >> For time based data I would for sure go for year based indexing. > > On the contrary, most of the queries seem to be over many years, but > rather restricting on the time of year. Therefore, partitioning by > month or some other per-year method would seem sensible. The fact is that at the time I wrote my mail, I had not read a specifion of distribution of parameters (or I missed it). That's why the sentence of my mail before the one you quoted said: "the partitioning is only useful for speed, if it matches how your queries select data.". In most of the databases I've worked with, the recent data was queried most (accounting, medical) but I can see that for climate analysis this might be different. > Regarding the leap year problem, you might consider creating a > modified day of year field, which always assumes that the year > contains a leap day. Then a given number always resolves to a given > date, regardless of year. If you then partition (or index) on that > field, then you may get a benefit. Shouldn't it be just the other way around - assume all years are non leap years for the doy part field to be indexed. regards, Yeb Havinga