Forum: Skype presents: PL/Proxy 2.0

Posted by: Marko Kreen
Date: 2007-03-18 13:07
Summary:Skype presents: PL/Proxy 2.0

PL/Proxy is a language for creating proxy functions that call actual functions
from a partitioned database. The actual query to be executed on partition is
constructed by looking proxy function signature.

So, to call function "get_user_email(username text) returns text", the proxy
function need to be defined following:

CREATE FUNCTION get_user_email(username text) RETURNS text AS $$
CLUSTER 'userdb';
RUN ON hashtext(username);
$$ LANGUAGE plproxy;

assuming actual partitions are defined under cluster 'userdb' and
users are spread out between partitions by hashtext(name).

PL/Proxy can be used for simple remote queries, without need for any external

CREATE FUNCTION get_user_email(username text) RETURNS text AS $$
CONNECT 'dbname=userdb host=';
SELECT email FROM users WHERE name = username;
$$ LANGUAGE plproxy;

This also demonstrates that its possible to override default 'SELECT * FROM func(...)'
query generation and to run user-specified SELECT statement on remote server.

Sponsors Ads

Latest News

PL/Proxy 2.5

Marko Kreen - 2012-11-29 05:23 -

PL/Proxy 2.4

Marko Kreen - 2012-05-07 14:17 -

PL/Proxy 2.3

Marko Kreen - 2011-10-25 14:10 -

PL/Proxy 2.2

Marko Kreen - 2011-02-22 18:17 -

PL/Proxy 2.1

Marko Kreen - 2010-04-28 21:59 -
Monitor Forum | Start New Thread Start New Thread
Powered By FusionForge