Re: DBI/AutoCommit/Postgres - Mailing list pgsql-general

From Tom Lane
Subject Re: DBI/AutoCommit/Postgres
Date
Msg-id 721.988672863@sss.pgh.pa.us
Whole thread Raw
In response to DBI/AutoCommit/Postgres  (Fran Fabrizio <ffabrizio@Exchange.WebMD.net>)
List pgsql-general
Fran Fabrizio <ffabrizio@Exchange.WebMD.net> writes:
> Another crucial piece of information is that each insert kicks off a
> trigger.  I did not write the trigger, and do not know how to write
> triggers, but I think that might be the contributing factor to the
> slowness.

Bingo.  Your trigger is adding four complete queries (two selects and
two inserts or updates) for every row inserted.

Think about ways to avoid some or all of those.  (For example, does the
knownhosts table really need a last_contact column, or could you obtain
that on-the-fly from a query over the incoming or status table when
needed?)  Also look to see if these are being done with reasonable query
plans ... perhaps you need some indexes and/or vacuum operations ...

            regards, tom lane

pgsql-general by date:

Previous
From: Joel Burton
Date:
Subject: Re: PHPPgAdmin or MS Access
Next
From: Eugene Lee
Date:
Subject: TRUNCATE and INDEXes