Improve the SQL server database size achievement

Table of Contents

IMPROVE THE SQL SERVER DATABASE SIZE ACHIEVEMENT

Size of the [TRANSACTION] database before deleting the records from the ETL.ETL_Job_Log table:

Database Name: [TRANSACTION]

Table Name: ETL.ETL_Job_Log

Daily SSIS (ETL) Package and task logs are stored in the ETL.ETL_Job_Log table.

BEFORE:

After deleting log records older than one year, the free space increased from 50 GB to 134 GB.

Finally, after clearing out the ETL Log tables:

AFTER:

A faster way to delete rows from the big table:

Create a view on the [ETL].[ETL_Job_Log] table.

CREATE VIEW [ETL].[ETL_job_log_id_ToBeDeleted]

AS

SELECT TOP 5000000 *

FROM [ETL].[ETL_job_log]

WHERE StartDT < DATEADD(year, -1, GETDATE())

ORDER BY StartDT;

Create an index on the StartDT table for better performance, as we are using this column for ordering.

CREATE NONCLUSTERED INDEX [IX_StartDT] ON [ETL].[ETL_job_log]

([StartDT] ASC

) WITH(PAD_INDEX = OFF,

STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, ONLINE = OFF,

ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY];

GO

Then Delete the records using the view like below.

Delete [ETL].[ETL_Job_log_id_ToBeDeleted]

case studies

See More Case Studies

Contact us

Partner with Us for Comprehensive IT

We’re happy to answer any questions you may have and help you determine which of our services best fit your needs.

Your benefits:
What happens next?
1

We Schedule a call at your convenience 

2

We do a discovery and consulting meting 

3

We prepare a proposal 

Schedule a Free Consultation