Project

General

Profile

Actions

Bug #13165

closed

arvados-cwl-runner on a large workflow results in long (45s+) api server database queries

Added by Joshua Randall about 6 years ago. Updated almost 6 years ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Category:
API
Target version:
Story points:
-
Release:
Release relationship:
Auto

Description

SELECT  collections."uuid", collections."owner_uuid", collections."created_at", collections."modified_by_client_uuid", collections."modified_by_user_uuid", collections."modified_at", collections."name", collections."description", collections."properties", collections."portable_data_hash", collections."replication_desired", collections."replication_confirmed", collections."replication_confirmed_at", collections."delete_at", collections."trash_at", collections."is_trashed" FROM "collections" WHERE (is_trashed = false) AND (NOT EXISTS(SELECT 1
                  FROM materialized_permission_view
                  WHERE trashed = 1 AND
                  (collections.uuid = target_uuid OR collections.owner_uuid = target_uuid))) AND ((collections.portable_data_hash = 'e10c53fb1e1dbfd0ad0f275dc15f05d4+2230'))  ORDER BY collections.modified_at desc, collections.uuid LIMIT 1 OFFSET 0

EXPLAIN ANALYZE on same:

arvados_api_production=> EXPLAIN ANALYZE SELECT  collections."uuid", collections."owner_uuid", collections."created_at", collections."modified_by_client_uuid", collections."modified_by_user_uuid", collections."modified_at", collections."name", collections."description", collections."properties", collections."portable_data_hash", collections."replication_desired", collections."replication_confirmed", collections."replication_confirmed_at", collections."delete_at", collections."trash_at", collections."is_trashed" FROM "collections" WHERE (is_trashed = false) AND (NOT EXISTS(SELECT 1
                  FROM materialized_permission_view
                  WHERE trashed = 1 AND
                  (collections.uuid = target_uuid OR collections.owner_uuid = target_uuid))) AND ((collections.portable_data_hash = 'e10c53fb1e1dbfd0ad0f275dc15f05d4+2230'))  ORDER BY collections.modified_at desc, collections.uuid LIMIT 1 OFFSET 0
;
QUERY PLAN|Limit  (cost=0.55..988.35 rows=1 width=833) (actual time=39707.297..39707.297 rows=1 loops=1)

QUERY PLAN|  ->  Nested Loop Anti Join  (cost=0.55..601571.59 rows=609 width=833) (actual time=39707.297..39707.297 rows=1 loops=1)

QUERY PLAN|        Join Filter: (((collections.uuid)::text = (materialized_permission_view.target_uuid)::text) OR ((collections.owner_uuid)::text = (materialized_permission_view.target_uuid)::text))

QUERY PLAN|        ->  Index Scan using index_collections_on_modified_at_uuid on collections  (cost=0.55..601548.77 rows=1219 width=833) (actual time=39707.281..39707.281 rows=1 loops=1)

QUERY PLAN|              Filter: ((NOT is_trashed) AND ((portable_data_hash)::text = 'e10c53fb1e1dbfd0ad0f275dc15f05d4+2230'::text))

QUERY PLAN|              Rows Removed by Filter: 1609314

QUERY PLAN|        ->  Materialize  (cost=0.00..1.49 rows=1 width=82) (actual time=0.013..0.013 rows=0 loops=1)

QUERY PLAN|              ->  Seq Scan on materialized_permission_view  (cost=0.00..1.49 rows=1 width=82) (actual time=0.011..0.011 rows=0 loops=1)

QUERY PLAN|                    Filter: (trashed = 1)

QUERY PLAN|                    Rows Removed by Filter: 39

QUERY PLAN|Planning time: 0.248 ms

QUERY PLAN|Execution time: 39707.348 ms

Actions

Also available in: Atom PDF