Ten questions before you trust a fast query

Rows read, rows returned, which predicates locate index entries, and whether the speed is cache, one user, or a small table.

More on Query execution and the optimizer

Keep learning

Overview

Jul 4 Jul 5 Jul 8 Jul 9 Jul 10 Jul 11 Jul 16 Jul 18 Rows read How many rows or index entries did the engine inspect? Compare actual rows with the result count. Rows returned How many rows did the application actually need? Access predicate Which condition tells the index where to start? Look for a condition on the index’s leading columns. Filter predicate Which condition is tested after rows are found? A late filter cannot undo the cost of reading the row. More data What happens when the table becomes 100× larger? Good lookup work grows with the answer, not the table. More users What happens when 25 sessions run it together? Multiply unnecessary work by concurrent sessions. Response time How long does one request wait? Measure latency, including queue and network time. How many requests finish each second? More cores often improve capacity before single-query speed. Cache state Was the data already in the buffer pool? Skipped work Did the index avoid pages or merely exist? An index is valuable only when the plan can use its order. chapters · query execution and the optimizer Ten questions before you trust a fast query “It took 3 ms” describes one run. It does not tell you how much the engine read, why it was fast, or what happens when the data and traffic grow. Performance principle fast once≠scales well W3Schools lab

Same answer. Very different work.

Choose an execution plan Weak index Useful index Example query INDEX (CustomerID, ShipperID) INDEX (CustomerID, OrderDate, ShipperID) Seek to (63, 2) · open 3 Seek to customer 63 · open all 8 Shipper 2 sits in one slice. The engine opens those 3 entries and never touches the other five. Customer 63 has 8 orders. OrderDate sits between the two filters, so Shipper 2 is scattered through the dates. The engine opens every one of the 8. Same 8 orders, now sorted by ShipperID. The three Shipper 2 entries are neighbors. These 8 cards are customer 63, in OrderDate order. Each card is one read. Order entries inspected by the selected plan Customer 63 never read Diagram legend returned read, then filtered never read Scalability test

Turn up data and traffic

Data volume 100× rows Concurrent sessions 1 user 25 users This is a work model, not a timing prediction. Timing changes with hardware and cache state. The model exposes the dependency: unnecessary reads become expensive when both data and traffic multiply them. Do not mix the measurements

Response time

Example: the customer’s order screen appeared in 180 ms.

Throughput

More CPU cores may raise this number without shortening one query. The review card

Ask all ten before you call the query cheap

Rule to keep A scalable plan avoids work before the rows are read. Filtering after a read can correct the answer. It cannot refund the read.

More courses

  • Jobs, linked to lessons — Browse jobs where every requirement links to the chapter that teaches it. See how ready you are, how long the gap takes to close, and which listings look stale.
  • Match a job post to courses — Paste a job post. Each skill is matched to a track here and put in learning order, foundations first.
  • React patterns from open source — Patterns extracted from Material UI, Radix, React Aria, React Hook Form, Redux Toolkit, TanStack, and Next.js — not slides about hooks.
  • System Design — Core concepts first (SQL vs NoSQL, CAP, indexing, replication, sharding), then designs grouped by what carries them: the database, Redis, Kafka, or many services.
  • NestJS: build a real API — One ticket-booking API, built in order: a plain Node server first, then NestJS modules, validation, a real database, and the features real clients lean on.
  • Microservices — Microservice patterns one diagram at a time: how to split a monolith, how services talk, and how data stays consistent without distributed transactions.
  • Kafka — A beginner-to-senior path through event logs, reliable delivery, production operations, and disaster recovery.
  • AI engineering for software engineers — Eight free reads, in order, for software engineers moving into AI: when to build an agent, how to build one, how to test it, and how the model works underneath.
  • Frontend system design — How a UI is sliced when it is a product, not a page: ownership of state, cache, routes, and what happens when the network lies.
  • TypeScript in depth — The type system as a design tool. Inference, narrowing, generics, and the errors that mean the model is wrong — not a catalog of utility types.
  • CSS in depth — See the box, then the page. Visual chapters from the box model through Flexbox surprises, Grid, selectors, and units, then backgrounds, shapes, and visual effects, each with a playground.
  • Accessibility — Foundations first (WCAG in plain words, semantic HTML, lists, alt text), then hands-on HTML labs, a full pass of WAI-ARIA 1.3, and a final fix-the-page challenge.
  • Docker — What an image is, why layers cache, and how containers find each other on a network.
  • Redis — Fifteen Redis patterns, one picture each: cache, session, lock, counter, rate limiter, queue, and when Redis is the wrong tool.
  • Kubernetes — Kubernetes from zero to operators: why it exists, Pods, Deployments and Services, then configuration, networking, storage, scheduling, scaling and security.
  • AWS — AWS networking in plain English. A VPC is a gated housing society: streets are subnets, the Internet Gateway is the main gate, and a route table is the signboard.
  • Networking: the NetRoute game — NetRoute is a packet logistics game. You wire up computers, switches, routers, firewalls and gateways, set each device, and watch glowing packets travel. If a packet gets dropped, the game shows you which header field was wrong.