Actions
Bug #9542
closed[API] review logs queries
Story points:
-
Description
I see several
SELECT "logs".* FROM "logs" WHERE (logs.id > 2341779 AND (((logs.event_type in ('create','update','delete'))))) ORDER BY id asc;
which takes 20+ minutes to execute and seems to use 100% of 1 core.
there is a index_logs_on_event_type index
arvados_production=# select t.relname as table_name, i.relname as index_name, array_to_string(array_agg(a.attname), ', ') as column_names from pg_class t, pg_class i, pg_index ix, pg_attribute a where t.oid = ix.indrelid and i.oid = ix.indexrelid and a.attrelid = t.oid and a.attnum = ANY(ix.indkey) and t.relkind = 'r' and t.relname like 'logs%' group by t.relname, i.relname order by t.relname, i.relname; table_name | index_name | column_names ------------+---------------------------+-------------------------------------------------------------------------------------------------------------- logs | index_logs_on_created_at | created_at logs | index_logs_on_event_at | event_at logs | index_logs_on_event_type | event_type logs | index_logs_on_modified_at | modified_at logs | index_logs_on_object_uuid | object_uuid logs | index_logs_on_owner_uuid | owner_uuid logs | index_logs_on_summary | summary logs | index_logs_on_uuid | uuid logs | logs_pkey | id logs | logs_search_index | uuid, owner_uuid, modified_by_client_uuid, modified_by_user_uuid, object_uuid, event_type, object_owner_uuid logs | logs_uuid | uuid (11 rows)
arvados_production=# explain SELECT "logs".* FROM "logs" WHERE (logs.id > 2341779 AND (((logs.event_type in ('create','update','delete'))))) ORDER BY id asc; QUERY PLAN ------------------------------------------------------------------------------------- Index Scan using logs_pkey on logs (cost=0.44..7547930.83 rows=16786039 width=744) Index Cond: (id > 2341779) Filter: ((event_type)::text = ANY ('{create,update,delete}'::text[])) (3 rows)
Actions