From: | Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com> |
---|---|
To: | Andrey Lepikhov <a(dot)lepikhov(at)postgrespro(dot)ru> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Suggestions on message transfer among backends |
Date: | 2019-03-12 08:09:16 |
Message-ID: | CAKU4AWrrbtyK-_jXsq+1+WcDzAgHPU6SSnHcCzcSfC_ktC7_vg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Mar 12, 2019 at 2:36 PM Andy Fan <zhihui(dot)fan1213(at)gmail(dot)com> wrote:
> On Tue, Mar 12, 2019 at 1:59 PM Andrey Lepikhov <a(dot)lepikhov(at)postgrespro(dot)ru>
> wrote:
>
>> On 11/03/2019 18:36, Andy Fan wrote:
>> > Hi:
>> > I need some function which requires some message exchange among
>> > different back-ends (connections).
>> > specially I need a shared hash map and a message queue.
>> >
>> > Message queue: it should be many writers, 1 reader. Looks POSIX
>> > message queue should be OK, but postgre doesn't use it. is there any
>> > equivalent in PG?
>> >
>> > shared hash map: the number of items can be fixed and the value can be
>> > fixed as well.
>> >
>> > any keywords or explanation will be extremely helpful.
>> You may use shm_mq (shared memory queue) and hash tables (dynahash.c) in
>> shared memory (see ShmemInitHash() + shmem_startup_hook)
>> >
>> > Thanks
>>
>> --
>> Andrey Lepikhov
>> Postgres Professional
>> https://postgrespro.com
>> The Russian Postgres Company
>>
>
> Thanks Andrey and all people replied this! dynahash/ShmemInitHash is the
> one I'm using and it is ok for my purposes.
> I planned to use posix/system v message queue, since they are able to
> support multi readers/multi writer.
>
Posix/System v message queue is not a portable way for postgres since
they are not widely support on all the os, like Darwin. I think that may
be a reason why pg didn't use it. and I just hack for fun, so posix mq
can be a solution for me.
> I just don't know why shm_mq is designed to single-reader & single-writer.
>
Probably this will be simpler and enough for PostgreSQL.
That is just the thoughts per my current knowledge.
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Langote | 2019-03-12 08:22:59 | Re: speeding up planning with partitions |
Previous Message | Pavan Deolasee | 2019-03-12 07:54:16 | Re: COPY FREEZE and setting PD_ALL_VISIBLE/visibility map bits |