-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an updated field to logs, which is updated when the log is modified. This generally occurs when we link a demo or match to the log. Support using this field whenever we call last_modified. There are a few places (players, teams) where we show log data on the page but this doesn't factor into the last_modified field. This is because we would need to join on the logs to determine this, which is expensive. I am deferring this until I determine how to implement this efficiently. Now that we have it, add the updated field to the logs API, and add an updated_since filter as well. This should help clients query us efficiently. Signed-off-by: Sean Anderson <[email protected]>
- Loading branch information
Showing
12 changed files
with
92 additions
and
11 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
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
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,17 @@ | ||
BEGIN; | ||
ALTER TABLE log ADD updated BIGINT; | ||
CREATE TABLE new AS SELECT | ||
logid, | ||
greatest(log.time, demo.time, match.fetched) AS updated | ||
FROM log | ||
LEFT JOIN demo USING (demoid) | ||
LEFT JOIN match USING (league, matchid); | ||
UPDATE log SET | ||
updated = new.updated | ||
FROM new | ||
WHERE log.logid = new.logid; | ||
ALTER TABLE log ALTER updated SET NOT NULL; | ||
ALTER TABLE log ADD CHECK (updated >= time); | ||
CREATE INDEX log_updated ON log (updated); | ||
COMMIT; | ||
VACUUM VERBOSE ANALYZE log; |
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
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
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
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