-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Miovision Aggregation Improvements (ATR view, intersection_movements AFTER INSERT trigger, unacceptable_gaps) #1024
Open
gabrielwol
wants to merge
19
commits into
master
Choose a base branch
from
miovision_alt_aggregation
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+413
−578
Conversation
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
… unacceptable_gaps)
Testing the new ATR view for speed: --test: 0.2 s with primary key
SELECT *
FROM miovision_api.volumes_15min_atr_filtered
WHERE
intersection_uid = 6
AND classification_uid = 1
AND datetime_bin = '2024-06-25 12:00:00'
AND leg <> LEFT(dir, 1);
--DR i0627 test using new view
--41s for original, 1:06 for view (1.3M rows)
SELECT
volumes.intersection_uid,
date_trunc('hour', volumes.datetime_bin) AS datetime_bin,
volumes.leg,
volumes.dir,
classifications.classification,
SUM(volumes.volume) AS volume
FROM miovision_api.volumes_15min_atr_filtered AS volumes
INNER JOIN miovision_api.classifications USING (classification_uid)
WHERE
volumes.classification_uid NOT IN (2, 7)
AND volumes.datetime_bin >= '2024-01-01'
AND volumes.datetime_bin < '2024-05-22'
AND volumes.intersection_uid IN (76, 88, 81, 85, 84, 87, 75, 83, 86, 49, 80, 36)
GROUP BY
volumes.intersection_uid,
classifications.classification,
date_trunc('hour', volumes.datetime_bin),
volumes.leg,
volumes.dir; |
gabrielwol
changed the title
Miovision alt aggregation
Miovision Aggregation Improvements (ATR view, intersection_movements AFTER INSERT trigger, unacceptable_gaps)
Jul 29, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What this pull request accomplishes:
miovision_api.volumes_15min
(table) in place of view (volumes_15min_atr_filtered
). Reduces duplicate storage (~75GB) and complexity in aggregation.AFTER INSERT
trigger tointersection_movements
to help aggregate and pad new movements into volumes_15min_mvt.new_rows
(transition relation) instead ofintersection_movements
and without date limits.unacceptable_gap
removal from table inserts to filtered view: less complexity in adding and removing unacceptable_gaps.Summary of files changed:
Many files have minor changes including renamed references, removal of ATR aggregation, big fluff (intersection_movements, volumes_15min_tmc).
Files with major changes:
movement_map
with entry/exit leg columns and directions more clearly labelled. Helps with ATR view joins.Issue(s) this solves:
unacceptable_gaps
via viewintersection_movements
: Big list ofmiovision.intersection_movement
inconsistencies and bugs #406, Need to monitor intersection_movements for missing high volume movements #855What, in particular, needs to reviewed:
entry_dir, exit_leg, exit_dir
to TMC table so ATR view wouldn't need to join to movement_map. Downside: more confusing TMC table, does not match current TMC table.What needs to be done by a sysadmin after this PR is merged
E.g.: these tables need to be migrated/created in the production schema.