python - When should HStoreField be used instead of JSONField? -


django 1.8 provides hstorefield , django 1.9 provide jsonfield (which uses jsonb) postgresql.

my understanding hstore faster json, not allow nesting , allows strings.

when should 1 used on other? should 1 preferred on other? hstore still clear winner in performance compared jsonb?

if need indexing, use jsonb if you're on 9.4 or newer, otherwise hstore. there's no reason prefer hstore on jsonb if both available.

if don't need indexing , fast processing , you're storing , retrieving validated data, use plain json. unlike other 2 options preserves duplicate keys, formatting, key ordering, etc.


Comments