- Newest
- Most votes
- Most comments
Good Morning Jess,
Choosing the optimal format for storing your data in a centralized Aurora DB to facilitate efficient reading and updating by different LOBs involves weighing the pros and cons of storing the data as a JSON payload versus normalizing it into relational tables. Let's break down the considerations: Storing as JSON in a Single Table:
Pros: Simplicity: Storing the entire JSON payload in a single column can be straightforward and align well with the structure of your incoming data. Quick Reads: Retrieving the entire payload in one query can be efficient for applications that need the full dataset.
Cons: Limited Query Flexibility: Extracting specific data elements within the JSON can be complex and less efficient, especially for ad hoc queries. Indexing Challenges: It may be challenging to efficiently index and query specific fields nested within the JSON structure. Normalization into Relational Tables:
Pros: Query Flexibility: Breaking down the JSON into relational tables based on entities (e.g., client info, contact info, child info) allows for optimized querying. Data Integrity: Enforcing constraints and relationships through the use of foreign keys ensures data integrity. Performance Optimization: Indexing and optimizing queries become more straightforward with normalized data.
Cons: Increased Complexity: Designing an ERD and managing the relationships between tables can be more complex upfront. Data Retrieval Overhead: Joining tables to reconstruct the original payload can add overhead, especially if the data structure changes frequently.
Recommendation: Given your scenario where data payloads are around 50KB and contain complex structures, consider a hybrid approach:
Store the Full JSON Payload: Keep a primary table where the entire JSON payload is stored for quick retrieval when needed.
Normalize Specific Entities: Identify key entities within the payload (e.g., client, contact, child) and create separate relational tables for them.
Use Views or Materialized Views: Create database views or materialized views that provide a normalized representation of the data for efficient querying.
Implement Indexing Strategically: Use indexing to optimize queries on specific fields or entities within the JSON payload or relational tables.
This approach combines the simplicity of storing the entire payload with the flexibility and performance gains of relational tables where necessary. It allows LOBs to access the data in the way that best suits their needs—whether that's retrieving the full payload or querying specific entities. Additionally, leveraging database features like views and indexing can further optimize performance and data accessibility.
Ismael Murillo
Relevant content
- asked 22 days ago
- Accepted Answerasked a year ago
- AWS OFFICIALUpdated 9 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 7 months ago
Thank you for you answer! I would love also to have some insight from peoples how have experience on Aurora or have worked in similar use case to share their thoughts / experience .. rather then a GenAI response