-
Notifications
You must be signed in to change notification settings - Fork 787
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add recommendation on indexes in unique columns (#6553)
Co-authored-by: Jon Harrell <[email protected]>
- Loading branch information
1 parent
41c4602
commit a630b4d
Showing
2 changed files
with
18 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
content/700-optimize/400-recommendations/1300-indexing-on-unique-columns.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
title: 'Indexing on unique columns' | ||
metaTitle: 'Optimize recommendations: Indexing on unique columns' | ||
metaDescription: "Learn about the recommendation provided by Optimize regarding indexing on uniquely constrained columns." | ||
tocDepth: 3 | ||
toc: true | ||
--- | ||
|
||
Optimize identifies redundant indexing on unique columns and provides recommendations for better database performance. | ||
|
||
### Why this is an issue | ||
|
||
Unique constraints inherently enforce uniqueness by generating an underlying index. Adding an additional index to the same column is unnecessary and can lead to extra overhead. | ||
|
||
This redundancy increases write costs and slows down updates, as the database must synchronize multiple indexes. | ||
|
||
This guideline applies broadly to relational databases like PostgreSQL, MySQL, MariaDB, SQLite, and SQL Server, which automatically create indexes for unique constraints. |