Chapter 15. Principles of Query Design
Well-designed, robust queries have the advantages of running faster and with fewer errors, as well as being easier to debug and maintain. This chapter describes some of the goals of query design, with particular attention to handling errors and tuning for performance.
Query Design Goals
Some of the elements of good query design include:
- Clarity
Queries that clearly convey their meaning are much easier to understand and therefore to maintain.
- Modularity
Expressions should be reusable in many parts of a query and across multiple queries.
- Robustness
Queries should be able to handle all possible combinations of values of input data.
- Error handling
Queries should handle dynamic errors gracefully, with useful messages.
- Performance
Queries should be tuned for performance.
The rest of this chapter takes a closer look at these design goals.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access