SQL
14 guides tagged “SQL”.
- Offset vs Cursor Pagination: Which Should Your API Use? Offset pagination skips rows and drifts as data changes. Cursor pagination seeks directly and stays consistent. Compare them and learn when each is right.
- Postgres vs MySQL: Which Should You Use? Postgres and MySQL are far closer than the folklore says. Compare them on types, JSON, constraints, and operations, and get a direct recommendation.
- SQLite vs Postgres: Which Should You Use? SQLite is fast and zero-ops but single-writer. Postgres is concurrent and multi-user. Compare them, and see why local SQLite plus prod Postgres breaks.
- The 12 Database Mistakes That Show Up in AI-Generated Apps Missing indexes, N+1 queries, float money, naive timestamps, unpooled connections, and destructive migrations — the twelve database mistakes generated code ships with, and the fix for each.
- Databases for AI Builders: Why Your AI-Generated App Gets Slow and Loses Data Your AI writes working SQL that fails at scale. Learn indexing, the N+1 problem, transactions, connection pools, migrations, backups, and consistency — with linked guides for each.
- How to Choose a Database for Your App: A Decision Guide Workload, consistency, data shape, scale, and ops burden — the five questions that decide which database you should use, with a comparison table and the cases where each option is wrong.
- How to Design a Database Schema (That You Won't Have to Rewrite) Design a schema from your queries, not your entities: primary keys, relationships, column types, constraints, indexes, and the migration order that survives deploy day.
- What Are the Different Types of Databases (and What Is Each One For)? Relational, document, key-value, wide-column, graph, time-series, search, and vector databases — what each data model is, the use cases it fits, and the ones it breaks.
- How to Add an Index to a Slow SQL Query Diagnose a slow query with EXPLAIN, add the right index, and verify the speedup. A practical PostgreSQL tutorial.
- What Is a Covering Index? An index that contains every column a query needs can answer it without visiting the table at all — an index-only scan, which is faster and cheaper than any ordinary index.
- What Is a Materialized View? A materialized view stores the result of a query as a table. It makes expensive reads fast at the cost of staleness and maintenance — and it is not the same as a view.
- How to Read an EXPLAIN Plan A step-by-step reading of a query plan: what each node does, which numbers matter, and how to spot the scan or the estimate that explains a slow query.
- What Is the N+1 Query Problem? The N+1 problem fires one query per row instead of one query total, and AI-generated ORM code causes it constantly. Learn it with a code example.
- What Is a Composite Index? A composite index covers several columns in a defined order. Which queries it can serve depends on the leftmost columns, which is why column order is the whole design decision.