Skip to content

Comment on Show HN: Caffeine – Minimum viable back end for prototyping

Comments

`"CREATE TABLE IF NOT EXISTS %v ( id text PRIMARY KEY, data json NOT NULL)"`

Correct me if I'm wrong, as I havent used Postgres in a few years, but doesn't the `json` column in Postgres just store the data as text?

Last I knew, jsonb was much more efficient/performant for queries and storage, while having a very robust api for querying specific properties.

Curious what the reasoning was for using json rather than jsonb.

Correct. The json data type is less performant and stores the data more or less as lightly indexed text. jsonb optimizes the storage format and allows for more JSON operations, such as extracting individual keys.

For this product, if the super-generic API doesn't offer/require a need to do complex operations, though, json may be adequate to lookup items by id and present them.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.