Comments (2)
There are 63 occurrences of this in the WideWorldImporters Sample Database.
from sql-server-samples.
Hi Bruce,
Thanks for the feedback.
There are different schools of thought on how to name indexes – there is not a single best practice that works for everyone. As the documentation of the sample mentions, it is designed using one set of guidelines, it is not the only way you can build a database.
If we change the naming of the index to IX_* then folks used to FK_* (to align with key names) would object.
The person who created the sample database is an experienced database developer. Their practice is to always create an index for a foreign key, and align with the name of the key, in the same way that indexes supporting primary key and unique constraints are aligned with the constraints.
As was also pointed out by one of the respondents for the stackoverflow thread you quote, one of the benefits is that you can easily find missing indexes for your foreign keys.
I realize that different folks follow different best practices, and unfortunately we cannot accommodate all in the sample DB.
Thanks,
Jos
From: Bruce Dunwiddie [mailto:[email protected]]
Sent: Friday, July 15, 2016 9:29 AM
To: Microsoft/sql-server-samples [email protected]
Subject: [Microsoft/sql-server-samples] Poor Index Naming Convention (#71)
This may seem silly, but indexes that were created to support foreign key constraints seem to have been named in this database with an FK_* prefix, which I do not think sets a good example for a preferred naming convention.
Example:
CREATE NONCLUSTERED INDEX [FK_Application_Cities_StateProvinceID] ON [Application].Cities
(
[StateProvinceID] ASC
);
This naming convention is normally used exclusively for foreign key constraints. This naming convention is also used for foreign key constraints in this database.
I would suggest renaming these indexes to follow an IX_* prefix naming convention.
So many people use these sample databases as a "Microsoft best practices", that I would like to prevent having to argue and fix these things in the field down the road in customer created databases.
References for preferred naming standards:
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHubhttps://github.com//issues/71, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AMuA9gLai5yLhzS_xdRyMsf70V-1Ggdcks5qV7UwgaJpZM4JNkjM.
from sql-server-samples.
Related Issues (20)
- Tell me the main error which is occurring again and again HOT 2
- Sql sample files in blob storage unavailable
- Unable to connect to Azure SQL Server from custom edge module.
- instnwnd.sql is not working exactly HOT 1
- Probe IndexStatistics failed to obtain data: Execution Timeout
- Calling Http endpoints in T-SQL using CURL extension - Content Type. HOT 1
- Sql
- Sebas
- Please update Security Permissions Posters and Post to Newer Blog Site
- create database SQL HOT 2
- .
- Incomplete samples/databases/wide-world-importers/wwi-ssdt/wwi-ssdt/PostDeploymentScripts/pds150-ins-app-cities-h.sql script
- Create Database
- install SQL server connect Database engine HOT 1
- Sql
- SqlEngineConfigAction_install_confignonrc_Cpu64 on Windows 11 HOT 1
- Just to mention ....
- Invoke-SqlAssessment - IndexFragmentation rule doesn't take partitions into consideration HOT 2
- Unpicked sales in WorldWideImporters database causes purchases to increase indefinitely?
- Importing AdventureWorks script does not work on fresh install of SSMS 19 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sql-server-samples.