Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 6D3B89FB9A1 for ; Sat, 19 May 2007 15:12:41 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-maia, port 10024) with ESMTP id 02983-08 for ; Sat, 19 May 2007 15:12:36 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.5 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id D24F29FB993 for ; Sat, 19 May 2007 15:12:37 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.1/8.14.1) with ESMTP id l4JICZSJ014802; Sat, 19 May 2007 14:12:35 -0400 (EDT) To: C Storm cc: pgsql-performance@postgresql.org Subject: Re: Efficient recursion In-reply-to: <1179528084.715044.215690@e65g2000hsc.googlegroups.com> References: <1179528084.715044.215690@e65g2000hsc.googlegroups.com> Comments: In-reply-to C Storm message dated "18 May 2007 15:41:24 -0700" Date: Sat, 19 May 2007 14:12:35 -0400 Message-ID: <14801.1179598355@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200705/370 X-Sequence-Number: 24760 C Storm writes: > Essentially, I'm looking for the most efficient way to break a > database into two 'shards' based on a top level table's > primary key. For example, split a sales database into two using a > territory. I think what you are looking for here is partitioning, not recursion. PG's support for partitioned tables is a bit crude, but usable: http://www.postgresql.org/docs/8.2/static/ddl-partitioning.html regards, tom lane