Collection Schedule Query

Collection Schedule Queries.

There is no real readable output of the collection schedule for us to understand. What is produced  is 16 character string. If you want to really find out what this translated to then you have to look into the SDK for translation. Also, there really are not any good existing reports/queries out there to cover this information via SQL. This is the query I came up with for my customers environment when trying to evaluate their collection evaluation problems. Also I will do another blogpost with the sql queries to identify a number of other items to include orphaned collections, collection update types, etc... There is a screenshot in the bottom of this post to give a preview of the information.

Let's show an example.

There schedule produced "29B66B4000100200" is not readable. You have to look up this information in the SDK to start to get an understanding.

The First "7" digits translate to the effective schedule date for example: Effective 6/22/2015 1:10pm
The last "9" digits translate to the actual schedule that is performed for example: Every 2 hours






The code:

Select
CG.CollectionName,
CG.SITEID AS [Collection ID],
CASE VC.CollectionType
WHEN 0 THEN 'Other'
WHEN 1 THEN 'User'
WHEN 2 THEN 'Device'
ELSE 'Unknown' END AS CollectionType,
CG.schedule, case
WHEN CG.Schedule like '0102000' THEN 'Every 1 minute'
WHEN CG.Schedule like '010A000' THEN 'Every 5 mins'
WHEN CG.Schedule like '0114000' THEN 'Every 10 mins'
WHEN CG.Schedule like '011E000' THEN 'Every 15 mins'
WHEN CG.Schedule like '0128000' THEN 'Every 20 mins'
WHEN CG.Schedule like '0132000' THEN 'Every 25 mins'
WHEN CG.Schedule like '013C000' THEN 'Every 30 mins'
WHEN CG.Schedule like '0150000' THEN 'Every 40 mins'
WHEN CG.Schedule like '015A000' THEN 'Every 45 mins'
WHEN CG.Schedule like '0100100' THEN 'Every 1 hour'
WHEN CG.Schedule like '0100200' THEN 'Every 2 hours'
WHEN CG.Schedule like '0100300' THEN 'Every 3 hours'
WHEN CG.Schedule like '0100400' THEN 'Every 4 hours'
WHEN CG.Schedule like '0100500' THEN 'Every 5 hours'
WHEN CG.Schedule like '0100600' THEN 'Every 6 hours'
WHEN CG.Schedule like '0100700' THEN 'Every 7 hours'
WHEN CG.Schedule like '0100B00' THEN 'Every 11 Hours'
WHEN CG.Schedule like '0100C00' THEN 'Every 12 Hours'
WHEN CG.Schedule like '0101000' THEN 'Every 16 Hours'
WHEN CG.Schedule like '0100008' THEN 'Every 1 days'
WHEN CG.Schedule like '0100010' THEN 'Every 2 days'
WHEN CG.Schedule like '0100028' THEN 'Every 5 days'
WHEN CG.Schedule like '0100038' THEN 'Every 7 Days'
WHEN CG.Schedule like '0192000' THEN '1 week'
WHEN CG.Schedule like '0080000' THEN 'Update Once'
WHEN CG.SChedule = '' THEN 'Manual'
END AS [Update Schedule],
Case VC.RefreshType
when 1 then 'Manual'
when 2 then 'Scheduled'
when 4 then 'Incremental'
when 6 then 'Scheduled and Incremental'
else 'Unknown'
end as RefreshType,
VC.MemberCount,
(SELECT COUNT(CollectionID) FROM v_CollectionRuleQuery CRQ WHERE CRQ.CollectionID = VC.SiteID) AS 'RuleQueryCount',
(SELECT COUNT(CollectionID) FROM v_CollectionRuleDirect CRD WHERE CRD.CollectionID = VC.SiteID) AS 'RuleDirectCount'
from
dbo.collections_g CG
left join v_collections VC on VC.SiteID = CG.SiteID
Where
--cg.schedule like '0100200'
order by
CG.Schedule DESC

The results of the query:




NOTE: I did not put a case when statement for every possible outcome, only the ones that exist in my customers environment. If you want to look up what schedule is used for a specific collection then modify the where statement to site that specific collection name.

I will release a SSRS report for collection schedule information to the community later this week.

Also Preview Collection Evaluation Dashboard which will also include drilldowns possibly by the end of the month.




Labels: , , , , ,