3 ms·
Being obvious, if a field is called "index" (or similar) and doesn't have an index on it maybe the database could default to making it one.
by ape4 4y ago
Being obvious, if a field is called "index" (or similar) and doesn't have an index on it maybe the database could default to making it one.
- ElectricalUnion 4y ago"Obvious" for you, maybe for a general AI, but not to the DBMS. What if such field is a blob with a uncompressible 12mb blob of a image of a index card? What if indexing them would waste several TBs of RAM? That is not a good default. On a more realistic scenario, it is reasonably rare that you will only ever search using the PK, and no other constraint, so in a way is a wasted default index.
- ape4 4y agoGood point, make that only apply to fixed length chars (not varchars). I think JOINs use indexes which are often done on the primary key. https://www.mssqltips.com/sqlservertutorial/3207/make-sure-all-join-columns-are-indexed/ https://www.mssqltips.com/sqlservertutorial/3207/make-sure-a...
- fomine3 4y agoIt is called clustered index, used by MySQL. You still need different ordered index.