[TYPO3-core] RFC #16685: Bug: bad performance - not using table index while deleting cached imagesize [performance]

Jigal van Hemert jigal at xs4all.nl
Sun Jan 16 09:34:16 CET 2011


Hi,

On 16-1-2011 6:40, Vladimir Podkovanov wrote:
> Problem:
> When deleting row from cache_imagesizes table index not used that
> causing full table scan and it is a problem on big table.
>
> Solution:
> Change "where" clause to use primary index.

Reading the code in that function makes me believe that the entire 
method of clearing cached dimensions is incorrect.

1. the cached dimensions for the md5 of the filepath are retrieved
2. for the first element of the result set is checked if it has the same 
contents (using md5_file)
3. if it does not have the same contents the record(s) with the same 
file contents (this is not the record we've just tested!) are deleted.

This may leave records with the same filepath, but different file 
content in the database. And this may remove records with the same file 
contents, but different filepaths from the database (this happens when 
the same file is stored in two places).

To me this patch at least corrects part of the problem; there needs to 
be some garbage collection for image sizes of deleted/renamed/moved 
files (but that is a different problem).

+1 by reading

-- 
Kind regards / met vriendelijke groet,

Jigal van Hemert
skype:jigal.van.hemert
msn: jigal at xs4all.nl
http://twitter.com/jigalvh


More information about the TYPO3-team-core mailing list