Explore Text Search Strategies
This interactive demo allows you to compare different PostgreSQL text search strategies in real-time.
Each strategy has different performance characteristics and use cases. Try searching with different terms to see how they behave!
Query Results
Performance Metrics
Planning Time: - ms
Execution Time: - ms
Total Time: - ms
Results Found: -
View EXPLAIN Plan (Advanced)
About the Search Strategies
LIKE contains (ILIKE %q%)
Baseline substring search. Uses sequential scan unless trigram index helps. Good for simple contains queries.
LIKE prefix (ILIKE q%)
Prefix search that can use btree index with text_pattern_ops. Efficient for "starts with" queries.
Startswith via left(text, n)
Teaching moment: Using functions on columns often defeats index usage. Usually slower than direct LIKE prefix.
Trigram similarity
Uses pg_trgm extension for fuzzy matching. Great for typo tolerance and similarity-based ranking.
Full-text search
Token-based search using PostgreSQL's built-in full-text search. Excellent for word-based queries, supports stemming and ranking.
Benchmark Search Strategies
Compare the performance of different search strategies and query types across different models.
This tool uses advanced benchmarking to help you understand database query performance.
Benchmark Results
Test Configuration
Model: -
Search Term: -
Iterations: -
Record Count: -
Running benchmarks...
This may take a few seconds...
About Benchmark Strategies
Iterative Fetch
Fetches records in batches and performs search in Python. Useful for understanding the overhead of Python processing.
Non-Indexed
Forces database to avoid using indexes. Useful for understanding the benefit of indexes by comparison.
Indexed
Standard Django ORM queries that leverage database indexes. Represents typical production performance.
Trigram
Uses PostgreSQL pg_trgm extension for similarity-based search. Best for fuzzy matching and substring search.
Full-Text
Uses PostgreSQL full-text search with SearchVector. Token-based search, best for word/phrase matching.