From: Tom Clegg Date: Wed, 3 Jun 2015 19:39:01 +0000 (-0400) Subject: 6074: Speed up db query by using octet_length() instead of length(). closes #6223 X-Git-Tag: 1.1.0~1568^2~4 X-Git-Url: https://git.arvados.org/arvados.git/commitdiff_plain/69f592e029493afb8a0709811b5be1fefabafb4b 6074: Speed up db query by using octet_length() instead of length(). closes #6223 --- diff --git a/services/api/app/controllers/application_controller.rb b/services/api/app/controllers/application_controller.rb index 6810d91d4c..e6a02b1e12 100644 --- a/services/api/app/controllers/application_controller.rb +++ b/services/api/app/controllers/application_controller.rb @@ -302,7 +302,7 @@ class ApplicationController < ActionController::Base model_class.transaction do limit_query = @objects. select("(%s) as read_length" % - limit_columns.map { |s| "length(#{s})" }.join(" + ")) + limit_columns.map { |s| "octet_length(#{s})" }.join(" + ")) new_limit = 0 read_total = 0 limit_query.find_each do |record|