When to use AttrJson
masterAttrJson is designed for scenarios where you want to access complex, structured data in an object-oriented fashion without creating a highly normalized RDBMS schema.
Use cases include:
- Complex Data Structures: When you need to avoid complicated normalized schemas but still want to interact with data as objects.
- Single-Table Inheritance (STI): When subclasses have non-shared data fields that would otherwise require many sparse columns in a single table.
- Content Management Systems (CMS): When you need varied, plugin-driven, or configuration-dependent structured data that doesn't require heavy relational querying.
- Model Versioning: When you want to minimize associations by inlining complex data into a single table row to simplify versioning.
- Hybrid Document Store: When you want to treat PostgreSQL as a simple object-oriented document store while still maintaining standard RDBMS features like foreign keys and associations on the same row.
When to avoid AttrJson:
- If you require sophisticated querying, reporting, or high performance on complex data, a traditional normalized RDBMS schema is preferred over
jsonb.