pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: John Scalia <jayknowsunix@gmail.com>
To: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: Pgsql-admin <pgsql-admin@lists.postgresql.org>
Subject: Re: Disabling indexes on a table
Date: Fri, 19 Feb 2021 07:10:03 -0500
Message-ID: <81BF8164-61B9-4C51-A592-714FA270A6A6@gmail.com> (raw)
In-Reply-To: <66028fd5cc301f5726d759e46903f88f8c18217f.camel@cybertec.at>
References: <66028fd5cc301f5726d759e46903f88f8c18217f.camel@cybertec.at>

Thank you for the confirmation Laurenz, I suspected this would be the situation, and the developer did drop the indexes prior loading then rebuilt them afterwards per my suggestion.

Sent from my iPad

> On Feb 19, 2021, at 4:23 AM, Laurenz Albe <laurenz.albe@cybertec.at> wrote:
> 
> On Thu, 2021-02-18 at 11:24 -0500, John Scalia wrote:
>> One of my developers asked me about this, and he suggested running the following update:
>> 
>> UPDATE pg_index SET indisready=false
>> WHERE indrelid = (select oid from pg_class where release = ‘his_table’);
>> 
>> I told him it’s never a good idea to update anything in a system catalog by hand,
>> but that I would reach out here for a better opinion. Am I correct that he
>> shouldn’t try this, or is he OK to do this? His table has approximately 8
>> different indexes on it, and those really slow down his bulk loads.
>> Usually when I have to get involved, I just drop his indexes and rebuild
>> them afterwards, and I know that is always safe.
> 
> https://www.postgresql.org/docs/current/catalog-pg-index.html says:
> 
> indisready bool
> 
>  If true, the index is currently ready for inserts. False means the
>  index must be ignored by INSERT/UPDATE operations.
> 
> So that would indeed speed up a bulk load, but your indexes would be
> unusable afterwards.  If you run a second update to "pg_index" to
> set "indisready" to TRUE, you would end up with corrupted indexes.
> 
> The indexes will be useless and can only be dropped.  So you are right
> that that is not a good idea.
> 
> Yours,
> Laurenz Albe
> -- 
> Cybertec | https://www.cybertec-postgresql.com
> 





view thread (4+ messages)

Message-ID: <81BF8164-61B9-4C51-A592-714FA270A6A6@gmail.com>
Permalink:  ../81BF8164-61B9-4C51-A592-714FA270A6A6@gmail.com/
Also on:    postgresql.org/message-id/81BF8164-61B9-4C51-A592-714FA270A6A6@gmail.com

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: jayknowsunix@gmail.com, laurenz.albe@cybertec.at, pgsql-admin@lists.postgresql.org
  Subject: Re: Disabling indexes on a table
  In-Reply-To: <81BF8164-61B9-4C51-A592-714FA270A6A6@gmail.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