3.16 Reduce the number and complexity of database queries
Optimize database use by minimizing and scoping queries, reducing repeated requests, and applying data governance practices.
Success Criteria
- Database queries:
Optimize database queries to reduce load by retrieving required data in as few queries as possible, and by applying filtering and selection at the database level rather than in application or ORM code, especially for frequently accessed data. - Database queries:
Retrieve data only once per request or process and reuse it locally instead of repeating database queries. - Database queries:
Scope database queries to return only the fields and records that are required. - Database queries:
Apply data lifecycle and governance controls such as Time-to-Live (TTL), use of non-sensitive identifiers like UUIDs, de-identification, and minimization of stored data in line with purpose limitation principles.