Thread: Preserving Cluster-Wise Data

Preserving Cluster-Wise Data

From
Volkan YAZICI
Date:
Hi,

I was taking a look at _SHARED variable implementation of different
PLs and it looks like every PL implements its own ad-hoc method to
preserve cluster-wise data. Wouldn't it be beneficial to have a
cluster-wise table (sytem catalog?) which is accessible by any
procedure with required (superuser?) privileges? With such a table,
procedures (and PLs) will be able to preserve their state data
natively without need of any ad-hoc method and because of we're using
a just yet another plain table, all of the MVCC related stuff will be
handled by PostgreSQL easily.


Regards.


Re: Preserving Cluster-Wise Data

From
Andrew Dunstan
Date:
Volkan YAZICI wrote:
> Hi,
>
> I was taking a look at _SHARED variable implementation of different
> PLs and it looks like every PL implements its own ad-hoc method to
> preserve cluster-wise data. Wouldn't it be beneficial to have a
> cluster-wise table (sytem catalog?) which is accessible by any
> procedure with required (superuser?) privileges? With such a table,
> procedures (and PLs) will be able to preserve their state data
> natively without need of any ad-hoc method and because of we're using
> a just yet another plain table, all of the MVCC related stuff will be
> handled by PostgreSQL easily.
>
>   

The data might well be PL and session specific, though. e.g. a perl 
function ref would be both.

I don't know what state we would want to preserve across sessions anyway.

Let's see a use case that a plain user level table wouldn't serve.

cheers

andrew





Re: Preserving Cluster-Wise Data

From
Volkan YAZICI
Date:
On Dec 05 01:06, Andrew Dunstan wrote:
> The data might well be PL and session specific, though. e.g. a perl
> function ref would be both.
> 
> I don't know what state we would want to preserve across sessions anyway.
> 
> Let's see a use case that a plain user level table wouldn't serve.

For instance, with such a cluster-wise table, PLs will be able to
implement a _SHARED variable easily. And the reason that a plain user
level table wouldn't serve the same functionality is that, it's
database-wide, not cluster-wise... Umm... You look like right. PLs are
also database wide, why bothering with cluster wise stuff.

Sorry for flooding the ml. I thought a central dedicated table would
suit better than a plain table.


Regards.


Re: Preserving Cluster-Wise Data

From
Tom Lane
Date:
Volkan YAZICI <yazicivo@ttnet.net.tr> writes:
> I was taking a look at _SHARED variable implementation of different
> PLs and it looks like every PL implements its own ad-hoc method to
> preserve cluster-wise data.

Huh?  _SHARED is not cluster-wide, only session-wide.
        regards, tom lane


Re: Preserving Cluster-Wise Data

From
Volkan YAZICI
Date:
On Dec 05 01:27, Tom Lane wrote:
> Huh?  _SHARED is not cluster-wide, only session-wide.

In PL/perl, yep, it's session-wide. But as far as I remember some of
the pl/j[ava] stuff using some kind of communication (RPC?) method to
get in touch with the main JVM which enables global database-wide
(cluster-wise?) variables. (I'm not sure ATM, I should re-check it.)
Anyway, as Andrew pointed out, plain tables serve as well for my wish.


Regards.