Tagged Questions
1
vote
1answer
64 views
SQL Server clustered index high fragmentation
I've got a Table with an Integer (4bytes) as primary key. it's defined as an identity. it is also the clustered index.
Inserts are working perfectly fine. After inserting 2000 rows the fragmentation ...
5
votes
2answers
141 views
Why disabling a clustered index makes the table inaccessible?
When an index is disabled, the definition remains in the system catalog but is no longer
used.
SQL Server does not maintain the index (as data in the table changes), and the index
cannot be used to ...
1
vote
4answers
124 views
How to speed up creating clustered index on large table on SQL Server 2008 R2?
I have a large SQL Server table, the row count of the table is more than 3 billion, the data space for this table is about 120G.
And Intel Xeon CPU E5645 @2.4GHz(2 processors), 24 CPUs, 64G memory, ...
1
vote
2answers
116 views
Clustered vs Nonclustered Index
My database currently has a primary Key/Clustered index on the ID column for each table. However, the application that connects to the database is always looking at views defined as:
SELECT * FROM ...
2
votes
1answer
62 views
Locating row in index page
In clustered index, we have root, intermediate and leaf level pages. Every page has few records where indicating range of pages from level below.
How SQL check whether some index key belong to ...
11
votes
1answer
173 views
What are valid usage scenarios for HEAP tables?
I am currently doing some data imports into a legacy system and discovered that this system does not use a single clustered index. A quick Google search introduced me to the concept of HEAP tables and ...
6
votes
2answers
260 views
Adding a Clustered index to a HEAP table on someone else's app
We're using a proprietary application based on SQL Server 2005, which has many HEAP based tables (that is, no Clustered index). Over the years, these tables have grown badly fragmented (e.g. 99% ...
2
votes
1answer
207 views
Index with multiple leaf levels
I have a three-column (int, smallint, smallint) composite clustered index with three leaf levels. My question is how and when does SQL Server create multiple leaf levels (index_level 0) for the same ...
7
votes
1answer
371 views
What factors go into an Indexed View's Clustered Index being selected?
Breifly
What factors go into they query optimizer's selection of an indexed view's index?
For me, indexed views seem to defy what I understand about how the Optimizer picks indexes. I've seen this ...
3
votes
1answer
159 views
How do I automate converting heaps into clustered indexes?
I have around 40 tables in one of our production databases that, for varying reasons, where not created with a clustered index.
What is the best automated method for converting these heaps?
Since ...
1
vote
1answer
78 views
Finding exact row in Clustered index leaf page
When traversing through Clustered index in Sql Server, the engine will start from Root page and traverse over non leaf nodes until it reaches leaf level page (data page).
Every data page has row ...
2
votes
1answer
139 views
Aren't two writes required to update a clustered index record
I was reading the article on indexes at simple-talk, where it is written that
If a heap has a non-clustered index on it (as the primary key), and data is inserted into the table, two writes have ...
4
votes
2answers
130 views
Need for reaching data through clustered index with a non-clustered index
I have found that when a table has both clustered and non-clustered indexes (on different columns), the leaf level non-clustered pages, instead of pointing to the data row, point to the node of the ...
3
votes
0answers
205 views
Why are runtimes different for a table including a primary key versus a table with a clustered unique index added after population
When I create a temporary table with a PK defined from the outset like this I get great performance in subsequent joins on that key:
create table #temp (
field1 int not null
field2 int ...
4
votes
2answers
586 views
Should a table have a clustered index even if it doesn't have appropriate fields for it?
If you have a table without a good candidate field or fields for a clustered index (stable, sequential), is it better to have a clustered index on a bad field or is it better to make all table indices ...
4
votes
1answer
268 views
Storage order vs Result order
This is a spin-off question from Sort order specified in primary key, yet sorting is executed on SELECT.
@Catcall says this on the subject of storage order (clustered index) and the output order
...
5
votes
2answers
752 views
Why index REBUILD does not reduce index fragmentatation?
I have used ALTER INDEX REBUILD to remove index fragmentation. In some cases REBUILD does not seem to remove this fragmentation. What are the reasons why REBUILD does not remove fragmentation? It ...
2
votes
1answer
100 views
After dropping the clustered index, it is still attempting to do a clustered insert
I am trying to convert data from one database system to another. One of the tables I need to transfer and format contains over 10 million rows.
I am running the following script to do it:
USE ...
3
votes
1answer
489 views
Clustered Index Update on Nonclustered Columns
Using: SQL Server 2008 R2
I am currently stepping through a query execution plan, and have come across an instance of a clustered index update on a table. The issue here is that the columns that are ...
0
votes
2answers
880 views
Clustered index always better than Non-Clustered index?
When I have a clustered index on 'A', is it better to use this clustered index even if I have
selection of 'A=constant'? If not, why?
Thank you!
3
votes
1answer
98 views
should we replace some non-clustered indexes with clustered indexes
We have some data saved for reporting each of our tables currently has a unique id column that has an auto generated clustered index on the pk and a non-clustered index for the fk.
I am thinking that ...
3
votes
3answers
602 views
Does ORDER BY on a clustered key effect performance?
Say I have a table clustered on PrimaryKey, and in all cases I want my results to be ordered by PrimaryKey so I additionally always ORDER BY PrimaryKey in all queries.
Does this ORDER BY affect ...
5
votes
1answer
160 views
Composite or Single-Field Clustering Key
My DBA and I are having a disagreement on index structure.
Consider data for a medical claim...
We have the Header table with fields like:
ClaimId (varchar(50)), PaidAmount, MemberID...
and for ...
26
votes
3answers
1k views
Is the concept of a clustered index in a DB design sensical when using SSDs?
When designing a SQL server data schema and the subsequent queries, sprocs, views, etc. does the notion of a clustered index and order of data on disk make any sense to consider for DB designs made ...
13
votes
3answers
4k views
Efficient INSERT INTO a Table With Clustered Index
I have a SQL statement that inserts rows into a table with a clustered index on the column TRACKING_NUMBER.
E.G.:
INSERT INTO TABL_NAME (TRACKING_NUMBER, COLB, COLC)
SELECT TRACKING_NUMBER, COL_B, ...
23
votes
5answers
2k views
Why do sequential GUID keys perform faster than sequential INT keys in my test case?
After asking this question comparing sequential and non-sequential GUIDs, I tried to compare the INSERT performance on 1) a table with a GUID primary key initialized sequentially with ...
15
votes
4answers
993 views
Is 'Avoid creating a clustered index based on an incrementing key' a myth from SQL Server 2000 days?
Our databases consist of lots of tables, most of them using an integer surrogate key as a primary key. About half of these primary keys are on identity columns.
The database development started in ...
22
votes
3answers
1k views
Performance of Non Clustered Indexes on Heaps vs Clustered Indexes
This 2007 White Paper compares the performance for individual select/insert/delete/update and range select statements on a table organized as a clustered index vs that on a table organized as a heap ...
9
votes
2answers
5k views
What is a Clustered Index?
I need a short explaining of clustered index.
What is a clustered index?
What are best practices for using the clustered index?
11
votes
1answer
563 views
SQL Server - How are data pages stored when using a clustered index
I recently heard that the data pages in a clustered index aren't stored contiguously. Is this true?
Perhaps data pages are normally stored contiguously with some exceptions to the rule? Or perhaps I ...