Linked Questions

3 votes
1 answer
229 views

I was applying indexing to a fresh database(no records on most of the tables) What approach should I use apart from considering filter criteria. Should I index records in descending order since any ...
Shantanu Gupta's user avatar
279 votes
6 answers
172k views

I've heard that you should put columns that will be the most selective at the beginning of the index declaration. Example: CREATE NONCLUSTERED INDEX MyINDX on Table1 ( MostSelective, ...
Abe Miessler's user avatar
  • 85.7k
16 votes
10 answers
15k views

Is there some way to make SQL Server Management Studio return rows descending by default ? Every time i open a table via the menu (for instance by selecting return all rows), i get the oldest rows at ...
Martin de Wildt's user avatar
38 votes
2 answers
31k views

In Sql Server, I have a table with an Identity primary key. Often I want the latest few new records, so I grab the Top n sorted by descending the primary key. Should I define the Primary Key index as ...
peterorum's user avatar
  • 1,441
6 votes
1 answer
8k views

We've got a wide table that we're currently trying to optimize. The table has 50 columns (stats) that we eventually want to rank in descending order. Currently there's well over 5 million rows. We're ...
iLoch's user avatar
  • 767
7 votes
5 answers
4k views

The Database Engine Tuning Advisor has finally given up the ghost and can't help me any more, so I'm having to learn a little bit more about indexes (shouldn't it be indices?). I think I'm more or ...
spender's user avatar
  • 121k
4 votes
4 answers
6k views

Some said for compound indexes then ordering matter. Some says ordering doesn't matter. Which one is right? And why? I mean if I look up phone, I don't see how whether the phone is sorted a to z or ...
user4951's user avatar
  • 33.3k
5 votes
4 answers
2k views

I’m creating a table with a primary key clustered index. When I’m creating without asc/desc, what is the default sorting order? Which sorting order (ASC or DESC) is more efficient? Here is the sample ...
Madhukar's user avatar
  • 1,242
2 votes
5 answers
2k views

This question relates to a table in Microsoft SQL Server which is usually queried with ORDER BY Id DESC. Would there be a performance benefit from setting the primary key to PRIMARY KEY CLUSTERED (Id ...
Seb Nilsson's user avatar
  • 26.5k
1 vote
3 answers
2k views

Let's suppose I have the following table with a clustered index on a column (say, a) CREATE TABLE Tmp ( a int, constraint pk_a primary key clustered (a) ) Then, let's assume that I have two ...
soleiljy's user avatar
  • 1,125
4 votes
0 answers
3k views

This Q is about MySql - to read about ascending or descending indexes in MS SQL you can look here: SQL Server indexes - ascending or descending, what difference does it make? It refers to a different ...
epeleg's user avatar
  • 11.1k
5 votes
2 answers
565 views

If a PK of a table is a standard auto-increment int (Id) and the retrieved and updated records are almost always the ones closer to the max Id will it make any difference performance-wise whether the ...
Dean's user avatar
  • 12.2k
1 vote
1 answer
1k views

I have a screen where i show all the latest posts and when the user click the read more link, i bring the next set based on Post Id(where id < latest one already shown). I have a clustered index ...
user636525's user avatar
  • 3,200
3 votes
2 answers
706 views

The following T-SQL query is taking 54 seconds to execute: SELECT top (3) a.c1, b.c2, c.c3, d.c4 FROM table1 as a WITH (NOLOCK) JOIN table2 as b WITH (NOLOCK) ON a.c1 = b.c4 LEFT JOIN ...
Leejoy's user avatar
  • 1,456
0 votes
3 answers
508 views

I am using .OrderByDescending(x => x.Id) to return the most recent data in paged sets of 20 from a large dataset to a web application. I have been attempting to optimize the speed of my query and ...
rlwheeler's user avatar
  • 546

15 30 50 per page