Details
-
Bug
-
Status: Closed (View Workflow)
-
P2
-
Resolution: Cannot Reproduce
-
None
-
None
-
-
Core: F - Sprint 90
-
1
-
Prokopovych
Description
Overview
This was observed in bugfest fameflower. Filtering items by status is either slow or sometimes even hangs up the DB
This is the query that was observed to take the longest time:
WITH headrecords AS ( SELECT jsonb, lower(f_unaccent(jsonb->>'title')) AS title FROM fs09000000_mod_inventory_storage.instance WHERE (instance.id IN ( SELECT instanceId FROM holdings_record WHERE holdings_record.id IN ( SELECT holdingsRecordId FROM item WHERE to_tsvector('simple', f_unaccent(item.jsonb->'status'->>'name')) @@ replace((to_tsquery('simple', f_unaccent('''Available''')))::text, '&', '<->')::tsquery))) AND left(lower(f_unaccent(jsonb->>'title')),600) < ( SELECT left(lower(f_unaccent(jsonb->>'title')),600) FROM fs09000000_mod_inventory_storage.instance ORDER BY left(lower(f_unaccent(jsonb->>'title')),600) OFFSET 10000 LIMIT 1 ) ORDER BY left(lower(f_unaccent(jsonb->>'title')),600) LIMIT 100 OFFSET 0 ), allrecords AS ( SELECT jsonb, lower(f_unaccent(jsonb->>'title')) AS title FROM fs09000000_mod_inventory_storage.instance WHERE (instance.id IN ( SELECT instanceId FROM holdings_record WHERE holdings_record.id IN ( SELECT holdingsRecordId FROM item WHERE to_tsvector('simple', f_unaccent(item.jsonb->'status'->>'name')) @@ replace((to_tsquery('simple', f_unaccent('''Available''')))::text, '&', '<->')::tsquery))) AND (SELECT COUNT(*) FROM headrecords) < 100 ) SELECT jsonb, title, 0 AS count FROM headrecords WHERE (SELECT COUNT(*) FROM headrecords) >= 100 UNION (SELECT jsonb, title, (SELECT COUNT(*) FROM allrecords) AS count FROM allrecords ORDER BY title LIMIT 100 OFFSET 0 ) ORDER BY title
Steps to reproduce
1.Login to bugfest
2. Go to Inventory-> Item tab
3. check the filter "Available"
TestRail: Results
Attachments
Issue Links
- relates to
-
FOLIO-2563 SPIKE: propose prevention of DoS via CQL query
-
- Closed
-
-
MODINVSTOR-500 Instance source index for = search
-
- Closed
-
-
PERF-48 Inventory. Slow query when filtering on Item status: Available
-
- Closed
-
-
FOLIO-2573 Paused due to POC of Elastic Search. All Search Options Should be Supported by a Database Index
-
- Closed
-