docs: remove unecessary details about db indexes

This commit is contained in:
Bereket Engida
2025-04-05 21:22:00 +03:00
parent 1704d1964c
commit 18744b04ba

View File

@@ -125,36 +125,7 @@ and prioritize critical data for the initial render while loading less essential
## Database optimizations ## Database optimizations
Optimizing database performance is essential for any authentication library, including Better Auth. Optimizing database performance is essential to get the best out of Better Auth.
Efficient database interactions can significantly enhance the speed and reliability of user authentication processes.
Since Better Auth supports a wide variety of databases, we cannot cover each one in detail regarding optimization techniques.
However, we can provide some general tips and strategies to improve your database performance.
Below are two critical techniques specifically tailored for Better Auth: using indexes and employing connection pools.
### Using indexes
Indexes are powerful tools that can dramatically improve the performance of database queries, especially in an authentication context where speed is crucial.
Heres how to effectively utilize indexes in Better Auth:
1. **Types of Indexes**: There are several types of indexes, including:
- B-tree Indexes: The most common type, suitable for a wide range of queries.
- Hash Indexes: Useful for equality comparisons but not for range queries.
- Full-text Indexes: Designed for searching text within large text fields.
- Spatial Indexes: Optimized for spatial data types, such as geographic coordinates.
2. **When to Use Indexes**: Indexes are particularly beneficial for:
- Columns frequently used in WHERE clauses.
- Columns involved in JOIN operations.
- Columns used in ORDER BY and GROUP BY clauses.
3. **Trade-offs**: While indexes can significantly speed up read operations, they can also introduce overhead during write operations (INSERT, UPDATE, DELETE) because the index must be updated.
Therefore, it's essential to strike a balance between read and write performance.
4. **Monitoring and Maintenance**: Regularly monitor index usage and performance. Unused or rarely used indexes can be removed to reduce overhead. Additionally, consider rebuilding or reorganizing indexes periodically to maintain their efficiency.
You can read more about indexes in the <Link href="https://en.wikipedia.org/wiki/Database_index">database index wikipedia page</Link>.
#### Recommended fields to index #### Recommended fields to index