Indexes make reads faster but writes slower. The tradeoff is clear
- Index is for fast Select
Database indexing fundamentals:
- Time-based indexing is inefficient
- Creates overhead for data that changes frequently
- Makes time-range queries faster but at a cost
- String indexing has limitations
- Takes up more space than numeric indices
- Consider encoding strings as integers when possible (e.g., for UUID if not natively supported by the database)
- Best practices for indexing
- Only index columns that truly need it
- Indexed columns don't truly have "UPDATE" operations - they work as DELETE + INSERT behind the scenes
- Each additional index increases storage requirements and memory usage
- Know the limitations
- Databases are not search engines - avoid ngram indexing when possible
- For large string searches, synchronize with dedicated solutions like Elasticsearch
DB Indices
DB Indexing Algorithms
