Solved

Faster DB access

Posted on 2011-03-01
3
440 Views
Last Modified: 2012-05-11
Hello experts:

Have a table that has an identiy key starting at 1.
During processing we delete entries from this table and create
a file which is bulk inserted into this table at the end of processing.
This file contains the current posting date data.

Because records are added at the end of the table, the most current data
is posted at the end of the database. Clients use mostly the recent data
while rarely going back to search older records.  

The more records we add the slower the response time as far
as accesing the rows.

Question: As far as performance is concerned wouldn't it be better to delete
the identity key at the end of processing and sort the table by posting date desc
so that the current date is on top and then apply the identity key.
This way the records with the current posting date will have
an identity key starting at 1.

Also since records are deleted duiring procesing there will be gaps
in the identity key numbers. Does this cause perfomance issues?    

Thanks
0
Comment
Question by:lancerxe
3 Comments
 
LVL 25

Assisted Solution

by:reb73
reb73 earned 166 total points
ID: 35008371
Gaps in identity key does not necessarily cause a performance issue as such..

Just creating an index on the 'current posting date' should ensure that performance is acceptable.

If older data is not frequently used, it would make sense to move it to an archive table with the same structure + modified date to keep track of when records were moved to the archive table. You can always link both the tables using a view..
0
 
LVL 4

Accepted Solution

by:
MeLindaJohnson earned 167 total points
ID: 35009330
drop and create indexes
0
 
LVL 39

Assisted Solution

by:BrandonGalderisi
BrandonGalderisi earned 167 total points
ID: 35009768
You don't want to drop/create indexes.  But you may need to rebuild or update statistics.  It is best to look at the query plan and see why it is so slow.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
In SQL Server, when rows are selected from a table, does it retrieve data in the order in which it is inserted?  Many believe this is the case. Let us try to examine for ourselves with an example. To get started, use the following script, wh…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now