Closed Bug 718224 Opened 14 years ago Closed 14 years ago

Very bad query in /reports/index

Categories

(Socorro :: Webapp, task)

x86
macOS
task
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: jberkus, Assigned: laura)

Details

the /reports/index page hits the database with at least one really poorly written query which is causing unneccessary database load: /* soc.web report.dateProcessed */ SELECT reports.email, reports.url, reports.addons_checked, ( SELECT reports_duplicates.duplicate_of FROM reports_duplicates WHERE reports_duplicates.uuid = reports.uuid) as duplicate_of FROM reports WHERE reports.uuid='eb792bab-6c3b-46a7-b339-e7d882120113' AND reports.success IS NOT NULL ",,,,,,,,,"" That's problematic because it doesn't contain any date range for date_processed, so it's going to hit all 60+ partitions for the 200GB reports table.
Target Milestone: --- → 2.4.2
Assignee: nobody → laura
Josh: This surprises me - it's only pulling a single report by uuid (WHERE reports.uuid=?) so I would have assumed it went from index to the correct partition. If that's not in fact the case I guess we can guess at the date range from the uuid and limit it that way. Does that work for you?
Our partitioning schedme doesn't include any filtering on the UUID per partition, so the database has no way of knowing that that UUID can be found in only one partition. We could add some, I suppose ... the last 6 digits of the UUID are the date, no?
That's what I was thinking too. Could add some app logic using the date from the UUID to put a date rnage in the SQL.
Target Milestone: 2.4.2 → 2.4.3
Commits pushed to master at https://github.com/mozilla/socorro https://github.com/mozilla/socorro/commit/41c719d6d811bba273283fbce05a52f7c0e9ca2e Fixes bug 718224, limit query by date to improve performance by only searching a single partition of the reports table https://github.com/mozilla/socorro/commit/383c651e26332c1befc6ab305e1449587ef18943 Merge pull request #342 from lauraxt/718224 Fixes bug 718224, limit query by date to improve performance by only searching a single partition of the reports table
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Which page(s)/URL(s) would this have affected?
What are the steps to verify?
This comes up on any individual crash report page. It should work the same as before, only faster. Picking one at random, e.g. https://crash-stats.allizom.org/report/index/497678d5-88e0-4b14-b681-575332120216
Bumping to QA verified on stage .. I'm not sure how to quantify that individual reports are loading faster however I can verify that individual reports continue to load expected (comment 8).
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.