Hacker News new | past | comments | ask | show | jobs | submit login

You don't even need these additional columns in PostgreSQL, thanks to expression indexes! [1]

Just add an expression index for your new field:

    CREATE INDEX ON blah BTREE ((jsoncolumn->>'new_thing'));
Then, the following kind of queries are blazingly fast due to the index:

    SELECT * FROM blah WHERE jsoncolumn->>'new_thing' = 'some_value';
This is less error prone than managing the consistency of the additional columns on your own. And if you still need some kind of pseudo-table, consider creating a simple view for that.

[1] https://www.postgresql.org/docs/current/static/indexes-expre...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: