Solved

table with very high identity numbers, decreased performance?

Posted on 2011-09-22
7
344 Views
Last Modified: 2012-05-12
I have a table with current identity values of 4118223 and higher, its INT column with auto-increment. The table only has about 300,000 records in it, but performance on the table seems slow, even when just doing something such as deleting a single record. I'm wondering if the high INT values have something to do with it? I don't know if there is any way to reset the numbers or something. I believe SQL will never repeat an identity column value, is that correct?

Would appreciate any advice on this. Thank you!
0
Comment
Question by:bbdesign
7 Comments
 
LVL 92

Assisted Solution

by:Patrick Matthews
Patrick Matthews earned 300 total points
ID: 36583235
>>I'm wondering if the high INT values have something to do with it?

Not a blessed thing.
0
 
LVL 13

Expert Comment

by:Wizilling
ID: 36583247
yes it would never repeat an identity column.
You need to put clustered indexes on your identity column. If the identity column is already a primary key then you already have a index on it . So in this case - you need to rebuild your indexes.

alter index all on tablename rebuild
go


0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 36583269
It's going to be a 32-bit INT no matter what the actual number is, whether it is 1 or 2,000,000,001.  It is always fetching the same amount of data so like @matthewspatrick said, "Not a blessed thing."
0
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 

Author Comment

by:bbdesign
ID: 36583281
What does "you need to put clustered indexes on your identity column" mean, or how do I do that?

Excuse my lack of understanding of terminology, but I don't know that I have it set as a Primary Key. I put:

Is Identity: Yes
Identity Increment: 1
Identity Seed: 1

So that query you just gave me, that will reset the column back to 1 again? Thanks!
0
 
LVL 92

Assisted Solution

by:Patrick Matthews
Patrick Matthews earned 300 total points
ID: 36583316
bbdesign,

Don't confuse identity settings with index settings.

A clustered index means that the physical order of how the rows are stored matches the order of the index.  It speeds up the selects and deletes, but unless you are careful about how you pad the index it can start to slow down inserts once the padding starts to get consumed.

Patrick
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 200 total points
ID: 36583331
having identity is just a technique to get the value sequentially and automatically filled.
by this, the field is not indexed, nor actually guaranteed to be unique.

a index (aka a primary key) on the field will make sure that it is unique, and that delete by using that field in the where clause will be efficient.

btw, the index does not need to be clustered (though with the SQL management studio gui, it will be clustered by default if it's the first index),
but you should know that for "living tables" (tables where there is quite some delete / insert activity), a clustered index is a "must have" ... however, the primary key field is usually not the first choice for being the clustered index.
0
 

Author Comment

by:bbdesign
ID: 36583368
OK, thanks guys.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL STANDARD CORE 8 38
Download ms sql express. 2 28
sql, case when & top 1 14 29
SSRS Deployment problem 5 66
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question