Re: share info between backends

Lists: pgsql-hackers
From: "Jaime Casanova" <systemguards(at)gmail(dot)com>
To: "Pgsql Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: share info between backends
Date: 2007-01-11 05:58:01
Message-ID: c2d9e70e0701102158x625d32ex53c90b3fec1765ea@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Hi,

i'm trying to share some info between backends but i cannot figure how
to do it...
i was reading bgwriter.c and autovacuum.c hoping there is something
that can show me the way to go...

can you, please, guide me on this?

--
regards,
Jaime Casanova

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs and the universe trying
to produce bigger and better idiots.
So far, the universe is winning."
Richard Cook


From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Jaime Casanova <systemguards(at)gmail(dot)com>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: share info between backends
Date: 2007-01-11 10:30:08
Message-ID: 20070111103008.GA5836@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Jan 11, 2007 at 12:58:01AM -0500, Jaime Casanova wrote:
> Hi,
>
> i'm trying to share some info between backends but i cannot figure how
> to do it...
> i was reading bgwriter.c and autovacuum.c hoping there is something
> that can show me the way to go...

Well, there's a shared memory block, but getting access to it is not
easy. Using a table may to easier, but you'll need to provide more
details if you want more help.

Have a ncie day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.


From: "Jaime Casanova" <systemguards(at)gmail(dot)com>
To: "Martijn van Oosterhout" <kleptog(at)svana(dot)org>
Cc: "Pgsql Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: share info between backends
Date: 2007-01-11 12:21:49
Message-ID: c2d9e70e0701110421i5eefaa7ck627d4267e5ff1c71@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 1/11/07, Martijn van Oosterhout <kleptog(at)svana(dot)org> wrote:
> On Thu, Jan 11, 2007 at 12:58:01AM -0500, Jaime Casanova wrote:
> > Hi,
> >
> > i'm trying to share some info between backends but i cannot figure how
> > to do it...
> > i was reading bgwriter.c and autovacuum.c hoping there is something
> > that can show me the way to go...
>
> Well, there's a shared memory block, but getting access to it is not
> easy. Using a table may to easier, but you'll need to provide more
> details if you want more help.
>

i'm trying to fix a problem related to the patch Albert sent in
october (Tablespace for temporary objects and sort files)
http://archives.postgresql.org/pgsql-patches/2006-10/msg00141.php
http://archives.postgresql.org/pgsql-patches/2007-01/msg00063.php

after reviewing this i notice this will not use different tablespaces
in the case of having various connections all with just one temp
table:
http://archives.postgresql.org/pgsql-patches/2007-01/msg00188.php

what i'm trying to do it is share what's the next_temp_tablespace to use...
the other way to do this is as you say using tables, but i don't think
this is a good idea in this case...

comments?

--
regards,
Jaime Casanova

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs and the universe trying
to produce bigger and better idiots.
So far, the universe is winning."
Richard Cook


From: "Andrew Dunstan" <andrew(at)dunslane(dot)net>
To: "Jaime Casanova" <systemguards(at)gmail(dot)com>
Cc: "Martijn van Oosterhout" <kleptog(at)svana(dot)org>, "Pgsql Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: share info between backends
Date: 2007-01-11 12:54:24
Message-ID: 63036.24.211.165.134.1168520064.squirrel@www.dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Jaime Casanova wrote:
>
> i'm trying to fix a problem related to the patch Albert sent in
> october (Tablespace for temporary objects and sort files)
> http://archives.postgresql.org/pgsql-patches/2006-10/msg00141.php
> http://archives.postgresql.org/pgsql-patches/2007-01/msg00063.php
>
> after reviewing this i notice this will not use different tablespaces
> in the case of having various connections all with just one temp
> table:
> http://archives.postgresql.org/pgsql-patches/2007-01/msg00188.php
>
> what i'm trying to do it is share what's the next_temp_tablespace to
> use...
> the other way to do this is as you say using tables, but i don't think
> this is a good idea in this case...
>
> comments?
>

Why not make it probabilistic by using, say, MyProcPid % n where n is the
number of tablespaces? Then you don't need anything shared.

cheers

andrew


From: "Jaime Casanova" <systemguards(at)gmail(dot)com>
To: "Andrew Dunstan" <andrew(at)dunslane(dot)net>
Cc: "Martijn van Oosterhout" <kleptog(at)svana(dot)org>, "Pgsql Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: share info between backends
Date: 2007-01-12 02:19:06
Message-ID: c2d9e70e0701111819p1e719a19j6049114942583f2d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On 1/11/07, Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:
> Jaime Casanova wrote:
> >
> > i'm trying to fix a problem related to the patch Albert sent in
> > october (Tablespace for temporary objects and sort files)
> > http://archives.postgresql.org/pgsql-patches/2006-10/msg00141.php
> > http://archives.postgresql.org/pgsql-patches/2007-01/msg00063.php
> >
> > after reviewing this i notice this will not use different tablespaces
> > in the case of having various connections all with just one temp
> > table:
> > http://archives.postgresql.org/pgsql-patches/2007-01/msg00188.php
> >
> > what i'm trying to do it is share what's the next_temp_tablespace to
> > use...
> > the other way to do this is as you say using tables, but i don't think
> > this is a good idea in this case...
> >
> > comments?
> >
>
> Why not make it probabilistic by using, say, MyProcPid % n where n is the
> number of tablespaces? Then you don't need anything shared.
>

mmm... is not great to try to kill flies with tanks? ;)
thanks for the idea, i will try it

--
regards,
Jaime Casanova

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs and the universe trying
to produce bigger and better idiots.
So far, the universe is winning."
Richard Cook


From: "Zeugswetter Andreas ADI SD" <ZeugswetterA(at)spardat(dot)at>
To: "Jaime Casanova" <systemguards(at)gmail(dot)com>, "Andrew Dunstan" <andrew(at)dunslane(dot)net>
Cc: "Martijn van Oosterhout" <kleptog(at)svana(dot)org>, "Pgsql Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: share info between backends
Date: 2007-01-12 09:54:59
Message-ID: E1539E0ED7043848906A8FF995BDA57901AE6D7D@m0143.s-mxs.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers


> > > comments?
> >
> > Why not make it probabilistic by using, say, MyProcPid % n where n
is the
> > number of tablespaces? Then you don't need anything shared.

You still want a (local) counter, so that temp files for one session are
spread out.

Andreas


From: "Andrew Dunstan" <andrew(at)dunslane(dot)net>
To: "Zeugswetter Andreas ADI SD" <ZeugswetterA(at)spardat(dot)at>
Cc: "Jaime Casanova" <systemguards(at)gmail(dot)com>, "Martijn van Oosterhout" <kleptog(at)svana(dot)org>, "Pgsql Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: share info between backends
Date: 2007-01-12 11:24:44
Message-ID: 63452.24.211.165.134.1168601084.squirrel@www.dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Zeugswetter Andreas ADI SD wrote:
>
>> > > comments?
>> >
>> > Why not make it probabilistic by using, say, MyProcPid % n where n
> is the
>> > number of tablespaces? Then you don't need anything shared.
>
> You still want a (local) counter, so that temp files for one session are
> spread out.
>

Yes, but this can be used as a seed so not all backends start with the
same counter value.

cheers

andrew