Best PostgreSQL datatype for storing key-value maps? Best PostgreSQL datatype for storing key-value maps? postgresql postgresql

Best PostgreSQL datatype for storing key-value maps?


you could use hstore which is a keymap, however I personally would us jsonb. It's a little overkill, however, most languages can convert json natively without having to decode it yourself.

In json, I'd just store a simple object or array for the info you're trying to store.

Both support indexes and are efficiently stored.

Hstore in text is a custom type format that your language may be unaware of and thus require processing the data to insert or query.