Database Reference
In-Depth Information
Here, connect string determines the database to run. connect string is the
standard PostgreSQL connect string you would use to connect to the database from
a client application, for example: dbname=p0 port=5433 .
Or, you can specify a name using CLUSTER :
CLUSTER 'usercluster'; -
Or finally, you can specify a partition number using RUN ON :
RUN ON part_func(arg[, ...]) ;
part_func() can be any existing or user-defined PostgreSQL function returning
an integer. PL/Proxy calls that function with the given arguments and then uses N
lower bits from the result to select a connection to a cluster partition.
There are two more versions of the RUN ON statement:
RUN ON ANY;
This means that the function can be executed on any partition in a cluster. This can
be used when all the required data for a function is present on all partitions.
The other version is:
RUN ON ALL;
This runs the statement on all partitions in parallel and then returns a concatenation
of results from the partitions. This has at least three main uses:
• For cases when you don't know where the required data row is, like when
getting data using non-partition keys. For example, getting a user by its
e-mail when the table is partitioned by username.
• Running aggregate functions over larger subsets of data, say counting all
users. For example, getting all the users who have a certain user in their
friend's lists.
Search WWH ::




Custom Search