Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 4B327650F04 for ; Mon, 30 Jun 2008 10:16:54 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 39009-01-10 for ; Mon, 30 Jun 2008 10:16:41 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from yw-out-2324.google.com (yw-out-2324.google.com [74.125.46.29]) by postgresql.org (Postfix) with ESMTP id 7EEA7650F27 for ; Mon, 30 Jun 2008 10:16:30 -0300 (ADT) Received: by yw-out-2324.google.com with SMTP id 3so719585ywj.73 for ; Mon, 30 Jun 2008 06:16:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=A5pplC7R61OvchGrDcT1efqWkKNMxRdktT478I5usYc=; b=QHEIjyNm3ekEyYeqk5c8tUfqWlwqJB2ww8imVr0RPQ+V3HQCjUU9ry7SlnM/FJbkaL N7OOggrk8ApyHxao3A6pHfoaUGmBH/dHS4Zpqxgy7+o8IlWO3c45+LRricKPWiKGFI+7 6gArj6CpuBkSLGwzcVdHUEbJ+fwGyzORan8R4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=cJCuNj9hdIAbG2OXnY4fP5Mexa5RHSo288fVdfC9cUCLJ35E5R23cdjVpVVMkkCrcD mTKdOJBQap0u/JL7eeHmLwiOTmLmpiDG5fh3Ab30STWuaeTUyZ5d4XTbIYoQQyF/y1Pt bqqdKHT73lFvCQZfmWT5N/XUWhSTvbdc+yzPw= Received: by 10.125.134.17 with SMTP id l17mr1091603mkn.123.1214831786292; Mon, 30 Jun 2008 06:16:26 -0700 (PDT) Received: by 10.125.80.8 with HTTP; Mon, 30 Jun 2008 06:16:26 -0700 (PDT) Message-ID: Date: Mon, 30 Jun 2008 16:16:26 +0300 From: "Marko Kreen" To: "Chris Browne" Subject: Re: Federated Postgresql architecture ? Cc: pgsql-performance@postgresql.org In-Reply-To: <60zlp6zqsm.fsf@dba2.int.libertyrms.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <200806261441.12413.josh@agliodbs.com> <36e682920806261440o2142783blbc38013f4f5677c2@mail.gmail.com> <200806261531.03892.josh@agliodbs.com> <60zlp6zqsm.fsf@dba2.int.libertyrms.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200806/233 X-Sequence-Number: 30583 On 6/27/08, Chris Browne wrote: > josh@agliodbs.com (Josh Berkus) writes: > > Jonah, > > > >> Hmm, I didn't think the Skype tools could really provide federated > >> database functionality without a good amount of custom work. Or, am I > >> mistaken? > > > > Sure, what do you think pl/proxy is for? > > > Ah, but the thing is, it changes the model from a relational one, > where you can have fairly arbitrary "where clauses," to one where > parameterization of queries must be predetermined. > > The "hard part" of federated database functionality at this point is > the [parenthesized portion] of... > > select * from table@node [where criterion = x]; > > What we'd like to be able to do is to ascertain that [where criterion > = x] portion, and run it on the remote DBMS, so that only the relevant > tuples would come back. > > Consider... > > What if table@node is a remote table with 200 million tuples, and > [where criterion = x] restricts the result set to 200 of those. > > If you *cannot* push the "where clause" down to the remote node, then > you're stuck with pulling all 200 million tuples, and filtering out, > on the "local" node, the 200 tuples that need to be kept. > > To do better, with pl/proxy, requires having a predetermined function > that would do that filtering, and if it's missing, you're stuck > pulling 200M tuples, and throwing out nearly all of them. > > In contrast, with the work David Fetter's looking at, the [where > criterion = x] clause would get pushed to the node which the data is > being drawn from, and so the query, when running on "table@node," > could use indices, and return only the 200 tuples that are of > interest. > > It's a really big win, if it works. I agree that for doing free-form queries on remote database, the PL/Proxy is not the right answer. (Although the recent patch to support dynamic records with AS clause at least makes them work.) But I want to clarify it's goal - it is not to run "pre-determined queries." It is to run "pre-determined complex transactions." And to make those work in a "federated database" takes huge amount of complexity that PL/Proxy simply sidesteps. At the price of requiring function-based API. But as the function-based API has other advantages even without PL/Proxy, it seems fine tradeoff. -- marko