liveBook · Manning

Optimization

As explained in Grokking Relational Database Design

Optimization is the process of improving database structures or operations to increase efficiency and responsiveness.

Database optimization improves efficiency and responsiveness while preserving data consistency and integrity. It balances performance, storage efficiency, maintainability, security, and scalability. section 3.2 section 7.1

Use a practical optimization workflow:

  • Understand application-generated queries, user interactions, and observed performance bottlenecks. section 7.10
  • Use query logs and production performance metrics to identify indexing opportunities. section 7.10
  • Add indexes that match frequent searches and filters, then check that schema changes do not harm performance or consistency. section 7.10
  • Consider denormalization when reducing query cost justifies storing some information redundantly. section 7.0
  • Replace unwieldy validity checks with reference tables when a controlled list contains many valid values. section 8.12

Indexing common product interactions

Suppose users search products by name and frequently view reviews. A full-text index on product.name supports keyword searches; an index on review.code supports lookups such as product code 23356. Similar reasoning adds an index on payment_method.email when email lookups are frequent. section 7.10

-- comment: works for MySQL and MariaDB
-- comment: consult ChatGPT on adaptations
-- comment: for other RDBMS
CREATE FULLTEXT INDEX ft_idx_name ON product (name);

Shows the SQL pattern for creating a MySQL or MariaDB full-text index on product.name. section 7.10

How Grokking Relational Database Design covers it

How deep it goes
Explains indexing, denormalization, query evidence, and reference tables, but does not detail query-plan internals.
Examples
Uses product-name searches, product-review lookups, email searches, and country reference data as concrete optimization cases.
What it assumes
Assumes a database design and application queries exist, while introducing optimization goals, indexing decisions, and storage trade-offs.
What you can do after
Apply it via indexes, denormalization, query metrics, and reference tables to improve performance and preserve data validity.
How it connects
Connects database design with normalization, denormalization, indexing, query performance, data integrity, and database security.

Also explained in

Compare how 30 books explain optimization →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Relational Database Design. The section links point to the parts of the book it draws on.