Re: Slow GIN indexes after bulk insert

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Chris Spencer <chrisspen(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Slow GIN indexes after bulk insert
Date: 2016-03-22 00:50:41
Message-ID: CAMkU=1zFnTB_4XhZJRviFz03jPcMBUFLw6nNBNk22w64tE85+Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Mar 21, 2016 at 10:55 AM, Chris Spencer <chrisspen(at)gmail(dot)com> wrote:
> I have 5 GIN indexes on a PG 9.3 table containing about 50 million records.
> Each index covers a "group" of common records like billing address, shipping
> address, contact names, etc.
>
> When first created, the indexes works miracles in speeding up the full text
> search of these fields. However, I'm running into some serious maintenance
> headaches.
>
> After I insert a few thousand new records, the indexes seem to have no
> effect. A query that might normally take 1 second now takes 5 minutes.

I'd try turning fastupdate off on the indexes. It will probably slow
down your bulk inserts, (perhaps by a lot, but you won't know until
you try). But if you can handle that, it will make your slow select
problems go away like magic.

Cheers,

Jeff

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michael Paquier 2016-03-22 00:59:34 Re: Request - repeat value of \pset title during \watch interations
Previous Message Alvaro Herrera 2016-03-21 21:27:14 Re: [HACKERS] Request - repeat value of \pset title during \watch interations