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

Add parent index on filecache #36701

Merged
merged 1 commit into from Mar 21, 2023
Merged

Conversation

artonge
Copy link
Contributor

@artonge artonge commented Feb 14, 2023

To speed up:

$query->select('size', 'unencrypted_size')
->from('filecache')
->whereParent($id);

The current query uses the parent_name_hash index, which is not optimal with long names.

id select_type table type possible_keys key key_len ref rows
Without index 1 SIMPLE oc_filecache ref fs_parent_name_hash fs_parent_name_hash 8 const 5
With index 1 SIMPLE oc_filecache ref fs_parent_name_hash,oc_filecache_parent oc_filecache_parent 8 const 5

@artonge artonge self-assigned this Feb 14, 2023
@artonge artonge added 3. to review Waiting for reviews php Pull requests that update Php code labels Feb 14, 2023
@artonge artonge added this to the Nextcloud 26 milestone Feb 14, 2023
@artonge
Copy link
Contributor Author

artonge commented Feb 14, 2023

/backport to stable25

@artonge
Copy link
Contributor Author

artonge commented Feb 14, 2023

/backport to stable24

Copy link
Member

@icewind1991 icewind1991 left a comment

Choose a reason for hiding this comment

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

Also needs to be added to the migration that creates the filecache table

@artonge
Copy link
Contributor Author

artonge commented Feb 16, 2023

Waiting for more practical feedbacks before moving on.

@szaimen szaimen requested review from juliushaertl, a team, ArtificialOwl and blizzz and removed request for a team February 22, 2023 14:39
@juliushaertl
Copy link
Member

Can you outline or do you have a reference why the single index would be faster? At least from the explain there seems to be no difference.

@skjnldsv skjnldsv mentioned this pull request Feb 23, 2023
@icewind1991
Copy link
Member

Can you outline or do you have a reference why the single index would be faster? At least from the explain there seems to be no difference.

It seems that the size of the parent_name_hash index is causing performance issues

@blizzz blizzz mentioned this pull request Mar 7, 2023
@blizzz blizzz modified the milestones: Nextcloud 26, Nextcloud 27 Mar 7, 2023
@szaimen
Copy link
Contributor

szaimen commented Mar 20, 2023

/rebase

@szaimen szaimen enabled auto-merge March 20, 2023 14:44
@szaimen szaimen removed the 3. to review Waiting for reviews label Mar 20, 2023
@szaimen szaimen added the 4. to release Ready to be released and/or waiting for tests to finish label Mar 20, 2023
Signed-off-by: Louis Chemineau <louis@chmn.me>
@juliushaertl
Copy link
Member

Failure unrelated

@juliushaertl juliushaertl merged commit 0d75a30 into master Mar 21, 2023
35 of 37 checks passed
@juliushaertl juliushaertl deleted the artonge/feat/fc_parent_index branch March 21, 2023 07:32
@szaimen
Copy link
Contributor

szaimen commented Mar 21, 2023

/backport to stable26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Ready to be released and/or waiting for tests to finish php Pull requests that update Php code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants