Skip to content
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

[#148491] Improve performance of FacilitiesController#show (Part 2) #1949

Merged
merged 3 commits into from
May 10, 2019

Conversation

vandrijevik
Copy link
Contributor

@vandrijevik vandrijevik commented May 9, 2019

Release Notes

Improve performance of FacilitiesController#show (Part 2)

Additional Context

Rendering all non-instruments before

   (0.4ms)  SELECT COUNT(*) FROM `products` WHERE `products`.`type` IN ('Service') AND `products`.`facility_id` = 1 AND `products`.`is_archived` = 0 AND `products`.`is_hidden` = 0
  Service Load (0.3ms)  SELECT  `products`.* FROM `products` WHERE `products`.`type` IN ('Service') AND `products`.`facility_id` = 1 AND `products`.`is_archived` = 0 AND `products`.`is_hidden` = 0 ORDER BY lower(products.name) LIMIT 1
  Service Load (0.3ms)  SELECT `products`.* FROM `products` WHERE `products`.`type` IN ('Service') AND `products`.`facility_id` = 1 AND `products`.`is_archived` = 0 AND `products`.`is_hidden` = 0 ORDER BY lower(products.name)
  Rendered collection of facilities/_product.html.haml [2 times] (2.3ms)
  Rendered facilities/_product_list.html.haml (11.0ms)
   (0.4ms)  SELECT COUNT(*) FROM `products` WHERE `products`.`type` IN ('TimedService') AND `products`.`facility_id` = 1 AND `products`.`is_archived` = 0 AND `products`.`is_hidden` = 0
  Rendered facilities/_product_list.html.haml (1.0ms)
   (0.3ms)  SELECT COUNT(*) FROM `products` WHERE `products`.`type` IN ('Item') AND `products`.`facility_id` = 1 AND `products`.`is_archived` = 0 AND `products`.`is_hidden` = 0
  Item Load (0.3ms)  SELECT  `products`.* FROM `products` WHERE `products`.`type` IN ('Item') AND `products`.`facility_id` = 1 AND `products`.`is_archived` = 0 AND `products`.`is_hidden` = 0 ORDER BY lower(products.name) LIMIT 1
  Item Load (0.3ms)  SELECT `products`.* FROM `products` WHERE `products`.`type` IN ('Item') AND `products`.`facility_id` = 1 AND `products`.`is_archived` = 0 AND `products`.`is_hidden` = 0 ORDER BY lower(products.name)
  Rendered collection of facilities/_product.html.haml [1 times] (1.1ms)
  Rendered facilities/_product_list.html.haml (6.2ms)
  Rendered collection of facilities/_product.html.haml [1 times] (1.1ms)
  Rendered facilities/_product_list.html.haml (4.1ms)

Rendering all non-instruments after

  Rendered collection of facilities/_product.html.haml [2 times] (1.9ms)
  Rendered facilities/_product_list.html.haml (6.9ms)
  Rendered facilities/_product_list.html.haml (0.0ms)
  Rendered collection of facilities/_product.html.haml [1 times] (1.2ms)
  Rendered facilities/_product_list.html.haml (4.2ms)
  Rendered collection of facilities/_product.html.haml [1 times] (1.2ms)
  Rendered facilities/_product_list.html.haml (4.3ms)

Skylight reports the SQL queries to load from products to be a large part of the response time, so this should help improve performance by executing fewer queries against that table.

@vandrijevik vandrijevik requested a review from rolfrussell as a code owner May 9, 2019 14:51
@rolfrussell
Copy link
Contributor

👍 once build issues addressed

@vandrijevik vandrijevik force-pushed the va-improve-performance-of-facilities-show-part-2 branch from 426c793 to d97b7f6 Compare May 9, 2019 15:31
@vandrijevik vandrijevik merged commit 3212929 into master May 10, 2019
@vandrijevik vandrijevik deleted the va-improve-performance-of-facilities-show-part-2 branch May 10, 2019 10:37
joshea0 pushed a commit to SquaredLabs/nucore-uconn that referenced this pull request Mar 18, 2020
…yeworks#1949)

* Avoid always-executing COUNT(*) query when we don’t need it

* Load all non-instruments in a single query for the facility home page

* Gracefully handle facilities without bundles on FacilitiesController#show
chrixp pushed a commit to SquaredLabs/nucore-uconn that referenced this pull request Oct 21, 2020
…yeworks#1949)

* Avoid always-executing COUNT(*) query when we don’t need it

* Load all non-instruments in a single query for the facility home page

* Gracefully handle facilities without bundles on FacilitiesController#show
joshea0 pushed a commit to SquaredLabs/nucore-uconn that referenced this pull request Oct 23, 2020
…yeworks#1949)

* Avoid always-executing COUNT(*) query when we don’t need it

* Load all non-instruments in a single query for the facility home page

* Gracefully handle facilities without bundles on FacilitiesController#show
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants