SQL Indexing and Performance/Search across multiple columns

Apply a simple wildcard search over several text fields.

Section: Pagination, Deduplication, and Search Patterns

Search across multiple columns

sql
sql
SELECT *
FROM customers
WHERE first_name LIKE '%john%'
   OR last_name LIKE '%john%'
   OR email LIKE '%john%';
Explanation

Simple LIKE search is easy to start with, though full-text search is better at scale.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Pagination, Deduplication, and Search Patterns
Use keyset pagination
Paginate by a stable cursor instead of a large OFFSET.
OpenIn sheetsqlsame section
Deduplicate rows with ROW_NUMBER
Keep one row per business key and remove duplicates logically.
OpenIn sheetsqlsame section
Explain a query
Inspect the execution plan for a SELECT statement.
Index a common lookup column
Speed up frequent equality or range predicates.
Find duplicate business keys
Detect repeated values that should be unique.
Explain with runtime stats
Run a query and collect timing or actual row information where supported.