Re: Thread safe connection-name mapping in ECPG. Is it required?

Поиск
Список
Период
Сортировка
От Michael Meskes
Тема Re: Thread safe connection-name mapping in ECPG. Is it required?
Дата
Msg-id 20040227073913.GA3502@1
обсуждение исходный текст
Ответ на Thread safe connection-name mapping in ECPG. Is it required?  (Shridhar Daithankar <shridhar@frodo.hserus.net>)
Ответы Re: Thread safe connection-name mapping in ECPG. Is it  (Shridhar Daithankar <shridhar@frodo.hserus.net>)
Список pgsql-hackers
On Mon, Feb 23, 2004 at 09:27:40PM +0530, Shridhar Daithankar wrote:
> It looks like the mutex protects the connections list in connection.c. I do 
> not like that from a application developers perspective.
> 
> If I am developing an application and using multiple connections in multiple 
> threads, I have to store a connection name for each connection as C string. 
> Of course, I also have to protect it across thread so that I can rightly tell 
> ecpg what connection I would be talking to next.
> 
> If an application can take care of a C string, it can also take care of a 
> connection structure. On top of it, it eliminates the list lookup. The 
> potential performance gain could be worth it if there are hundreds of 
> connections and a busy website/application server.
> 
> What I wonder is, do we really need to maintain that level of lookup? Can't we 
> just say a connection is a 'struct connection *' which should be opaque and 
> should not be touched or poked inside, just like PGConn.

I'm not sure I understand you correctly. The SQL standard says you can
call your statement as this:
exec sql at CONNECTION select 1;

Here CONNECTION of course is a string, the name of the connection. So,
yes, we have to maintain that list to make sure we get the right
connection.

Or what were you asking?

Michael
-- 
Michael Meskes
Email: Michael at Fam-Meskes dot De
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Josh Berkus
Дата:
Сообщение: Re: [pgsql-www] Collaboration Tool Proposal
Следующее
От: Michael Meskes
Дата:
Сообщение: Re: CVS HEAD compile warning