inefficient file search #3271
Labels
1. to develop
Accepted and waiting to be taken care of
enhancement
medium
papercut
Annoying recurring issue with possibly simple fix.
I'm running NC11.0.1 against a PostgreSQL 9.5 database and have been logging long-running queries. All queries I found were related to the file search function.
Apparently Search\PagedProvider isn't implemented for files, so all paging is done after a SELECT without LIMIT. The system has a user sharing with most other users, who owns 350k files at the moment, so a full search takes a while.
While most queries looked like "... WHERE name ILIKE '%abc%' ", there've been some encounters of a '%%' search pattern. search.js checks for query.length > 2, but there seems to exist a corner case where the check is bypassed and a "" search pattern is requested. In the case of that 350k file user, all rows are retrieved from the database (and filtered down to some 30), which is quite an impact on the server.
I tried switching Provider\File to a PagedProvider implementing LIMIT/OFFSET in Files/Cache/Cache.php, but this will create some cache problems (with cache entries returned that don't fit the pattern).
The text was updated successfully, but these errors were encountered: