Skip to content

Instantly share code, notes, and snippets.

@mdkalish
Created April 18, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mdkalish/fc7c6cb993b1278211df to your computer and use it in GitHub Desktop.
Save mdkalish/fc7c6cb993b1278211df to your computer and use it in GitHub Desktop.
Query times with and without Active Record includes method for the given number of records in pg db deployed on Heroku.
=begin
WITHOUT includes():
For 10 records:
Completed 200 OK in 29ms (Views: 13.9ms | ActiveRecord: 14.5ms)
Completed 200 OK in 98ms (Views: 27.8ms | ActiveRecord: 69.2ms)
Completed 200 OK in 116ms (Views: 44.3ms | ActiveRecord: 71.0ms)
Completed 200 OK in 56ms (Views: 21.1ms | ActiveRecord: 32.5ms)
Completed 200 OK in 292ms (Views: 131.9ms | ActiveRecord: 156.7ms)
For 100 records:
Completed 200 OK in 448ms (Views: 215.5ms | ActiveRecord: 232.2ms)
Completed 200 OK in 254ms (Views: 113.7ms | ActiveRecord: 139.3ms)
Completed 200 OK in 376ms (Views: 202.7ms | ActiveRecord: 172.1ms)
Completed 200 OK in 340ms (Views: 210.9ms | ActiveRecord: 128.6ms)
Completed 200 OK in 380ms (Views: 129.5ms | ActiveRecord: 250.2ms)
For 1000 records:
Completed 200 OK in 10674ms (Views: 3430.4ms | ActiveRecord: 7243.2ms)
Completed 200 OK in 7390ms (Views: 2455.9ms | ActiveRecord: 4933.4ms)
Completed 200 OK in 11827ms (Views: 3575.9ms | ActiveRecord: 8249.9ms)
Completed 200 OK in 5844ms (Views: 1984.2ms | ActiveRecord: 3857.7ms)
Completed 200 OK in 9459ms (Views: 3022.3ms | ActiveRecord: 6435.7ms)
WITH includes():
For 10 records:
Completed 200 OK in 13ms (Views: 6.0ms | ActiveRecord: 6.3ms)
Completed 200 OK in 14ms (Views: 6.0ms | ActiveRecord: 7.5ms)
Completed 200 OK in 13ms (Views: 6.3ms | ActiveRecord: 6.2ms)
Completed 200 OK in 14ms (Views: 6.3ms | ActiveRecord: 6.5ms)
Completed 200 OK in 15ms (Views: 7.0ms | ActiveRecord: 6.9ms)
For 100 records:
Completed 200 OK in 50ms (Views: 35.6ms | ActiveRecord: 13.1ms)
Completed 200 OK in 34ms (Views: 22.6ms | ActiveRecord: 10.1ms)
Completed 200 OK in 35ms (Views: 22.4ms | ActiveRecord: 11.3ms)
Completed 200 OK in 37ms (Views: 23.1ms | ActiveRecord: 13.1ms)
Completed 200 OK in 34ms (Views: 23.6ms | ActiveRecord: 9.9ms)
For 1000 records:
Completed 200 OK in 509ms (Views: 371.2ms | ActiveRecord: 128.0ms)
Completed 200 OK in 426ms (Views: 386.7ms | ActiveRecord: 38.2ms)
Completed 200 OK in 341ms (Views: 275.4ms | ActiveRecord: 64.6ms)
Completed 200 OK in 285ms (Views: 251.9ms | ActiveRecord: 31.9ms)
Completed 200 OK in 314ms (Views: 278.6ms | ActiveRecord: 34.5ms)
=end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment