a few doubts regarding postgres

Started by surabhi.ahujaabout 21 years ago6 messagesgeneral
Jump to latest
#1surabhi.ahuja
surabhi.ahuja@iiitb.ac.in

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

#2Shridhar Daithankar
ghodechhap@ghodechhap.net
In reply to: surabhi.ahuja (#1)
Re: a few doubts regarding postgres

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

#3Richard Huxton
dev@archonet.com
In reply to: surabhi.ahuja (#1)
Re: a few doubts regarding postgres

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

#4John DeSoi
desoi@pgedit.com
In reply to: Shridhar Daithankar (#2)
Re: a few doubts regarding postgres

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

#5Terry Lee Tucker
terry@esc1.com
In reply to: Shridhar Daithankar (#2)
Re: a few doubts regarding postgres

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...

#6Richard Huxton
dev@archonet.com
In reply to: Terry Lee Tucker (#5)
Re: a few doubts regarding postgres

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