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 9695E329C7B for ; Mon, 13 Sep 2004 04:06:37 +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 05214-04 for ; Mon, 13 Sep 2004 03:06:34 +0000 (GMT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 80684329C65 for ; Mon, 13 Sep 2004 04:06:33 +0100 (BST) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i8D36XCn005687 for ; Mon, 13 Sep 2004 03:06:33 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i8D2nwaX000675 for pgsql-performance@postgresql.org; Mon, 13 Sep 2004 02:49:58 GMT From: Christopher Browne X-Newsgroups: comp.databases.postgresql.performance Subject: Re: Data Warehouse Reevaluation - MySQL vs Postgres -- merge tables Date: Sun, 12 Sep 2004 22:29:00 -0400 Organization: cbbrowne Computing Inc Lines: 60 Message-ID: References: <20040912042442.49915.qmail@web41508.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@news.hub.org X-message-flag: Outlook is rather hackable, isn't it? X-Home-Page: http://www.cbbrowne.com/info/ X-Affero: http://svcs.affero.net/rm.php?r=cbbrowne User-Agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Security Through Obscurity, linux) Cancel-Lock: sha1:1tNkl+MxSM4LYBX90B0ESic8DNQ= To: pgsql-performance@postgresql.org 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/79 X-Sequence-Number: 8207 The world rejoiced as Mischa Sandberg wrote: > Mark Cotner wrote: >> Requirements: >> Merge table definition equivalent. We use these >> extensively. > Looked all over mysql.com etc, and afaics merge table is indeed > exactly a view of a union-all. Is that right? > PG supports views, of course, as well (now) as tablespaces, allowing > you to split tables/tablesets across multiple disk systems. PG is > also pretty efficient in query plans on such views, where (say) you > make one column a constant (identifier, sort of) per input table. The thing that _doesn't_ work well with these sorts of UNION views are when you do self-joins. Supposing you have 10 members, a self-join leads to a 100-way join, which is not particularly pretty. I'm quite curious as to how MySQL(tm) copes with this, although it may not be able to take place; they may not support that... >> Um, gonna sound silly, but the web interface has to remain "snappy" >> under load. I don't see this as a major concern since you don't >> require table locking. > Agreed. It's more in your warehouse design, and intelligent bounding > of queries. I'd say PG's query analyzer is a few years ahead of > MySQL for large and complex queries. The challenge comes in if the application has had enormous amounts of effort put into it to attune it exactly to MySQL(tm)'s feature set. The guys working on RT/3 have found this a challenge; they had rather a lot of dependancies on its case-insensitive string comparisons, causing considerable grief. > On the other hand, if you do warehouse-style loading (Insert, or PG > COPY, into a temp table; and then 'upsert' into the perm table), I > can guarantee 2500 inserts/sec is no problem. The big wins are thus: 1. Group plenty of INSERTs into a single transaction. 2. Better still, use COPY to cut parsing costs plenty more. 3. Adding indexes _after_ the COPY are a further win. Another possibility is to do clever things with stored procs; load incoming data using the above optimizations, and then run stored procedures to use some more or less fancy logic to put the data where it's ultimately supposed to be. Having the logic running inside the engine is the big optimization. -- wm(X,Y):-write(X),write('@'),write(Y). wm('cbbrowne','linuxfinances.info'). http://linuxfinances.info/info/spreadsheets.html Rules of the Evil Overlord #198. "I will remember that any vulnerabilities I have are to be revealed strictly on a need-to-know basis. I will also remember that no one needs to know."