Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inefficient file search #3271

Closed
andreas-p opened this issue Jan 26, 2017 · 2 comments
Closed

inefficient file search #3271

andreas-p opened this issue Jan 26, 2017 · 2 comments
Labels
1. to develop Accepted and waiting to be taken care of enhancement medium papercut Annoying recurring issue with possibly simple fix.

Comments

@andreas-p
Copy link

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).

@LukasReschke
Copy link
Member

cc @icewind1991

@skjnldsv skjnldsv added 1. to develop Accepted and waiting to be taken care of medium papercut Annoying recurring issue with possibly simple fix. labels Jun 19, 2018
@nextcloud-bot nextcloud-bot added the stale Ticket or PR with no recent activity label Jul 20, 2018
@skjnldsv skjnldsv removed stale Ticket or PR with no recent activity labels Jun 12, 2019
@szaimen
Copy link
Contributor

szaimen commented May 21, 2021

I'm closing this issue due to inactivity. If this is still happening please make sure to upgrade to the latest version. After that, feel free to reopen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. to develop Accepted and waiting to be taken care of enhancement medium papercut Annoying recurring issue with possibly simple fix.
Projects
None yet
Development

No branches or pull requests

5 participants