✨ Document indexes and make them opt-in#205
Merged
Conversation
Codecov Report
@@ Coverage Diff @@
## main #205 +/- ##
==========================================
+ Coverage 97.43% 97.49% +0.06%
==========================================
Files 177 181 +4
Lines 5895 6037 +142
==========================================
+ Hits 5744 5886 +142
Misses 151 151
Continue to review full report at Codecov.
|
Contributor
|
🚀 Deployed on https://61cae8a090dfde07c76a4093--sqlmodel.netlify.app |
Contributor
|
📝 Docs preview for commit dd453ba at: https://61cae8f3eaa6703b1dc08de3--sqlmodel.netlify.app |
8 tasks
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
✨ Document indexes and make them opt-in
Up to now, SQLModel created indexes for each column by default. This PR changes that to make indexes only opt-in (including the same line change as in #11), and documents indexes, etc.
This PR adds a new section explaining indexes, how they work, and how to enable them for columns.
It also updates all the rest of the docs examples to use indexes accordingly and references to indexes where necessary.
It adds tests for index creation (for the new tutorial source examples) and updates other tests as needed.
The rationale for the previous behavior of having indexes by default was that it's easy for beginners to not know about indexes, not spend the time to learn about them, and get bad reading performance. It was also partly inspired by how ElasticSearch indexes everything by default, but it probably makes more sense there that everything would be intended to be searchable. But I see this approach was not very generalizable as commented here #9 and #11. So I'm reverting that approach here and instead I'm documenting and explaining indexes as best as I could after several days of working on this.