Click here to Skip to main content
15,880,392 members
Home / Discussions / Database
   

Database

 
GeneralRe: Shipping tracking Link output to google search from MYSQL Database Pin
bfg9000d36026-Apr-18 1:17
bfg9000d36026-Apr-18 1:17 
QuestionCopying the Headers of Result Set of Select statement Pin
indian14324-Apr-18 9:05
indian14324-Apr-18 9:05 
AnswerRe: Copying the Headers of Result Set of Select statement Pin
JChrisCompton24-Apr-18 11:42
JChrisCompton24-Apr-18 11:42 
AnswerRe: Copying the Headers of Result Set of Select statement Pin
Mycroft Holmes24-Apr-18 12:53
professionalMycroft Holmes24-Apr-18 12:53 
GeneralRe: Copying the Headers of Result Set of Select statement Pin
indian14324-Apr-18 14:09
indian14324-Apr-18 14:09 
GeneralRe: Copying the Headers of Result Set of Select statement Pin
Mycroft Holmes24-Apr-18 14:32
professionalMycroft Holmes24-Apr-18 14:32 
GeneralRe: Copying the Headers of Result Set of Select statement Pin
indian14325-Apr-18 9:48
indian14325-Apr-18 9:48 
QuestionNaming my clustered index column which isn't the PK (and is a non-PK clustered Identity a good idea?) Pin
JChrisCompton20-Apr-18 11:55
JChrisCompton20-Apr-18 11:55 
My original question was, "What should I name the clustered index column which isn't the primary key?" but then I started putting in why I was doing it, and changed the subject to include 'is this a good idea?'

I have a table and the primary key is a GUID, which is generated from vendor code so I cannot do what I would normally do: create an int for the clustered index and use that as the pk.

My idea is to create the table like this:
CREATE TABLE [dbo].[table_name](
	[need_a_good_name_here] [int] IDENTITY(-1,-1) NOT NULL,  -- Adding this field
	[guid] [char](36) NOT NULL PRIMARY KEY NONCLUSTERED,
	...
) ON [PRIMARY]

CREATE CLUSTERED INDEX Ix_Table_Name ON [dbo].[table_name] ([need_a_good_name_here] ASC)
Feel free to comment on the following:

1. I don't want the guid to be the clustered index because there will be inserts.
There were 3,000 inserts the first month, and I'm expanding from one category to four five. No way to know the distribution of inserts (except 1st shift / business days) and I don't know the frequency of the other categories.
Fill factor == 100, not sure I can get it changed.

2. I have the identity starting at -1 and decreasing by 1 to make it obvious that it isn't the pk.
Don't know how much this will help, but I do what I can.

3. I don't like the names ix_need_a_good_name_here, need_a_good_name_here_ix, need_a_good_name_here_id, because if I saw them I would assume that was the primary key. Suggestions?

4. Should I just not worry about splits?

5. Remember my mention of vendor code... I can't use SQL Server NEWSEQUENTIALID() which would make #1 a non-issue.

All feedback appreciated!

modified 24-Apr-18 17:23pm.

AnswerRe: Naming my clustered index column which isn't the PK (and is a non-PK clustered Identity a good idea?) Pin
Victor Nijegorodov21-Apr-18 3:34
Victor Nijegorodov21-Apr-18 3:34 
GeneralRe: Naming my clustered index column which isn't the PK (and is a non-PK clustered Identity a good idea?) Pin
JChrisCompton23-Apr-18 3:00
JChrisCompton23-Apr-18 3:00 
AnswerRe: Naming my clustered index column which isn't the PK (and is a non-PK clustered Identity a good idea?) Pin
Eddy Vluggen23-Apr-18 5:19
professionalEddy Vluggen23-Apr-18 5:19 
AnswerRe: Naming my clustered index column which isn't the PK (and is a non-PK clustered Identity a good idea?) Pin
Jörgen Andersson23-Apr-18 21:58
professionalJörgen Andersson23-Apr-18 21:58 
GeneralRe: Naming my clustered index column which isn't the PK (and is a non-PK clustered Identity a good idea?) Pin
JChrisCompton24-Apr-18 11:21
JChrisCompton24-Apr-18 11:21 
GeneralRe: Naming my clustered index column which isn't the PK (and is a non-PK clustered Identity a good idea?) Pin
Eddy Vluggen25-Apr-18 0:41
professionalEddy Vluggen25-Apr-18 0:41 
GeneralRe: Naming my clustered index column which isn't the PK (and is a non-PK clustered Identity a good idea?) Pin
JChrisCompton25-Apr-18 4:40
JChrisCompton25-Apr-18 4:40 
GeneralRe: Naming my clustered index column which isn't the PK (and is a non-PK clustered Identity a good idea?) Pin
Eddy Vluggen25-Apr-18 5:33
professionalEddy Vluggen25-Apr-18 5:33 
GeneralRe: Naming my clustered index column which isn't the PK (and is a non-PK clustered Identity a good idea?) Pin
JChrisCompton30-Apr-18 5:30
JChrisCompton30-Apr-18 5:30 
GeneralRe: Naming my clustered index column which isn't the PK (and is a non-PK clustered Identity a good idea?) Pin
Eddy Vluggen30-Apr-18 5:58
professionalEddy Vluggen30-Apr-18 5:58 
GeneralRe: Naming my clustered index column which isn't the PK (and is a non-PK clustered Identity a good idea?) Pin
JChrisCompton30-Apr-18 7:35
JChrisCompton30-Apr-18 7:35 
GeneralRe: Naming my clustered index column which isn't the PK (and is a non-PK clustered Identity a good idea?) Pin
Eddy Vluggen30-Apr-18 8:13
professionalEddy Vluggen30-Apr-18 8:13 
GeneralRe: Naming my clustered index column which isn't the PK (and is a non-PK clustered Identity a good idea?) Pin
Jörgen Andersson25-Apr-18 2:15
professionalJörgen Andersson25-Apr-18 2:15 
GeneralRe: Naming my clustered index column which isn't the PK (and is a non-PK clustered Identity a good idea?) Pin
JChrisCompton25-Apr-18 5:47
JChrisCompton25-Apr-18 5:47 
GeneralRe: Naming my clustered index column which isn't the PK (and is a non-PK clustered Identity a good idea?) Pin
Jörgen Andersson25-Apr-18 10:49
professionalJörgen Andersson25-Apr-18 10:49 
PraiseRe: Naming my clustered index column which isn't the PK (and is a non-PK clustered Identity a good idea?) Pin
JChrisCompton26-Apr-18 4:17
JChrisCompton26-Apr-18 4:17 
QuestionEXCEPTIONS INTO Equivalent for SQL Server Pin
User 1205041720-Apr-18 4:59
User 1205041720-Apr-18 4:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.