Forum

HomeHomeCoreCoreGeneralGeneralCleaning up growing repositoryCleaning up growing repository
Previous
 
Next
New Post
3/20/2016 6:47 AM
 

On some of the websites I work on the table OpenWebStudio_Repository has a tendency to grow out of proportion.
I have been testing a clean up function, and it works for me 

Wanted to share it. 

First  I create a view "a_OWS_Repository_configurations_in_use" that displays configurations that are actually in use at the moment

=====

SELECT t1.*
FROM OpenWebStudio_Repository AS t1 LEFT JOIN OpenWebStudio_Repository AS t2
ON (t1.ConfigurationID = t2.ConfigurationID AND t1.Date < t2.Date)
WHERE t2.Date IS NULL
Order by ConfigurationID

======


then I just run 

======

delete FROM [dbo].[OpenWebStudio_Repository]
  where RepositoryID not in (
  SELECT  [RepositoryID]   
  FROM [dbo].[a_OWS_Repository_configurations_in_use])

======

Hope this helps anyone needing it

Previous
 
Next
HomeHomeCoreCoreGeneralGeneralCleaning up growing repositoryCleaning up growing repository


 

New York, NY • Baltimore, MD • Vienna, VA • St. Louis, MO • Seattle, WA • 410.327.0007 • info@R2Integrated.com

Bookmark & Share Bookmark and Share