-
-
Notifications
You must be signed in to change notification settings - Fork 238
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
[Surrey] Exclude Open311-fetched reports from cut_off_date #5182
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5182 +/- ##
==========================================
- Coverage 82.35% 82.32% -0.03%
==========================================
Files 409 409
Lines 31861 31878 +17
Branches 5067 5070 +3
==========================================
+ Hits 26238 26244 +6
- Misses 4127 4136 +9
- Partials 1496 1498 +2 ☔ View full report in Codecov by Sentry. |
d69018d
to
0d3899b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think query code can be simplified, same outcome, is all :)
0d3899b
to
3fcb82d
Compare
Based on my understanding of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you look at the analyze when it's only created
, you can see a 'nearby' query boils down to:
- Get the nearby problems using bitmap heap/index scan on problem_radians_latitude_longitude_idx
- Do a bitmap heap scan using bitmap index scans on both problem_bodies_str_array_idx and problem_created_idx, filtering out state/timestamp based (179 rows)
- hash together steps 1 and 2, filtering out shown reports
- sort/limit
With it also checking service
, this becomes:
- Same - nearby problems using bitmap heap/index scan
- Can only use problem_bodies_str_array_idx now, so bitmap heap scan with that, filter out ones that don't match created/service/state/timestamp (46,317 rows)
- Same
- Same
Which is equivalent to what it does when there isn't a cut off date at all; still using a bitmap heap scan, so much better than when it was going wrong. Its runtime is comparable, but it is having to do quite a bit more 'work' (looking at the calculated cost, not the actual time). So yes, think it's fine, we might want to have a think of is there's something we can do to improve the general 'no cut off date' (or here) query, could another index on state, or perhaps a combined (state,created) or (created,state) index, or some other index for this common query help, for example?
96122e7
to
46fe8fc
Compare
For https://github.com/mysociety/societyworks/issues/4512
[skip changelog]