Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id AA4D19FB60B for ; Tue, 13 Mar 2007 10:36:58 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 84084-09 for ; Tue, 13 Mar 2007 10:36:45 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.175]) by postgresql.org (Postfix) with ESMTP id D21F59FB5A5 for ; Tue, 13 Mar 2007 10:36:50 -0300 (ADT) Received: by ug-out-1314.google.com with SMTP id k3so253838ugf for ; Tue, 13 Mar 2007 06:36:49 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=ATu5+Xp/XTUEKfTOrtcuam7+kWz5NygwzUNL31ipQhsn+uJTZ/6R5PCpZUahYRAflRnFphtFmJ9aQzhYDA+H9eyJ5Ca7bv2bO8erWdGYtrIcoKOK064wZz9LyjfzJg81GcAVIysXDrU8yRkt2RdVCPUtDRzgHTvBE9nEzmjddis= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=Q6hM6MvfbkI8ryC2FwbER3jxMu8UfZfn+zrV4J/enegTWMiMZGNuepsHU/ly2S8mWsJ8p2+hDTxOUxKGLXmLYBP0Z3+XHvSpLZpFFSGkahJPyznuJx2uzTSWlXHren67Dyz3JqjiV4Hgp3Jd1GVpekgKrJ+QcVC1GhqmLUHIE8w= Received: by 10.115.61.1 with SMTP id o1mr2393780wak.1173793007732; Tue, 13 Mar 2007 06:36:47 -0700 (PDT) Received: by 10.114.184.10 with HTTP; Tue, 13 Mar 2007 06:36:47 -0700 (PDT) Message-ID: Date: Tue, 13 Mar 2007 14:36:47 +0100 From: "James Riordan" To: pgsql-performance@postgresql.org Subject: Dispatch-Merge pattern MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200703/248 X-Sequence-Number: 23653 Howdy- I am currently using PostgreSQL to store and process a high-bandwidth event stream. I do not need old events but the delete and vacuum does not terminate due to the large number of events being inserted (it just pushes me over the tipping point of where the machine can keep up with the events). I ended up implementing a scheme where a trigger is used to redirect the events (round robin based on time) to a series of identically structured tables. I can then use TRUNCATE older tables rather than DELETE and VACUUM (which is a significant speed up). It worked out pretty well so thought post the idea to find out if - it is stupid way of doing things and there is a correct database abstraction for doing this or - it is a reasonable way of solving this problem and might be of use to other folks using rdbs as event processing I then use a view to merge the tables. Obviously update would be a problem for my purposes, and I suppose a lot of event processing, it isn't an issue. Either way, details are at: http://unsyntax.net/james/blog/tools+and+programming/2007/03/08/Dispatch-Merge-Database-Pattern Cheers, James