When should HStoreField be used instead of JSONField? When should HStoreField be used instead of JSONField? postgresql postgresql

When should HStoreField be used instead of JSONField?


If you need indexing, use jsonb if you're on 9.4 or newer, otherwise hstore. There's really no reason to prefer hstore over jsonb if both are available.

If you don't need indexing and fast processing and you're just storing and retrieving validated data, use plain json. Unlike the other two options this preserves duplicate keys, formatting, key ordering, etc.