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

Improve move performance by doing only one query if possible #38649

Merged
merged 6 commits into from
May 20, 2021

Conversation

jvillafanez
Copy link
Member

@jvillafanez jvillafanez commented Apr 20, 2021

Description

Make only one query for the move operation if possible. Except for sqlite, which will keep the previous behaviour, the rest of the DBs will use 1-2 queries.

Related Issue

No linked issue

Motivation and Context

This will improve performance for the affected DBs

How Has This Been Tested?

Tested manually with postgresql 9.2, oracle 11 XE, oracle 18 XE and MariaDB

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Database schema changes (next release will require increase of minor version instead of patch)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:
  • Changelog item, see TEMPLATE

@update-docs
Copy link

update-docs bot commented Apr 20, 2021

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@jvillafanez
Copy link
Member Author

There is a connectivity issue between ownCloud and oracle 18c XE, but the query itself works.

@mrow4a
Copy link
Contributor

mrow4a commented Apr 30, 2021

@jvillafanez should be for review or still draft?

@jvillafanez
Copy link
Member Author

The connectivity issue with oracle 18 XE can be fixed separately (if it isn't a problem on my side), so yes, this is ready to review.

@jvillafanez jvillafanez marked this pull request as ready for review April 30, 2021 09:52
lib/public/IDBConnection.php Outdated Show resolved Hide resolved
lib/public/IDBConnection.php Outdated Show resolved Hide resolved
}

// for other DBs (sqlite), we keep the old behaviour -> get the list and update one by one
$sql = 'SELECT `path`, `fileid` FROM `*PREFIX*filecache` WHERE `storage` = ? AND `path` LIKE ?';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isnt it cleaner to put in switch case default ? and for other just have duplicate $this->connection->executeQuery ? It is pretty confusing to read.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't say for sure. For sqlite, we have multiple queries to do, it isn't just one query. The implementation is quite different. I didn't want to touch the old implementation because it "works". Note that it isn't a "run queries A, B and C", but a "run query A, and then, based on the results, run query B multiple times"
In addition, one of the reasons to implement it this way is that we can easily comment out a possible faulty query (specially for oracle) so we can switch to the old behaviour.

Maybe splitting into 2 different method might help, but we lose the easy switching between old and new implementation.

@sonarcloud
Copy link

sonarcloud bot commented May 6, 2021

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 3 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@jvillafanez
Copy link
Member Author

Bugfix in #38783

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants