I noticed a query showing up on my server as unindexed. It seems that the uc_file module commonly queries the uc_files table filtering on the unindexed filename field. The attached patch indexes this field to lighten that query.

CommentFileSizeAuthor
uc_file.index_filename.patch928 bytesneclimdul
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

neclimdul’s picture

Simple fix still applies. By commonly queried, there are quite a few queries that call this that happen on a good number of admin pages(auto complete, file listing, etc) and the user edit form. For a large number of files this can be a pretty good sized unindexed scan or sort.

longwave’s picture

Component: Code » File downloads

Changing component.

longwave’s picture

Version: 6.x-2.x-dev » 7.x-3.x-dev
Status: Needs review » Patch (to be ported)

In testing this cut the runtime of uc_file_refresh() on a large folder by about 60% so it makes sense to me. Committed to 6.x.

longwave’s picture

Status: Patch (to be ported) » Fixed

Ported and committed to 7.x.

TR’s picture

D6 patch generates PHP Warning in PHP 5.2.13: "Warning: Call-time pass-by-reference has been deprecated in /xxx/sites/all/modules/ubercart/uc_file/uc_file.install on line 445"

Line 445 is db_add_index(&$ret, 'uc_files', 'filename', array('filename'));

longwave’s picture

Status: Fixed » Needs work
longwave’s picture

Status: Needs work » Fixed

Fixed by removing the &

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.