Re: Periodically slow inserts

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Gael Le Mignot <gael(at)pilotsystems(dot)net>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Periodically slow inserts
Date: 2010-10-21 14:55:48
Message-ID: 23677.1287672948@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Gael Le Mignot <gael(at)pilotsystems(dot)net> writes:
> The problem is when we index objects into the full-text search part of
> the database (which a DELETE and then an INSERT into a specific table),
> the INSERT sometimes take a long time (from 10s to 20s), but the same
> insert (and many other similar ones) are fast (below 0.2s).

> This slowness comes regularly, about every 200 objects indexed,
> regardless of the frequency of the inserts.

Hm. You didn't say which PG version you're using, but if it's >= 8.4,
I think this may be caused by GIN's habit of queuing index insertions
until it's accumulated a reasonable-size batch:
http://www.postgresql.org/docs/9.0/static/gin-implementation.html#GIN-FAST-UPDATE

While you can turn that off, I think that doing so will reduce the
index's search efficiency over time. It might be better to schedule
regular vacuums on the table so that the work is done by vacuum rather
than foreground queries.

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Gael Le Mignot 2010-10-21 15:07:13 Re: Periodically slow inserts
Previous Message Brad Nicholson 2010-10-21 14:34:49 Re: New wiki page on write reliability