X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7AA8C329E0E for ; Wed, 15 Sep 2004 05:30:27 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 53431-05 for ; Wed, 15 Sep 2004 04:30:25 +0000 (GMT) Received: from joeconway.com (wsip-24-249-201-67.sd.sd.cox.net [24.249.201.67]) by svr1.postgresql.org (Postfix) with ESMTP id D2C10329D7A for ; Wed, 15 Sep 2004 05:30:24 +0100 (BST) Received: from [192.168.4.3] (account jconway [192.168.4.3] verified) by joeconway.com (CommuniGate Pro SMTP 4.1.8) with ESMTP-TLS id 2185673; Tue, 14 Sep 2004 21:21:57 -0700 Message-ID: <4147C560.9060702@joeconway.com> Date: Tue, 14 Sep 2004 21:30:24 -0700 From: Joe Conway User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.2) Gecko/20040803 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Chris Browne Cc: pgsql-performance@postgresql.org Subject: Re: Data Warehouse Reevaluation - MySQL vs Postgres -- References: <20040914223333.GL56059@decibel.org> <60k6uw1cqa.fsf@dev6.int.libertyrms.info> In-Reply-To: <60k6uw1cqa.fsf@dev6.int.libertyrms.info> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200409/133 X-Sequence-Number: 8261 Chris Browne wrote: > Might we set up the view as: > > create view combination_of_logs as > select * from table_1 where txn_date between 'this' and 'that' > union all > select * from table_2 where txn_date between 'this2' and 'that2' > union all > select * from table_3 where txn_date between 'this3' and 'that3' > union all > select * from table_4 where txn_date between 'this4' and 'that4' > union all > ... ad infinitum > union all > select * from table_n where txn_date > 'start_of_partition_n'; > > and expect that to help, as long as the query that hooks up to this > has date constraints? > > We'd have to regenerate the view with new fixed constants each time we > set up the tables, but that sounds like it could work... That's exactly what we're doing, but using inherited tables instead of a union view. With inheritance, there is no need to rebuild the view each time a table is added or removed. Basically, in our application, tables are partitioned by either month or week, depending on the type of data involved, and queries are normally date qualified. We're not completely done with our data conversion (from a commercial RDBMSi), but so far the results have been excellent. Similar to what others have said in this thread, the conversion involved restructuring the data to better suit Postgres, and the application (data analysis/mining vs. the source system which is operational). As a result we've compressed a > 1TB database down to ~0.4TB, and seen at least one typical query reduced from ~9 minutes down to ~40 seconds. Joe