1

Topic: Index and ORDER BY DESC

There is a table TableName with primary key TableNameID
There is a SQL query on decrease:

ORDER BY TableNameID DESC

Whether a question it is necessary to create primary key TableNameID on decrease?

CONSTRAINT [PK_TableName] PRIMARY KEY CLUSTERED
(
[TableNameID] DESC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

Or to create an additional index on decrease ?

2

Re: Index and ORDER BY DESC

And these you TableNameID as turn out?

3

Re: Index and ORDER BY DESC

potkin;
Look at the request execution plan
SELECT * FROM TableName ORDER BY TableNameID ASC / DESC
Also see that in both cases the same primary key, but in one case at it Scan Direction = FORWARD, and in other BACKWARD is used.
I.e. for such request the second index is not necessary, and create the PK you can with any option ASC / DESC.