How do you design a data model for a complex MetLife insurance claims reporting system to optimize both write performance and read query speeds?
For the supplied relational model, write a PostgreSQL query that produces a monthly claims report for claims opened during the first quarter of 2024. The report must use the latest available claim status and include payment and closure metrics.
Output
- One row per line of business and claim month, ordered by line of business and month.
- Return
line_of_business, claim_month, claim_count, total_paid, average_days_to_close, prior_month_claim_count, and cumulative_paid.
- Include claims without events or payments, treating missing payments as zero. Claims outside the quarter are excluded.