Site sponsored by: Idera Try Idera’s new SQL admin toolset
SQL Server Performance

  • Home
  • Articles
  • Forums
  • Tips
  • Quiz
  • FAQ's
  • Blogs
  • Software
  • Books
  • About Us
RSS Feeds
Sign in | Join


FAQ Topics

All FAQ's
General DBA
General Developer
DBA Performance Tuning
Developer Performance Tuning
Clustering
Error Messages

Write for Us

Share you SQL Server knowledge with others and raise your profile in the community More...
Latest Articles

Server and Database Auditing in SQL Server 2008
So, you find yourself On-Call
Administrator & Monitoring Change Data Capture in SQL Server 2008 ...
Importance of the Resource Database

More     
 
Latest FAQ's

SQL Server Reporting Server (SSRS) service is failing to start ...
Cannot Start SQL Server Service
Users are able to connect to report manager but not able ...
Errors when SQL Server Snapshot Replication is Running

More     
   
Latest Software Reviews

Spotlight on ApexSQL Doc 2008
ApexSQL Enforce
Embarcadero Change Manager
SQL Server DBA Dashboard

More     

I don't like to delete records in our production database, even though we will never need them again. Does this affect performance?



Question

I don't like to delete records in our production database, even though we will never need them again. Because of this, I have included an extra column in every table called the "ACTIVE_FLAG" that is set to one character in length that contains either an "a" for active records or a "d" for deleted records. How does this affect performance?

 

Answer

I have seen some database designs like yours, but generally speaking, it is because there is a fairly good chance that the records will be needed again, and flagging the record is an easy way to toggle access to them or not. But if you don't think the records will ever be needed again, I wouldn't recommend your method because it will negatively affect your server's performance.

Even though you may not need to access the inactive records and are marked accordingly, they still take up disk space. This is space for the record itself, along with any space taken by indexes you have on your tables. Unnecessary data in a table forces SQL Server to perform more I/O than necessary when reading data pages, which in turn slows down performance. Ideally, the only data you want in your database is data that someone needs. If nobody is using data in a database, it should be removed.

If you think there is a possibility that you might need the records again, another option is to archive the records in another database. For example, you could flag a record, like you do now, to render it inactive. Then periodically, such as one a month, or a quarter, or a year, move those records from the production database to another database on the same or different server. This way, the records are still available, but they don't take up unnecessary space in the production database, hindering performance.

Depending on the proportion of inactive records to active records, you may find that after archiving inactive records, that your database's performance increases significantly.

 

Reader's Feedback

We currently utilize triggers to archive deleted (and updated) records to a separate database in order to track all changes for important tables.  Seems to work well since we don't have too many users with access greater than read.  Also, users who do have access levels that allow updates and deletes are limited in the number of records they can access at one time.  Those users are also limited to certain tables based on access levels.  If a business user decides they want to do more than normally allowed they make a request to the administrator, which further serves the tracking process. --CH








Home | Peformance Articles | Audit Articles | Business Intelligence Articles | Clustering Articles | Developer Articles | Reporting Services Articles | DBA Articles | ASP.NET / ADO.NET Articles | DBA FAQ's | Developer Peformance FAQ's | DBA Peformance FAQ's | Developer FAQ's | Clustering FAQ's | Error Messages | Audit Tool Reviews | Backup Tool Reviews | Coding Tool Reviews | Compare Tool Reviews | Documentation Tool Reviews | Design Tool Reviews | Monitoring Tool Reviews | Log Tool Reviews | Reporting Tool Reviews | Clustering Tool Reviews | Security Tool Reviews | Change Management Tool Reviews | Remote Access Tool Reviews | Book Reviews | Security Tool Reviews | QDPMA Performance Tuning | ADO.NET / ASP.NET | Administration | Analysis/OLAP Services | Application Development | Configuration | Components | ETL | Hardware | High Availability | Hints | Index | Misc | Operating Systems | Performance Tuning | Replication | T-SQL | Views


              © 1999-2008 by T10 Media. All rights reserved