As far as I know, SQL Server 2008 will only allow one clustered index for each table. For the sake of this question, let me say that I have a list of user submitted stories containing the following columns.
ID (int, primary key)Name (nvarchar)Url (nvarchar)UniqueName (nvarchar) This is url slug (blah-blah-blah)CategoryID (int, FK in the category table)
In most cases, stories will never be queried by ID. Most queries will be executed either using a category identifier or using a unique name.
I am new to indexing, so I suggested that it would be better to place 2 non-clustered indexes in this table. One on UniqueName and one on CategoryID. After some reading about indexes, it seems that the clustered index on UniqueName will be very useful. Given UniqueName ... unique would it be beneficial to place the primary key in UniuqeName and get rid of the ID field? Regarding CategoryID, I assume that a non-clustered index will be very good.
Thanks.
, id. , id. ( , , !).
, id, .
, , , , , , , . .
"ID", , . . "" "ID", INT, , PK. , , ( ) INT nvarchar(). PK UniqueName.
; , , , .
, , , .
, . , , , , .
, , Highlander: !
, :
, , , , . , ( " " ). , , . , , .
"ID" -. , - .
, . .
, . , , , , () . , , , , , , , - , , . ,
? . , , , . DBA Programmer , , , , . , , . , , , 100 000 , , , . , . 100 .
Source: https://habr.com/ru/post/1703654/More articles:Creating a new Iterator from the results of another Iterator - iteratorHow can I get rid of the resize handle in QDialog? - qtWhen the user presses "Enter" in ToolStripTextBox (VB.NET) - eventsWhat is the C # equivalent for a set of stl? - c #Help Using Flotilla and Ruby on Rails - ruby-on-railsПредварительная регистрация класса окон ATL - winapiПередайте несколько аргументов CreateThread - c++Website design or logical interface first? - javaSQL Server File and Filegroup - sql-serverWhat is the best way to split two database backup files using MS Sql Server 2005? - sql-serverAll Articles