-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
78 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- issue_details indices | ||
CREATE INDEX "errorId" ON "issue_details" ("errorId"); | ||
CREATE INDEX "recordId" ON "issue_details" ("recordId"); | ||
|
||
--- issue_summary indices | ||
CREATE INDEX "groupId" ON "issue_summary" ("groupId"); | ||
CREATE INDEX "id" ON "issue_summary" ("id"); | ||
CREATE INDEX "categoryId" ON "issue_summary" ("categoryId"); | ||
CREATE INDEX "typeId" ON "issue_summary" ("typeId"); | ||
|
||
--- create issue_groups to speed up queries | ||
CREATE TABLE issue_groups AS | ||
SELECT groupId, | ||
categoryId, | ||
typeId, | ||
s.MarcPath AS path, | ||
COUNT(DISTINCT(s.id)) AS variants, | ||
COUNT(DISTINCT(d.id)) AS records, | ||
SUM(d.instances) AS instances | ||
FROM issue_summary AS s | ||
LEFT JOIN issue_details AS d ON (s.id = d.errorId) | ||
GROUP BY groupId, categoryId, typeId, s.MarcPath; | ||
|
||
--- issue_groups indices | ||
CREATE INDEX "groupId" ON "issue_groups" ("groupId"); | ||
CREATE INDEX "categoryId" ON "issue_groups" ("categoryId"); | ||
CREATE INDEX "typeId" ON "issue_groups" ("typeId"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,24 @@ | ||
--- issue_details indices | ||
--- issue_details indices | ||
CREATE INDEX "errorId" ON "issue_details" ("errorId"); | ||
CREATE INDEX "recordId" ON "issue_details" ("recordId"); | ||
|
||
--- issue_summary indices | ||
--- issue_summary indices | ||
CREATE INDEX "id" ON "issue_summary" ("id"); | ||
CREATE INDEX "categoryId" ON "issue_summary" ("categoryId"); | ||
CREATE INDEX "typeId" ON "issue_summary" ("typeId"); | ||
|
||
--- create issue_groups to speed up queries | ||
CREATE TABLE issue_groups AS | ||
SELECT categoryId, typeId, s.MarcPath AS path, COUNT(DISTINCT(s.id)) AS variants, COUNT(DISTINCT(d.id)) AS records, SUM(d.instances) AS instances | ||
SELECT categoryId, | ||
typeId, | ||
s.MarcPath AS path, | ||
COUNT(DISTINCT(s.id)) AS variants, | ||
COUNT(DISTINCT(d.id)) AS records, | ||
SUM(d.instances) AS instances | ||
FROM issue_summary AS s | ||
LEFT JOIN issue_details AS d ON (s.id = d.errorId) | ||
GROUP BY categoryId, typeId, s.MarcPath; | ||
|
||
--- issue_groups indices | ||
CREATE INDEX "categoryId" ON "issue_groups" ("categoryId"); | ||
CREATE INDEX "typeId" ON "issue_groups" ("typeId"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
BEGIN TRANSACTION; | ||
CREATE TABLE IF NOT EXISTS "issue_summary" ( | ||
"groupId" TEXT, | ||
"id" INTEGER, | ||
"MarcPath" TEXT, | ||
"categoryId" INTEGER, | ||
"typeId" INTEGER, | ||
"type" TEXT, | ||
"message" TEXT, | ||
"url" TEXT, | ||
"instances" INTEGER, | ||
"records" INTEGER | ||
); | ||
CREATE TABLE IF NOT EXISTS "issue_details" ( | ||
"id" TEXT, | ||
"errorId" INTEGER, | ||
"instances" INTEGER | ||
); | ||
COMMIT; |