Hello,

is calling pg_result() necessary, when using code like this?

       use constant SQL_OPTIONS => {pg_async => PG_ASYNC + PG_OLDQUERY_WAIT};

        eval {
                my $dbh = DBI->connect_cached(DSN, DBUSER, DBPASS, {
                    private_no_cache => __FILE__.__LINE__,
                    AutoCommit => 1,
                    PrintWarn => 1,
                    PrintError => 1,
                    RaiseError => 1,
                    FetchHashKeyName => 'NAME_lc',
                    pg_enable_utf8 => 1
                });

                my $sth_logout = $dbh->prepare_cached(
                    q{update pref_users set logout=now() where id=?},
                    SQL_OPTIONS);
                $sth_logout->execute($user->{ID});
        };
        warn $@ if $@;

I'm using CentOS 6.3/64 bit with perl 5.10.1 and:

postgresql-libs-8.4.13-1.el6_3.x86_64
postgresql-server-8.4.13-1.el6_3.x86_64
postgresql-devel-8.4.13-1.el6_3.x86_64
postgresql-8.4.13-1.el6_3.x86_64
perl-DBD-Pg-2.15.1-4.el6_3.x86_64
perl-DBI-1.609-4.el6.x86_64

to run a non-forking server (a game daemon)
which poll()s TCP-sockets and sometimes writes
data (player statistics) into PostgreSQL.

Despite very performant HW (quad cpu, 32 GB RAM),
the users are complaining about occasional
server freezes (I see data being written to
postmaster processes at these moments) and
I'm trying to speed it up by using the above code.

But I'm not sure if the code above is a good idea?

I'm trying to use

                    private_no_cache => __FILE__.__LINE__,

so that multiple connections are being opened to the d/b.

And I'd like to use PG_OLDQUERY_WAIT
for all queries which don't return (or so I think)
results - INSERTs and stored procedure calls.

Thank you for any insights.

I've done a lot of lookup on the web + in the git.

Regards
Alex

Reply via email to