Received: from localhost (maia-3.hub.org [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 662059FB298 for ; Tue, 23 Jan 2007 09:35:53 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-new, port 10024) with ESMTP id 97562-06 for ; Tue, 23 Jan 2007 09:35:45 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from lynet.oppetid.no (oppetid.no [80.65.51.2]) by postgresql.org (Postfix) with ESMTP id 0B3529FB283 for ; Tue, 23 Jan 2007 09:35:49 -0400 (AST) Received: by lynet.oppetid.no (Postfix, from userid 1019) id AD7C2119F9F; Tue, 23 Jan 2007 14:35:48 +0100 (CET) Date: Tue, 23 Jan 2007 14:35:48 +0100 From: Tobias Brox To: Chad Wagner Cc: Tobias Brox , pgsql-performance@postgresql.org Subject: Re: extract(field from timestamp) vs date dimension Message-ID: <20070123133548.GA17420@oppetid.no> References: <20070123124937.GA13122@oppetid.no> <81961ff50701230524y14aa883alfe4dab8d1dd5cf10@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <81961ff50701230524y14aa883alfe4dab8d1dd5cf10@mail.gmail.com> Organization: Group Nordicbet User-Agent: Mutt/1.5.9i X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/348 X-Sequence-Number: 22949 [Chad Wagner - Tue at 08:24:34AM -0500] > I guess go with your gut, but at some point the expressions are going to be > too complicated to maintain, and inefficient. The layout of my system is quite flexible, so it should eventually be fairly trivial to throw in a date dimension at a later stage. > Calendar tables are very very common, because traditional date functions > simply can't define business logic (especially things like month end close, > quarter end close, and year end close) that doesn't have any repeating > patterns (every 4th friday, 1st monday in the quarter, etc). Sure you can > stuff it into a function, but it just isn't as maintainable as a table. So far I haven't been bothered with anything more complex than "clean" weeks, months, quarters, etc. I suppose the strongest argument for introducing date dimensions already now is that I probably will benefit from having conform and well-designed dimensions when I will be introducing more data marts. As for now I have only one fact table and some few dimensions in the system.