On Tuesday 18 April 2006 13:42, Marc Santhoff wrote:
> Am Dienstag, den 18.04.2006, 21:29 +0200 schrieb Joost van der Sluis:
> > On Tue, 2006-04-18 at 14:43 -0400, Alexandre Leclerc wrote:
> > > 2006/4/18, Joost van der Sluis <[EMAIL PROTECTED]>:
> > > > But you can have one connection, whith several transactions bound
> >
> > to it.
> >
> > > > PostgreSQL doesn't support that, but SQLdb handles that for you,
> >
> > it
> >
> > > > creates new connection internally automatically.
> > >
> > > Do you mean TPQConnection does not support many TSQLTransaction?
> >
> > 'But you can have one connection, whith several transactions bound to
> > it.'
> >
> > So you can.
> >
> > Only PostgreSQL can't, so SQLDdb handles it.
>
> May I ask:
>
> Is this a problem with PostrgreSQL itself or the component in lazarus
> wrapping it?
>
> I'm planning to use PG in the near future, but this may influence my
> decision ...
>
> TIA,
> Marc
I can't answer your question directly. But I can provide a little information
about what I have added to this discussion. First let me say that I have
always used only one connection to a database engine and controlled all of my
transactions in code in the past (just to let you know where I'm coming
from). But with FPC I was not able to use just one connection to the
database. At first I considered this fact to be a problem. But then I
reconsidered. Yes, it is true if my user opens 10 forms I will have ten
connections and if I have 100 users I will have 1000 connections open. This
of course sounded like a lot. But then I realized that today Postgres can
handle thousands of connections without issue. In fact 1000 connections uses
only 50K of extra ram. With todays fast CPU's controlling 1000 connections
is nothing. But what about the time to open each connection? On a LAN I
doubt it amounts to much. On my LAN we are talking about micro-seconds per
connection (at least that is what is reported in the log). But on a dial-up
- Maybe! So in the end I guess it really doesn't matter. BTW in my app I
doubt if my users will have ten forms open at the same time. Also in my app
I close the connection each time I close a form. One nice thing as result of
using a connection per form - I no longer attempt to control the locking in
anyway. I let Postgres use it's record locking schema. I just use a try to
catch the error if there is a locking issue. So far I can not create any
locking issues even in code. Postgres is faster than I can update the data.
Hope this helps!
John
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives