add snapshotMetrics script, tidy other scripts

This commit is contained in:
Collin M. Barrett 2018-08-25 08:51:47 -05:00
parent 08a99f94a2
commit 1e57028415
7 changed files with 21 additions and 14 deletions

View file

@ -41,9 +41,10 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sql", "sql", "{A4BB2C81-5232-4162-B410-704D123D2C01}"
ProjectSection(SolutionItems) = preProject
scripts\sql\createDb.sql = scripts\sql\createDb.sql
scripts\sql\failedSnapshotsRules.sql = scripts\sql\failedSnapshotsRules.sql
scripts\sql\getDuplicateRules.sql = scripts\sql\getDuplicateRules.sql
scripts\sql\duplicateRules.sql = scripts\sql\duplicateRules.sql
scripts\sql\orphanedSnapshotsRules.sql = scripts\sql\orphanedSnapshotsRules.sql
scripts\sql\resetSnapshotsRules.sql = scripts\sql\resetSnapshotsRules.sql
scripts\sql\snapshotMetrics.sql = scripts\sql\snapshotMetrics.sql
scripts\sql\snapshotTimeAnalysis.sql = scripts\sql\snapshotTimeAnalysis.sql
EndProjectSection
EndProject

View file

@ -0,0 +1,4 @@
SELECT Raw, COUNT(*) 'Count'
FROM rules
GROUP BY Raw
HAVING COUNT > 1;

View file

@ -1,5 +0,0 @@
SELECT snapshotid, COUNT(*)
FROM snapshots_rules
JOIN snapshots ON snapshots_rules.snapshotid = snapshots.id
WHERE snapshots.wassuccessful = FALSE
GROUP BY snapshots.id

View file

@ -1,4 +0,0 @@
SELECT raw, COUNT(*) ct
FROM rules
GROUP BY raw
HAVING ct > 1;

View file

@ -0,0 +1,5 @@
SELECT SnapshotId, COUNT(*)
FROM snapshots_rules
JOIN snapshots ON snapshots_rules.SnapshotId = snapshots.Id
WHERE snapshots.WasSuccessful = FALSE
GROUP BY snapshots.Id;

View file

@ -0,0 +1,6 @@
SELECT snapshots.CreatedDateUtc, FilterlistId, HttpStatusCode, WasSuccessful, WaybackTimestamp, BatchSize, COUNT(snapshots_rules.RuleId) AS 'Count'
FROM snapshots
JOIN snapshots_rules ON snapshots.Id = snapshots_rules.SnapshotId
GROUP BY snapshots.Id
ORDER BY snapshots.CreatedDateUtc DESC
LIMIT 50;

View file

@ -1,9 +1,9 @@
SELECT
FilterListId,
ModifiedDateUtc - CreatedDateUtc As ProcessingTimeSecs,
ModifiedDateUtc - CreatedDateUtc AS ProcessingTimeSecs,
CreatedDateUtc,
ModifiedDateUtc,
WasSuccessful
FROM snapshots
WHERE ModifiedDateUtc - CreatedDateUtc > 30 OR IsCompleted = 0
ORDER BY ProcessingTimeSecs DESC
WHERE ModifiedDateUtc - CreatedDateUtc > 30 OR WasSuccessful = 0
ORDER BY ProcessingTimeSecs DESC;