JavaScript is required for the interactive terminal. The essential portfolio information remains available below.
Static Markdown articles about building dependable software.
Creating indexes will not always solve it.
A simple index does not always fix a slow query. Learn about column order, cost, and query plans.
Creating indexes will not always solve it
You have a table with millions of rows and a query that takes seconds to respond.
The first idea is usually simple: create an index. But a single-column index is not always enough. The right index depends on the filters, the column order, and the execution plan.
Think about an address book
Imagine a large address book organized by last name. Finding Machado, João is easy. Finding every João is different because the book was not organized by first name.
The same idea applies to a composite index:
sql
CREATE INDEX idxpeoplelastnamefirstname
ON people(lastname, firstname);
The order matters. (lastname, firstname) is not the same as (firstname, lastname), and each one can be better for different queries.