[ARVADOS] created: 1.3.0-2114-g9fc2ff558

Git user git at public.arvados.org
Tue Jan 28 20:10:17 UTC 2020


        at  9fc2ff5583fc31c9f75f80dcf7258bed63084568 (commit)


commit 9fc2ff5583fc31c9f75f80dcf7258bed63084568
Author: Tom Clegg <tom at tomclegg.ca>
Date:   Tue Jan 28 15:05:02 2020 -0500

    15902: Adjust order to avoid poorly optimized query.
    
    When many requesting_container_uuid values are passed in this query,
    the default order (["modified_at desc", "uuid"]) sometimes causes
    PostgreSQL to begin with the timestamp index, which results in a slow
    query. The requesting_container_uuid index makes the query much
    faster.
    
    Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom at tomclegg.ca>

diff --git a/apps/workbench/app/models/container_work_unit.rb b/apps/workbench/app/models/container_work_unit.rb
index faba062d4..292bc3679 100644
--- a/apps/workbench/app/models/container_work_unit.rb
+++ b/apps/workbench/app/models/container_work_unit.rb
@@ -29,7 +29,7 @@ class ContainerWorkUnit < ProxyWorkUnit
       my_child_containers = my_children.map(&:container_uuid).compact.uniq
       grandchildren = {}
       my_child_containers.each { |c| grandchildren[c] = []} if my_child_containers.any?
-      reqs = ContainerRequest.select(cols).where(requesting_container_uuid: my_child_containers).with_count("none").results if my_child_containers.any?
+      reqs = ContainerRequest.select(cols).where(requesting_container_uuid: my_child_containers).order(["requesting_container_uuid", "uuid"]).with_count("none").results if my_child_containers.any?
       reqs.each {|cr| grandchildren[cr.requesting_container_uuid] << cr} if reqs
 
       my_children.each do |cr|

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list