Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Some relational databases like Postgres and MySQL support JSON columns. This is useful if, for example, you want to create an ecommerce application with multiple product variations stored in a single table, but with different fields - that is called Single Table Inheritance (STI). You can have some regular columns for the common fields, and a JSON column for the specific ones.

If your app is built with Rails, you can use this library to help you on that (I'm not affiliated with it): https://github.com/jrochkind/attr_json



Is search in large tables slow in Postgres JSON columns? can it be index?


PostgreSQL JSON can be indexed and searched. They also have a JSONB format which is more efficient. Though I believe Mysql's JSON operators are more standards compliant.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: