Обсуждение: a few doubts regarding postgres

Поиск
Список
Период
Сортировка

a few doubts regarding postgres

От
"Surabhi Ahuja "
Дата:
 does postgres support notifications.
 
for eg. through one connection to the server, i begin a transaction and i do inserts there.
in another sessions, i want to get notified that inserts are taking place in someother session.
please help.
 
a few other questions
 
Q1. is there anyway by which we can give priorities to the transactions?
 
Q2. is there s concept of connection pool in postgres?
 
Q3. does postgres support multi threading? if yes how?
 
regards
surabhi

Re: a few doubts regarding postgres

От
Shridhar Daithankar
Дата:
On Friday 11 Feb 2005 6:01 pm, Surabhi Ahuja wrote:
>  does postgres support notifications.
>
> for eg. through one connection to the server, i begin a transaction and i
> do inserts there. in another sessions, i want to get notified that inserts
> are taking place in someother session. please help.

Umm.. out of box, I don't think so. May be some triggers etc. can be placed
for information..Can you describe what you are trying to achieve?

> a few other questions
>
> Q1. is there anyway by which we can give priorities to the transactions?

You need priorities to connections or transactions?

> Q2. is there s concept of connection pool in postgres?

Yes. See pgpool(http://pgfoundry.org/projects/pgpool/)

> Q3. does postgres support multi threading? if yes how?

No. PostgreSQL backend process is single threaded. However each connection
gets a separate backend process. Hence on SMP machines, all available CPUs
can potentially be used for multiple connections.

Regards,
 Shridhar

Re: a few doubts regarding postgres

От
Richard Huxton
Дата:
Surabhi Ahuja wrote:
>  does postgres support notifications.
>
> for eg. through one connection to the server, i begin a transaction and i do inserts there.
> in another sessions, i want to get notified that inserts are taking place in someother session.
> please help.

You might want to look in the manuals for NOTIFY and LISTEN.

> a few other questions
>
> Q1. is there anyway by which we can give priorities to the transactions?

No. It's not clear that the idea makes sense in general (though it might
for specific examples). You can of course tune settings to favour
inserts over selects, or favour large sorts etc.

> Q2. is there s concept of connection pool in postgres?

Google for pgpool by Tatsuo Ishii

> Q3. does postgres support multi threading? if yes how?

In the client or the server? Which client? From what point of view?

--
   Richard Huxton
   Archonet Ltd

Re: a few doubts regarding postgres

От
John DeSoi
Дата:
On Feb 11, 2005, at 7:47 AM, Shridhar Daithankar wrote:

> On Friday 11 Feb 2005 6:01 pm, Surabhi Ahuja wrote:
>>  does postgres support notifications.
>>
>> for eg. through one connection to the server, i begin a transaction
>> and i
>> do inserts there. in another sessions, i want to get notified that
>> inserts
>> are taking place in someother session. please help.
>
> Umm.. out of box, I don't think so. May be some triggers etc. can be
> placed
> for information..Can you describe what you are trying to achieve?

I think NOTIFY/LISTEN should do this just fine, but you won't get the
notification unless the transaction where NOTIFY gets called is
committed.

http://www.postgresql.org/docs/8.0/interactive/sql-notify.html

John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL


Re: a few doubts regarding postgres

От
Terry Lee Tucker
Дата:
On Friday 11 February 2005 07:47 am, Shridhar Daithankar saith:
>
> No. PostgreSQL backend process is single threaded. However each connection
> gets a separate backend process. Hence on SMP machines, all available CPUs
> can potentially be used for multiple connections.
>
> Regards,
>  Shridhar

So then, can I count on the be_pid attribute returned from PQnotifies to be a
unique value associated only with a given user? I think the answer is yes,
but just making sure.

Thanks...

Re: a few doubts regarding postgres

От
Richard Huxton
Дата:
Terry Lee Tucker wrote:
> On Friday 11 February 2005 07:47 am, Shridhar Daithankar saith:
>
>>No. PostgreSQL backend process is single threaded. However each connection
>>gets a separate backend process. Hence on SMP machines, all available CPUs
>>can potentially be used for multiple connections.
>>
>>Regards,
>> Shridhar
>
>
> So then, can I count on the be_pid attribute returned from PQnotifies to be a
> unique value associated only with a given user? I think the answer is yes,
> but just making sure.

Yes (provided you're not running connection pooling).

--
   Richard Huxton
   Archonet Ltd