From: Thomas A. Lowery <tl-lists@stlowery.net>
To: pgsql-admin@postgresql.org
Subject: Re: Performance Problems
Date: Fri, 23 Aug 2002 21:08:25 -0400
Message-ID: <20020823210825.A12098@stllnx1.stlassoc.com> (raw)
In-Reply-To: <"from alexp"@meta-bit.com>
References: <3D663946.4050008@meta-bit.com>
<19614.1030110585@sss.pgh.pa.us>
<3D6644E2.2030707@meta-bit.com>
Alex,
You're able to alter the autocommit value during processing:
$dbh->{AutoCommit} = 0;
$dbh->do( qq{insert into yucky values ('A')} );
$dbh->commit;
$dbh->{AutoCommit} = 1;
$dbh->do( qq{truncate table yucky} );
$dbh->{AutoCommit} = 0;
$dbh->do( qq{insert into yucky values ('A')} );
$dbh->commit;
Do you need the use of a temp database table? If so have you
looked at using a memory resident table (DBD::AnyData)?
Another thing I've found that helps is to cache reference or lookup data.
Memoize is an easy way to cache. This only works for data that doesn't
change between queries select x from y where z = 1 always returns 'F' ...
Tom
On Fri, Aug 23, 2002 at 11:21:22PM +0900, Alex Paulusberger wrote:
> Tom,
> thanks. I do use DELETE FROM since truncate is not an option in
> trnansaction blocks
> and within DBI , autocommit has to be turned off when connecting to the DB.
>
> But maybe you are right, and the overhead not being able to truncate
> tables is bigger than
> not using transaction blocks.
>
> Regards
> Alex
>
> Tom Lane wrote:
>
> >Another thought...
> >
> >Alex Paulusberger <alexp@meta-bit.com> writes:
> >
> >>The whole process loops 4,500 times.
> >>For every loop
> >>- a temp table is cleared
> >>
> >
> >How exactly are you clearing the temp table? DELETE FROM isn't a good
> >plan because you'll still have dead tuples in there. You could do a
> >DELETE FROM and then VACUUM, but I'd suggest TRUNCATE instead.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: tl-lists@stlowery.net
Subject: Re: Performance Problems
In-Reply-To: <20020823210825.A12098@stllnx1.stlassoc.com>
References: <3D663946.4050008@meta-bit.com> <19614.1030110585@sss.pgh.pa.us> <3D6644E2.2030707@meta-bit.com> <20020823210825.A12098@stllnx1.stlassoc.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox