liveBook · Manning

SQL

As explained in Kubernetes for Developers

An SQL query is a declarative statement that requests or manipulates data in a relational database.

SQL queries request or manipulate data in relational databases. In scalable applications, query behavior matters because inefficient queries slow down as data and request volume increase. section 6.4.1

Keep SQL query performance under control by:

  • Logging query performance during each request, then investigating slow queries and requests that generate many queries. section 6.4.1
  • Using EXPLAIN in MySQL or PostgreSQL to analyze specific queries. section 6.4.1
  • Adding indexes for commonly searched columns and reducing unnecessary JOIN operations. section 6.4.1
  • Avoiding N+1 queries by serving object lists without issuing a separate query for every object. section 6.4.1

Listing related objects

A request that renders a list should ideally use a constant number of database queries rather than one query for the list plus a separate query for each displayed object. section 6.4.1

How Kubernetes for Developers covers it

How deep it goes
Explains query logging, EXPLAIN, indexes, JOIN reduction, and N+1 avoidance, without detailing SQL syntax.
Examples
Uses query logs, EXPLAIN analysis, indexed columns, reduced JOINs, and object-list requests as concrete performance examples.
What you can do after
Diagnose/debug with query logs and EXPLAIN, then improve performance through indexes, fewer JOINs, and reduced query counts.
How it connects
Connects SQL queries with relational databases, MySQL, PostgreSQL, indexes, JOINs, EXPLAIN, and the N+1 query problem.

Also explained in

Compare how 25 books explain SQL →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kubernetes for Developers. The section links point to the parts of the book it draws on.