I'm still not sure I've grasped what are (if any) the
important differences between the classes PgDatabase and
PgConnection -- some of the descriptions in the docs are
identical for both classes, so I'm never sure when to use
each (I kind of use PgDatabase by default, but maybe I'm
Also, I'm quite unsure about what should be the lifetime
of the objects: should I create one database object when
the application starts, and every time I need to execute
an SQL statement, I call Exec? Or should I create a local
database object whenever I need it?
Normally, I would tend to think that one only object
introduces minimum overhead... But then, I'm not sure if
there are other factors to consider.
My situation is more or less like this: I have a real-time
system (not multi-threaded, though) which is the server in
a multi-player online game.
I'm going to use PostgreSQL for the database, which includes
tables for the players (and their passwords and related
data), and also for the games, chats, and plays.
So, every time a player connects, I'll have to check the
database of players to validate their logins (this might
happen with a frequency of, say, a couple of times per
second). When they're playing, everything will be added
to the corresponding tables... This might happen with
much higher frequency, I guess several hundred times per
second, but the data to store in the database is not much
(just a couple of bytes).
What approach could you recommend concerning the two
details mentioned in the subject?
BTW, the above figures are (very rough) estimated peaks;
of course, a sustained rate like that would fill up the
hard disk in a couple of days :-)
Thanks for any thoughts!
In response to
pgsql-interfaces by date
|Next:||From: Tom Lane||Date: 2002-01-20 03:24:04|
|Subject: Re: No history in psql |
|Previous:||From: Jan Josefowicz||Date: 2002-01-19 21:50:24|
|Subject: Re: No history in psql|