microo8
microo8

Reputation: 3784

PostgreSQL foreign function

I have not tested this, but want to know how it would work. I want to create three databases on three nodes. Each will be the same (schema, functions) but with different data.

I want to call a function from each of the database and join them eg:

select server1.very_time_expensive_function(1,2) + 
       server2.very_time_expensive_function(2,3) +
       server3.very_time_expensive_function(3,4);

But foreign functions cannot be created. Just foreign tables

What would you recomend?

Upvotes: 1

Views: 1682

Answers (1)

Chris Travers
Chris Travers

Reputation: 26464

You can't send args to a function from a view unless those arguments either come from the rows or are specified at view creation time. So you are better off looking at pl/proxy or dblink. You may also be able to design functions and views along principles that work. To be honest, pl/proxy is probably your best shot.

Upvotes: 1

Related Questions