Skip to content

Instantly share code, notes, and snippets.

@klippx
Created June 1, 2015 09:53
Show Gist options
  • Save klippx/56e70dc4ac55724a9f5b to your computer and use it in GitHub Desktop.
Save klippx/56e70dc4ac55724a9f5b to your computer and use it in GitHub Desktop.
Sample output of Api::PouchOrdersController#index
=> Booting Thin
=> Rails 4.2.1 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
Thin web server (v1.6.3 codename Protein Powder)
Maximum connections set to 1024
Listening on localhost:3000, CTRL+C to stop
Started GET "/" for 127.0.0.1 at 2015-06-01 11:49:34 +0200
ActiveRecord::SchemaMigration Load (0.2ms) SELECT `schema_migrations`.* FROM `schema_migrations`
Processing by ApplicationController#index as HTML
User Load (0.2ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 3 ORDER BY `users`.`id` ASC LIMIT 1
Rendered application/index.html.haml within layouts/application (2.4ms)
Rendered layouts/_head.html.haml (897.0ms)
Completed 200 OK in 1195ms (Views: 1162.1ms | ActiveRecord: 2.8ms)
Started GET "/api/session/user" for 127.0.0.1 at 2015-06-01 11:49:36 +0200
Processing by Api::SessionController#user as JSON
User Load (0.3ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 3 ORDER BY `users`.`id` ASC LIMIT 1
Completed 200 OK in 7ms (Views: 1.7ms | ActiveRecord: 0.3ms)
Started GET "/api/pouch_orders?status%5B%5D=interaction_control&status%5B%5D=half_tablet_substitution_control&status%5B%5D=dosage_control" for 127.0.0.1 at 2015-06-01 11:49:36 +0200
Processing by Api::PouchOrdersController#index as JSON
Parameters: {"status"=>["interaction_control", "half_tablet_substitution_control", "dosage_control"]}
User Load (0.3ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 3 ORDER BY `users`.`id` ASC LIMIT 1
(0.3ms) SELECT COUNT(*) FROM `pouch_orders` WHERE `pouch_orders`.`status` IN ('interaction_control', 'half_tablet_substitution_control', 'dosage_control')
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`status` IN ('interaction_control', 'half_tablet_substitution_control', 'dosage_control')
Ward Load (0.2ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 3 LIMIT 1
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 3 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 3
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 6 LIMIT 1
Item Load (0.3ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 7 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.2ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 3
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.3ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 3 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.3ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 3 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.3ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 5
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 6
Ward Load (0.2ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 4 LIMIT 1
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 4 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 4
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 8 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 9 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.1ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 4
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 4 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 4 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 7
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 8
Ward Load (0.2ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 14 LIMIT 1
Patient Load (0.1ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 14 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 14
Item Load (0.1ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 28 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 29 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.3ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 14
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 14 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 14 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 27
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 28
Ward Load (0.1ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 15 LIMIT 1
Patient Load (0.1ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 15 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 15
Item Load (0.1ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 30 LIMIT 1
Item Load (0.1ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 31 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.1ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 15
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.1ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 15 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 15 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 29
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 30
Ward Load (0.2ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 25 LIMIT 1
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 25 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 25
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 50 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 51 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.2ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 25
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 25 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.1ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 25 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 49
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 50
Ward Load (0.2ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 26 LIMIT 1
Patient Load (0.1ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 26 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 26
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 52 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 53 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.2ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 26
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 26 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.1ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 26 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 51
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 52
Ward Load (0.1ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 36 LIMIT 1
Patient Load (0.1ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 36 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 36
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 72 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 73 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.2ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 36
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.3ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 36 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 36 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 71
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 72
Ward Load (0.1ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 37 LIMIT 1
Patient Load (0.1ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 37 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 37
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 74 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 75 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.1ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 37
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.1ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 37 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.1ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 37 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 73
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 74
Completed 200 OK in 250ms (Views: 204.2ms | ActiveRecord: 25.2ms)
Started GET "/api/pouch_orders?status%5B%5D=awaiting_approval" for 127.0.0.1 at 2015-06-01 11:49:37 +0200
Processing by Api::PouchOrdersController#index as JSON
Parameters: {"status"=>["awaiting_approval"]}
User Load (0.2ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 3 ORDER BY `users`.`id` ASC LIMIT 1
(0.2ms) SELECT COUNT(*) FROM `pouch_orders` WHERE `pouch_orders`.`status` = 'awaiting_approval'
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`status` = 'awaiting_approval'
Ward Load (0.2ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 5 LIMIT 1
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 5 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.3ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 5
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 10 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 11 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.2ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 5
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 5 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.1ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 5 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 9
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 10
Ward Load (0.2ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 16 LIMIT 1
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 16 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 16
Item Load (0.1ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 32 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 33 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.2ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 16
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 16 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 16 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 31
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 32
Ward Load (0.2ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 27 LIMIT 1
Patient Load (0.1ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 27 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 27
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 54 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 55 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.2ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 27
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 27 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 27 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 53
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 54
Ward Load (0.1ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 38 LIMIT 1
Patient Load (0.1ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 38 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 38
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 76 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 77 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.1ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 38
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 38 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 38 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 75
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 76
Completed 200 OK in 90ms (Views: 77.7ms | ActiveRecord: 7.9ms)
Started GET "/api/pouch_orders?status%5B%5D=interaction_control" for 127.0.0.1 at 2015-06-01 11:49:37 +0200
Processing by Api::PouchOrdersController#index as JSON
Parameters: {"status"=>["interaction_control"]}
User Load (0.3ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 3 ORDER BY `users`.`id` ASC LIMIT 1
(0.2ms) SELECT COUNT(*) FROM `pouch_orders` WHERE `pouch_orders`.`status` = 'interaction_control'
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`status` = 'interaction_control'
Ward Load (0.2ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 3 LIMIT 1
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 3 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 3
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 6 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 7 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.2ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 3
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 3 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 3 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 5
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 6
Ward Load (0.2ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 14 LIMIT 1
Patient Load (0.1ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 14 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 14
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 28 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 29 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.1ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 14
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.1ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 14 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.1ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 14 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 27
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 28
Ward Load (0.2ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 25 LIMIT 1
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 25 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 25
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 50 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 51 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.2ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 25
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 25 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.1ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 25 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 49
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 50
Ward Load (0.1ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 36 LIMIT 1
Patient Load (0.1ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 36 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 36
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 72 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 73 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.1ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 36
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.1ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 36 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.1ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 36 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.3ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 71
PouchOrderLine Load (0.3ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 72
Completed 200 OK in 54ms (Views: 41.8ms | ActiveRecord: 7.6ms)
Started GET "/api/pouch_orders?status%5B%5D=approved" for 127.0.0.1 at 2015-06-01 11:49:37 +0200
Processing by Api::PouchOrdersController#index as JSON
Parameters: {"status"=>["approved"]}
User Load (0.3ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 3 ORDER BY `users`.`id` ASC LIMIT 1
(0.4ms) SELECT COUNT(*) FROM `pouch_orders` WHERE `pouch_orders`.`status` = 'approved'
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`status` = 'approved'
Ward Load (0.2ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 6 LIMIT 1
Patient Load (0.1ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 6 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 6
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 12 LIMIT 1
Item Load (0.1ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 13 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.1ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 6
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 6 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 6 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 11
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 12
Ward Load (0.2ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 17 LIMIT 1
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 17 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 17
Item Load (0.1ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 34 LIMIT 1
Item Load (0.1ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 35 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.2ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 17
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 17 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 17 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 33
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 34
Ward Load (0.3ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 28 LIMIT 1
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 28 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 28
Item Load (0.1ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 56 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 57 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.1ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 28
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.1ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 28 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.1ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 28 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 55
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 56
Ward Load (0.1ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 39 LIMIT 1
Patient Load (0.1ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 39 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 39
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 78 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 79 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.2ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 39
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 39 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.3ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 39 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 77
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 78
Completed 200 OK in 58ms (Views: 46.1ms | ActiveRecord: 7.7ms)
Started GET "/api/pouch_orders?status%5B%5D=rejected" for 127.0.0.1 at 2015-06-01 11:49:37 +0200
Processing by Api::PouchOrdersController#index as JSON
Parameters: {"status"=>["rejected"]}
User Load (0.3ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 3 ORDER BY `users`.`id` ASC LIMIT 1
(0.2ms) SELECT COUNT(*) FROM `pouch_orders` WHERE `pouch_orders`.`status` = 'rejected'
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`status` = 'rejected'
Ward Load (0.2ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 12 LIMIT 1
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 12 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 12
Item Load (0.4ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 24 LIMIT 1
Item Load (0.1ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 25 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.1ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 12
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.1ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 12 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.1ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 12 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 23
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 24
Ward Load (0.2ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 23 LIMIT 1
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 23 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.3ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 23
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 46 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 47 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.2ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 23
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 23 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 23 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 45
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 46
Ward Load (0.1ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 34 LIMIT 1
Patient Load (0.1ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 34 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 34
Item Load (0.1ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 68 LIMIT 1
Item Load (0.1ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 69 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.1ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 34
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.1ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 34 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.1ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 34 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 67
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 68
Ward Load (0.1ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 45 LIMIT 1
Patient Load (0.1ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 45 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 45
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 90 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 91 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.1ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 45
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 45 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 45 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 89
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 90
Completed 200 OK in 54ms (Views: 41.4ms | ActiveRecord: 7.4ms)
Started GET "/api/pouch_orders?status%5B%5D=uploading" for 127.0.0.1 at 2015-06-01 11:49:37 +0200
Processing by Api::PouchOrdersController#index as JSON
Parameters: {"status"=>["uploading"]}
User Load (0.3ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 3 ORDER BY `users`.`id` ASC LIMIT 1
(0.2ms) SELECT COUNT(*) FROM `pouch_orders` WHERE `pouch_orders`.`status` = 'uploading'
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`status` = 'uploading'
Ward Load (0.2ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 7 LIMIT 1
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 7 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 7
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 14 LIMIT 1
Item Load (0.3ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 15 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.2ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 7
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 7 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 7 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 13
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 14
Ward Load (0.2ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 18 LIMIT 1
Patient Load (0.1ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 18 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 18
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 36 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 37 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.1ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 18
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 18 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.1ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 18 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 35
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 36
Ward Load (0.2ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 29 LIMIT 1
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 29 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 29
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 58 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 59 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.3ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 29
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 29 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.1ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 29 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 57
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 58
Ward Load (0.1ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 40 LIMIT 1
Patient Load (0.1ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 40 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 40
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 80 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 81 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.2ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 40
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 40 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 40 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 79
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 80
Completed 200 OK in 124ms (Views: 111.7ms | ActiveRecord: 7.7ms)
Started GET "/api/pouch_orders?status%5B%5D=sent_to_machine" for 127.0.0.1 at 2015-06-01 11:49:37 +0200
Processing by Api::PouchOrdersController#index as JSON
Parameters: {"status"=>["sent_to_machine"]}
User Load (0.3ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 3 ORDER BY `users`.`id` ASC LIMIT 1
(0.2ms) SELECT COUNT(*) FROM `pouch_orders` WHERE `pouch_orders`.`status` = 'sent_to_machine'
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`status` = 'sent_to_machine'
Ward Load (0.1ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 8 LIMIT 1
Patient Load (0.1ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 8 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 8
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 16 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 17 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.2ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 8
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 8 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 8 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 15
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 16
Ward Load (0.2ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 19 LIMIT 1
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 19 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 19
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 38 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 39 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.2ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 19
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 19 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.3ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 19 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 37
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 38
Ward Load (0.2ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 30 LIMIT 1
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 30 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 30
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 60 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 61 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.2ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 30
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 30 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 30 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 59
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 60
Ward Load (0.2ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 41 LIMIT 1
Patient Load (0.1ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 41 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 41
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 82 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 83 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.2ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 41
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 41 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 41 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 81
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 82
Completed 200 OK in 68ms (Views: 55.6ms | ActiveRecord: 7.7ms)
Started GET "/api/pouch_orders?status%5B%5D=sorted" for 127.0.0.1 at 2015-06-01 11:49:37 +0200
Processing by Api::PouchOrdersController#index as JSON
Parameters: {"status"=>["sorted"]}
User Load (0.2ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 3 ORDER BY `users`.`id` ASC LIMIT 1
(0.2ms) SELECT COUNT(*) FROM `pouch_orders` WHERE `pouch_orders`.`status` = 'sorted'
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`status` = 'sorted'
Ward Load (0.2ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 9 LIMIT 1
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 9 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 9
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 18 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 19 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.2ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 9
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 9 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 9 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.3ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 17
PouchOrderLine Load (0.5ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 18
Ward Load (0.2ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 20 LIMIT 1
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 20 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 20
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 40 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 41 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.3ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 20
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.3ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 20 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.3ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 20 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.3ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 39
PouchOrderLine Load (0.3ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 40
Ward Load (0.2ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 31 LIMIT 1
Patient Load (0.5ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 31 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.3ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 31
Item Load (0.3ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 62 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 63 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.2ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 31
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 31 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 31 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.3ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 61
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 62
Ward Load (0.2ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 42 LIMIT 1
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 42 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 42
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 84 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 85 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.3ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 42
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.3ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 42 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 42 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 83
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 84
Ward Load (0.2ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 1 LIMIT 1
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 46 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 46
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 38 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 72 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 75 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 53 LIMIT 1
Item Load (0.1ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 47 LIMIT 1
Item Load (0.1ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 79 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 19 LIMIT 1 [["id", 19]]
Item Load (0.1ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 65 LIMIT 1
Item Load (0.1ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 50 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 75 LIMIT 1 [["id", 75]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 95 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 63 LIMIT 1 [["id", 63]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 27 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 26 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 76 LIMIT 1
Item Load (0.1ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 21 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 29 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 6 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.2ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 46
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 46 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.1ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 46 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 91
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 92
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 93
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 94
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 95
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 96
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 97
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 98
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 99
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 100
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 101
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 102
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 103
PouchOrderLine Load (0.3ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 104
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 105
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 106
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 107
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 108
CACHE (0.0ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 1 LIMIT 1 [["id", 1]]
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 86 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.3ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 47
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 6 LIMIT 1 [["id", 6]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 24 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 37 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 27 LIMIT 1 [["id", 27]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 72 LIMIT 1 [["id", 72]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 7 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 91 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.2ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 47
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 47 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 47 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 109
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 110
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 111
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 112
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 113
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 114
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 115
CACHE (0.0ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 1 LIMIT 1 [["id", 1]]
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 87 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 48
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 51 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 37 LIMIT 1 [["id", 37]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 50 LIMIT 1 [["id", 50]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 90 LIMIT 1
Item Load (0.1ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 1 LIMIT 1
Item Load (0.1ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 48 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 58 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 57 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 84 LIMIT 1 [["id", 84]]
Item Load (0.1ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 55 LIMIT 1
Item Load (0.1ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 67 LIMIT 1
Item Load (0.1ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 89 LIMIT 1
Item Load (0.1ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 35 LIMIT 1
Item Load (0.1ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 66 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 47 LIMIT 1 [["id", 47]]
Item Load (0.1ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 87 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 87 LIMIT 1 [["id", 87]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 33 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 26 LIMIT 1 [["id", 26]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 58 LIMIT 1 [["id", 58]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 94 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 72 LIMIT 1 [["id", 72]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 70 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 19 LIMIT 1 [["id", 19]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 20 LIMIT 1
Item Load (0.1ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 64 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 15 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 31 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.3ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 48
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.3ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 48 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 48 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 116
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 117
PouchOrderLine Load (0.3ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 118
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 119
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 120
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 121
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 122
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 123
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 124
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 125
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 126
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 127
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 128
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 129
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 130
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 131
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 132
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 133
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 134
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 135
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 136
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 137
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 138
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 139
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 140
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 141
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 142
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 143
CACHE (0.0ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 1 LIMIT 1 [["id", 1]]
Patient Load (0.1ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 88 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 49
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 75 LIMIT 1 [["id", 75]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 9 LIMIT 1
Item Load (0.1ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 39 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 47 LIMIT 1 [["id", 47]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 67 LIMIT 1 [["id", 67]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 64 LIMIT 1 [["id", 64]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 14 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 22 LIMIT 1
Item Load (0.1ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 16 LIMIT 1
Item Load (0.1ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 68 LIMIT 1
Item Load (0.1ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 60 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 22 LIMIT 1 [["id", 22]]
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.1ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 49
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 49 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 49 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 144
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 145
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 146
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 147
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 148
PouchOrderLine Load (0.3ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 149
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 150
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 151
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 152
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 153
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 154
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 155
CACHE (0.0ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 1 LIMIT 1 [["id", 1]]
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 89 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 50
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 16 LIMIT 1 [["id", 16]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 60 LIMIT 1 [["id", 60]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 29 LIMIT 1 [["id", 29]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 45 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 80 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 10 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 16 LIMIT 1 [["id", 16]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 41 LIMIT 1 [["id", 41]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 24 LIMIT 1 [["id", 24]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 41 LIMIT 1 [["id", 41]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 20 LIMIT 1 [["id", 20]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 45 LIMIT 1 [["id", 45]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 17 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 50 LIMIT 1 [["id", 50]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 76 LIMIT 1 [["id", 76]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 88 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 32 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 10 LIMIT 1 [["id", 10]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 73 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 67 LIMIT 1 [["id", 67]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 84 LIMIT 1 [["id", 84]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 39 LIMIT 1 [["id", 39]]
Item Load (0.1ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 81 LIMIT 1
Item Load (0.1ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 2 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 76 LIMIT 1 [["id", 76]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 35 LIMIT 1 [["id", 35]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 48 LIMIT 1 [["id", 48]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 53 LIMIT 1 [["id", 53]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 18 LIMIT 1 [["id", 18]]
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.1ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 50
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 50 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 50 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 156
PouchOrderLine Load (0.4ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 157
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 158
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 159
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 160
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 161
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 162
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 163
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 164
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 165
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 166
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 167
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 168
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 169
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 170
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 171
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 172
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 173
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 174
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 175
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 176
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 177
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 178
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 179
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 180
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 181
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 182
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 183
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 184
CACHE (0.0ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 1 LIMIT 1 [["id", 1]]
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 90 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 51
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 23 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 14 LIMIT 1 [["id", 14]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 79 LIMIT 1 [["id", 79]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 38 LIMIT 1 [["id", 38]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 83 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 46 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.2ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 51
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 51 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 51 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 185
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 186
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 187
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 188
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 189
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 190
CACHE (0.0ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 1 LIMIT 1 [["id", 1]]
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 91 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 52
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 89 LIMIT 1 [["id", 89]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 68 LIMIT 1 [["id", 68]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 44 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 87 LIMIT 1 [["id", 87]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 29 LIMIT 1 [["id", 29]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 23 LIMIT 1 [["id", 23]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 41 LIMIT 1 [["id", 41]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 57 LIMIT 1 [["id", 57]]
Item Load (0.3ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 54 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 55 LIMIT 1 [["id", 55]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 23 LIMIT 1 [["id", 23]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 74 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.2ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 52
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 52 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 52 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 191
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 192
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 193
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 194
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 195
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 196
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 197
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 198
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 199
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 200
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 201
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 202
CACHE (0.0ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 1 LIMIT 1 [["id", 1]]
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 92 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 53
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 67 LIMIT 1 [["id", 67]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 52 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 51 LIMIT 1 [["id", 51]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 81 LIMIT 1 [["id", 81]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 47 LIMIT 1 [["id", 47]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 81 LIMIT 1 [["id", 81]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 59 LIMIT 1
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 3 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 58 LIMIT 1 [["id", 58]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 9 LIMIT 1 [["id", 9]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 20 LIMIT 1 [["id", 20]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 42 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 55 LIMIT 1 [["id", 55]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 38 LIMIT 1 [["id", 38]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 16 LIMIT 1 [["id", 16]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 70 LIMIT 1 [["id", 70]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 9 LIMIT 1 [["id", 9]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 95 LIMIT 1 [["id", 95]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 15 LIMIT 1 [["id", 15]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 33 LIMIT 1 [["id", 33]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 83 LIMIT 1 [["id", 83]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 6 LIMIT 1 [["id", 6]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 40 LIMIT 1 [["id", 40]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 82 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 60 LIMIT 1 [["id", 60]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 28 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 58 LIMIT 1 [["id", 58]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 81 LIMIT 1 [["id", 81]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 86 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 67 LIMIT 1 [["id", 67]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 39 LIMIT 1 [["id", 39]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 25 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.2ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 53
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.3ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 53 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.3ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 53 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 203
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 204
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 205
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 206
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 207
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 208
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 209
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 210
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 211
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 212
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 213
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 214
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 215
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 216
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 217
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 218
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 219
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 220
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 221
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 222
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 223
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 224
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 225
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 226
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 227
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 228
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 229
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 230
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 231
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 232
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 233
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 234
CACHE (0.0ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 1 LIMIT 1 [["id", 1]]
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 93 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 54
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 11 LIMIT 1
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.2ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 54
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 54 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 54 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 235
CACHE (0.0ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 1 LIMIT 1 [["id", 1]]
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 94 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.3ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 55
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 26 LIMIT 1 [["id", 26]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 59 LIMIT 1 [["id", 59]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 90 LIMIT 1 [["id", 90]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 5 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 21 LIMIT 1 [["id", 21]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 13 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 24 LIMIT 1 [["id", 24]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 49 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 38 LIMIT 1 [["id", 38]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 48 LIMIT 1 [["id", 48]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 30 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 84 LIMIT 1 [["id", 84]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 56 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 76 LIMIT 1 [["id", 76]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 36 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 49 LIMIT 1 [["id", 49]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 55 LIMIT 1 [["id", 55]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 79 LIMIT 1 [["id", 79]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 91 LIMIT 1 [["id", 91]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 21 LIMIT 1 [["id", 21]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 31 LIMIT 1 [["id", 31]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 78 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 7 LIMIT 1 [["id", 7]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 21 LIMIT 1 [["id", 21]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 80 LIMIT 1 [["id", 80]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 17 LIMIT 1 [["id", 17]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 47 LIMIT 1 [["id", 47]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 32 LIMIT 1 [["id", 32]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 51 LIMIT 1 [["id", 51]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 12 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 64 LIMIT 1 [["id", 64]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 94 LIMIT 1 [["id", 94]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 38 LIMIT 1 [["id", 38]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 53 LIMIT 1 [["id", 53]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 37 LIMIT 1 [["id", 37]]
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.2ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 55
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 55 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 55 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 236
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 237
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 238
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 239
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 240
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 241
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 242
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 243
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 244
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 245
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 246
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 247
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 248
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 249
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 250
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 251
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 252
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 253
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 254
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 255
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 256
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 257
PouchOrderLine Load (0.3ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 258
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 259
PouchOrderLine Load (0.3ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 260
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 261
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 262
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 263
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 264
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 265
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 266
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 267
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 268
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 269
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 270
CACHE (0.0ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 1 LIMIT 1 [["id", 1]]
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 95 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 56
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 17 LIMIT 1 [["id", 17]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 61 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 46 LIMIT 1 [["id", 46]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 16 LIMIT 1 [["id", 16]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 13 LIMIT 1 [["id", 13]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 38 LIMIT 1 [["id", 38]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 91 LIMIT 1 [["id", 91]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 35 LIMIT 1 [["id", 35]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 15 LIMIT 1 [["id", 15]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 62 LIMIT 1 [["id", 62]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 3 LIMIT 1 [["id", 3]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 48 LIMIT 1 [["id", 48]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 83 LIMIT 1 [["id", 83]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 42 LIMIT 1 [["id", 42]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 52 LIMIT 1 [["id", 52]]
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.2ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 56
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 56 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 56 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 271
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 272
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 273
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 274
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 275
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 276
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 277
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 278
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 279
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 280
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 281
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 282
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 283
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 284
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 285
CACHE (0.0ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 1 LIMIT 1 [["id", 1]]
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 96 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.3ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 57
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 25 LIMIT 1 [["id", 25]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 16 LIMIT 1 [["id", 16]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 64 LIMIT 1 [["id", 64]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 67 LIMIT 1 [["id", 67]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 52 LIMIT 1 [["id", 52]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 40 LIMIT 1 [["id", 40]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 67 LIMIT 1 [["id", 67]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 71 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 23 LIMIT 1 [["id", 23]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 17 LIMIT 1 [["id", 17]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 43 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 62 LIMIT 1 [["id", 62]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 47 LIMIT 1 [["id", 47]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 3 LIMIT 1 [["id", 3]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 72 LIMIT 1 [["id", 72]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 37 LIMIT 1 [["id", 37]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 21 LIMIT 1 [["id", 21]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 32 LIMIT 1 [["id", 32]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 83 LIMIT 1 [["id", 83]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 91 LIMIT 1 [["id", 91]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 78 LIMIT 1 [["id", 78]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 63 LIMIT 1 [["id", 63]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 6 LIMIT 1 [["id", 6]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 69 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 94 LIMIT 1 [["id", 94]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 62 LIMIT 1 [["id", 62]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 68 LIMIT 1 [["id", 68]]
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.2ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 57
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 57 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 57 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 286
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 287
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 288
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 289
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 290
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 291
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 292
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 293
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 294
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 295
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 296
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 297
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 298
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 299
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 300
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 301
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 302
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 303
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 304
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 305
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 306
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 307
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 308
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 309
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 310
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 311
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 312
CACHE (0.0ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 1 LIMIT 1 [["id", 1]]
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 97 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 58
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.3ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 58
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.3ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 58 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 58 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
CACHE (0.0ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 1 LIMIT 1 [["id", 1]]
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 98 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 59
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 63 LIMIT 1 [["id", 63]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 82 LIMIT 1 [["id", 82]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 22 LIMIT 1 [["id", 22]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 79 LIMIT 1 [["id", 79]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 47 LIMIT 1 [["id", 47]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 90 LIMIT 1 [["id", 90]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 23 LIMIT 1 [["id", 23]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 45 LIMIT 1 [["id", 45]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 71 LIMIT 1 [["id", 71]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 88 LIMIT 1 [["id", 88]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 95 LIMIT 1 [["id", 95]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 95 LIMIT 1 [["id", 95]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 95 LIMIT 1 [["id", 95]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 63 LIMIT 1 [["id", 63]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 44 LIMIT 1 [["id", 44]]
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 93 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 24 LIMIT 1 [["id", 24]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 18 LIMIT 1 [["id", 18]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 17 LIMIT 1 [["id", 17]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 67 LIMIT 1 [["id", 67]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 68 LIMIT 1 [["id", 68]]
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.2ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 59
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 59 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 59 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 313
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 314
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 315
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 316
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 317
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 318
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 319
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 320
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 321
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 322
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 323
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 324
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 325
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 326
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 327
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 328
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 329
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 330
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 331
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 332
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 333
CACHE (0.0ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 1 LIMIT 1 [["id", 1]]
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 99 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 60
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 78 LIMIT 1 [["id", 78]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 58 LIMIT 1 [["id", 58]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 63 LIMIT 1 [["id", 63]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 74 LIMIT 1 [["id", 74]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 9 LIMIT 1 [["id", 9]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 53 LIMIT 1 [["id", 53]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 1 LIMIT 1 [["id", 1]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 49 LIMIT 1 [["id", 49]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 39 LIMIT 1 [["id", 39]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 40 LIMIT 1 [["id", 40]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 83 LIMIT 1 [["id", 83]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 13 LIMIT 1 [["id", 13]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 81 LIMIT 1 [["id", 81]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 50 LIMIT 1 [["id", 50]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 41 LIMIT 1 [["id", 41]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 76 LIMIT 1 [["id", 76]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 88 LIMIT 1 [["id", 88]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 48 LIMIT 1 [["id", 48]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 6 LIMIT 1 [["id", 6]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 5 LIMIT 1 [["id", 5]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 94 LIMIT 1 [["id", 94]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 41 LIMIT 1 [["id", 41]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 2 LIMIT 1 [["id", 2]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 73 LIMIT 1 [["id", 73]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 90 LIMIT 1 [["id", 90]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 46 LIMIT 1 [["id", 46]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 52 LIMIT 1 [["id", 52]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 91 LIMIT 1 [["id", 91]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 80 LIMIT 1 [["id", 80]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 66 LIMIT 1 [["id", 66]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 15 LIMIT 1 [["id", 15]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 39 LIMIT 1 [["id", 39]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 12 LIMIT 1 [["id", 12]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 2 LIMIT 1 [["id", 2]]
Item Load (0.3ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 8 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 38 LIMIT 1 [["id", 38]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 89 LIMIT 1 [["id", 89]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 53 LIMIT 1 [["id", 53]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 38 LIMIT 1 [["id", 38]]
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.2ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 60
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 60 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 60 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 334
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 335
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 336
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 337
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 338
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 339
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 340
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 341
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 342
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 343
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 344
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 345
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 346
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 347
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 348
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 349
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 350
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 351
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 352
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 353
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 354
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 355
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 356
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 357
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 358
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 359
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 360
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 361
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 362
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 363
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 364
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 365
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 366
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 367
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 368
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 369
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 370
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 371
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 372
CACHE (0.0ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 1 LIMIT 1 [["id", 1]]
Patient Load (0.1ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 100 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 61
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 61 LIMIT 1 [["id", 61]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 62 LIMIT 1 [["id", 62]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 72 LIMIT 1 [["id", 72]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 15 LIMIT 1 [["id", 15]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 40 LIMIT 1 [["id", 40]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 39 LIMIT 1 [["id", 39]]
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.1ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 61
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 61 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.1ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 61 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 373
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 374
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 375
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 376
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 377
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 378
CACHE (0.0ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 1 LIMIT 1 [["id", 1]]
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 101 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 62
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 71 LIMIT 1 [["id", 71]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 87 LIMIT 1 [["id", 87]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 44 LIMIT 1 [["id", 44]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 47 LIMIT 1 [["id", 47]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 19 LIMIT 1 [["id", 19]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 74 LIMIT 1 [["id", 74]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 47 LIMIT 1 [["id", 47]]
Item Load (0.3ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 4 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 52 LIMIT 1 [["id", 52]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 8 LIMIT 1 [["id", 8]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 51 LIMIT 1 [["id", 51]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 35 LIMIT 1 [["id", 35]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 57 LIMIT 1 [["id", 57]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 69 LIMIT 1 [["id", 69]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 54 LIMIT 1 [["id", 54]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 73 LIMIT 1 [["id", 73]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 54 LIMIT 1 [["id", 54]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 26 LIMIT 1 [["id", 26]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 20 LIMIT 1 [["id", 20]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 9 LIMIT 1 [["id", 9]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 82 LIMIT 1 [["id", 82]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 37 LIMIT 1 [["id", 37]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 89 LIMIT 1 [["id", 89]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 16 LIMIT 1 [["id", 16]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 79 LIMIT 1 [["id", 79]]
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.3ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 62
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 62 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 62 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 379
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 380
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 381
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 382
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 383
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 384
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 385
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 386
PouchOrderLine Load (0.3ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 387
PouchOrderLine Load (0.3ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 388
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 389
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 390
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 391
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 392
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 393
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 394
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 395
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 396
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 397
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 398
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 399
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 400
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 401
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 402
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 403
CACHE (0.0ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 1 LIMIT 1 [["id", 1]]
Patient Load (0.1ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 102 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 63
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 16 LIMIT 1 [["id", 16]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 88 LIMIT 1 [["id", 88]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 54 LIMIT 1 [["id", 54]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 54 LIMIT 1 [["id", 54]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 75 LIMIT 1 [["id", 75]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 60 LIMIT 1 [["id", 60]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 93 LIMIT 1 [["id", 93]]
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.3ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 63
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 63 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 63 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 404
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 405
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 406
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 407
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 408
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 409
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 410
CACHE (0.0ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 1 LIMIT 1 [["id", 1]]
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 103 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 64
Item Load (0.2ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 34 LIMIT 1
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 37 LIMIT 1 [["id", 37]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 1 LIMIT 1 [["id", 1]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 42 LIMIT 1 [["id", 42]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 57 LIMIT 1 [["id", 57]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 46 LIMIT 1 [["id", 46]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 73 LIMIT 1 [["id", 73]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 84 LIMIT 1 [["id", 84]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 50 LIMIT 1 [["id", 50]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 89 LIMIT 1 [["id", 89]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 70 LIMIT 1 [["id", 70]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 56 LIMIT 1 [["id", 56]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 86 LIMIT 1 [["id", 86]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 36 LIMIT 1 [["id", 36]]
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.3ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 64
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 64 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 64 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 411
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 412
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 413
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 414
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 415
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 416
PouchOrderLine Load (0.3ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 417
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 418
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 419
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 420
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 421
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 422
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 423
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 424
CACHE (0.0ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 1 LIMIT 1 [["id", 1]]
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 104 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 65
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 68 LIMIT 1 [["id", 68]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 31 LIMIT 1 [["id", 31]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 47 LIMIT 1 [["id", 47]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 70 LIMIT 1 [["id", 70]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 35 LIMIT 1 [["id", 35]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 18 LIMIT 1 [["id", 18]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 4 LIMIT 1 [["id", 4]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 57 LIMIT 1 [["id", 57]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 4 LIMIT 1 [["id", 4]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 56 LIMIT 1 [["id", 56]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 16 LIMIT 1 [["id", 16]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 3 LIMIT 1 [["id", 3]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 31 LIMIT 1 [["id", 31]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 27 LIMIT 1 [["id", 27]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 10 LIMIT 1 [["id", 10]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 61 LIMIT 1 [["id", 61]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 42 LIMIT 1 [["id", 42]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 25 LIMIT 1 [["id", 25]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 71 LIMIT 1 [["id", 71]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 95 LIMIT 1 [["id", 95]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 14 LIMIT 1 [["id", 14]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 88 LIMIT 1 [["id", 88]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 1 LIMIT 1 [["id", 1]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 9 LIMIT 1 [["id", 9]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 84 LIMIT 1 [["id", 84]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 8 LIMIT 1 [["id", 8]]
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.2ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 65
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 65 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.1ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 65 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 425
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 426
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 427
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 428
PouchOrderLine Load (0.3ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 429
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 430
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 431
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 432
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 433
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 434
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 435
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 436
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 437
PouchOrderLine Load (0.3ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 438
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 439
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 440
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 441
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 442
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 443
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 444
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 445
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 446
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 447
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 448
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 449
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 450
CACHE (0.0ms) SELECT `wards`.* FROM `wards` WHERE `wards`.`id` = 1 LIMIT 1 [["id", 1]]
Patient Load (0.2ms) SELECT `patients`.* FROM `patients` WHERE `patients`.`id` = 105 LIMIT 1
==== has_licensed_item?
[C] -- Not great, all items in all lines are inspected.
Suggestions:
* Looks like the license check on item is possible to do in pure SQL!
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`pouch_order_id` = 66
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 34 LIMIT 1 [["id", 34]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 53 LIMIT 1 [["id", 53]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 43 LIMIT 1 [["id", 43]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 72 LIMIT 1 [["id", 72]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 27 LIMIT 1 [["id", 27]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 55 LIMIT 1 [["id", 55]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 58 LIMIT 1 [["id", 58]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 72 LIMIT 1 [["id", 72]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 9 LIMIT 1 [["id", 9]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 58 LIMIT 1 [["id", 58]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 63 LIMIT 1 [["id", 63]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 68 LIMIT 1 [["id", 68]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 26 LIMIT 1 [["id", 26]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 87 LIMIT 1 [["id", 87]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 71 LIMIT 1 [["id", 71]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 33 LIMIT 1 [["id", 33]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 61 LIMIT 1 [["id", 61]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 20 LIMIT 1 [["id", 20]]
CACHE (0.0ms) SELECT `items`.* FROM `items` WHERE `items`.`id` = 75 LIMIT 1 [["id", 75]]
==== has_dangerous_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
Interaction Load (0.2ms) SELECT `interactions`.* FROM `interactions` WHERE `interactions`.`pouch_order_id` = 66
==== has_unknown_interactions?
[C] -- Pure SQL not possible, need to serialize into AR object and do self inspection.
Suggestions:
* Prefix with :has_interactions? to do efficient exists query in many cases.
* Does :any? go through all records? If so, switch to :find and convert to boolean
==== replaced?
[B] -- It's OK, but...
Suggestions:
* Try object.replaced?
PouchOrder Load (0.2ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`replacement_id` = 66 LIMIT 1
==== has_overdoses?
[A] -- extremely good performance: EXISTS query
Overdose Exists (0.2ms) SELECT 1 AS one FROM `overdoses` WHERE `overdoses`.`pouch_order_id` = 66 LIMIT 1
==== has_substitutions?
[F] -- Needs improvement
Suggestions:
* TBD
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 451
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 452
PouchOrderLine Load (0.4ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 453
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 454
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 455
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 456
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 457
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 458
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 459
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 460
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 461
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 462
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 463
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 464
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 465
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 466
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 467
PouchOrderLine Load (0.1ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 468
PouchOrderLine Load (0.2ms) SELECT `pouch_order_lines`.* FROM `pouch_order_lines` WHERE `pouch_order_lines`.`substitution_for_id` = 469
Completed 200 OK in 942ms (Views: 823.1ms | ActiveRecord: 114.0ms)
Started GET "/api/pouch_orders?status%5B%5D=shipped" for 127.0.0.1 at 2015-06-01 11:49:38 +0200
Processing by Api::PouchOrdersController#index as JSON
Parameters: {"status"=>["shipped"]}
User Load (0.3ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 3 ORDER BY `users`.`id` ASC LIMIT 1
(0.2ms) SELECT COUNT(*) FROM `pouch_orders` WHERE `pouch_orders`.`status` = 'shipped' AND (updated_at > '2015-05-30 09:49:38.718803')
PouchOrder Load (0.3ms) SELECT `pouch_orders`.* FROM `pouch_orders` WHERE `pouch_orders`.`status` = 'shipped' AND (updated_at > '2015-05-30 09:49:38.718803')
Completed 200 OK in 7ms (Views: 1.1ms | ActiveRecord: 0.8ms)
Started GET "/api/hospitals" for 127.0.0.1 at 2015-06-01 11:49:38 +0200
Processing by Api::HospitalsController#index as JSON
User Load (0.3ms) SELECT `users`.* FROM `users` WHERE `users`.`id` = 3 ORDER BY `users`.`id` ASC LIMIT 1
Ward Load (0.2ms) SELECT `wards`.* FROM `wards`
Completed 200 OK in 619ms (Views: 613.6ms | ActiveRecord: 0.5ms)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment