Tell me about how memoization works and how it relates to database concepts like caching and repeated subproblems.
Use the provided request and cache records to demonstrate the relationship with SQL. Identify subproblems requested more than once, count their requests and cache hits, and show the cached result when available.
subproblem_key, request_count, cache_hit_count, and cached_value.| Column | Type | Description |
|---|---|---|
| request_idPK | INT | Unique request identifier |
| subproblem_key | VARCHAR(100) | Inputs identifying a reusable subproblem |
| cache_hit | BOOLEAN | Whether the request reused a cached result |
| requested_at | TIMESTAMP | Time when the subproblem was requested |
| Column | Type | Description |
|---|---|---|
| subproblem_keyPK | VARCHAR(100) | Cache key for a computed subproblem |
| result_text | VARCHAR(255) | Stored result for the subproblem |
| computed_at | TIMESTAMP | Time when the cached result was computed |