Duplicate values for one resource in xx_resource_token_refs #3763
Closed
Description
Describe the bug
The xx_resource_token_refs table contains duplicate entries. Although this doesn't impact the results of FHIR search interactions, it does lead to increased storage costs:
fhirdb=> select parameter_name_id, common_token_value_id, logical_resource_id, composite_id from fhirdata.patient_resource_token_refs where
parameter_name_id = 20423 and logical_resource_id = 458590;
parameter_name_id | common_token_value_id | logical_resource_id | composite_id
-------------------+-----------------------+---------------------+--------------
20423 | 886 | 458590 |
20423 | 886 | 458590 |
The same is true for xx_str_values.
Parameter tables are heavily indexed, so having duplicates here is significant.
Environment
Which version of IBM FHIR Server? 5.0.0
To Reproduce
- Build a fresh schema
- Run the system integration test suite
- Query the database and look for parameter tables with duplicate entries
Expected behavior
Parameter tables should not have duplicates. Note, some parameter values may be stored more than once if there are composites involved, but a parameter value should not be stored more than once where composite_id is null.
Additional context
N/A