Database Indexing
A data structure that speeds up database queries by letting the database find rows without scanning every record.
An index is like a book's index: instead of reading every page to find a topic, you look up the page number and jump directly there. Without an index, a database query scans every row in a table (a "full table scan"). With an index on the right column, it jumps straight to the matching rows.
You add indexes to columns that appear in WHERE clauses, JOIN conditions, and ORDER BY. Common examples: user email (for login lookups), foreign keys (for relationship queries), and timestamps (for sorting by date). Too many indexes slow down writes (inserts and updates), so index strategically.
For vibe coders, indexing is the first thing to check when a query runs slowly. AI can suggest which columns to index based on your query patterns, but understanding the trade-off between read speed and write overhead helps you make the right call.