How jsonb updates affect GIN indexes - Mailing list pgsql-general

From Eric Mortensen
Subject How jsonb updates affect GIN indexes
Date
Msg-id CAHRqbZEnmcgridP-B2y6B7vhEvWYB=rnY+mWJdDHjXLRousK4g@mail.gmail.com
Whole thread Raw
Responses Re: How jsonb updates affect GIN indexes
List pgsql-general
Hi

When a jsonb column is updated, as far as I understand the entire column is updated, even though perhaps only one of the keys has a modified value. 

My question is: if I have a GIN index on that column, will PG visit every key and update each index entry, or will it visit every key and update each index entry only if the value is different, or will it only visit those keys that have been modified?

I have a jsonb column where I only need to index two keys, and was wondering if there is any benefit in terms of update efficiency to having two indexes, one for each key, rather than just creating a GIN index on the whole (rather large) column. 

Thanks,
Eric

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Possible bug in psql 9.4.4
Next
From: Francisco Olarte
Date:
Subject: Re: How jsonb updates affect GIN indexes