Bug 261521

Summary: a creation or a deletion, of a tag, takes a very long time
Product: [Applications] digikam Reporter: Olivier PIFFAUT <opiffautpro>
Component: Database-MysqlAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles, Hamsi2k, vivo75+kde
Priority: NOR    
Version: 1.6.0   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In: 2.0.0
Sentry Crash Report:

Description Olivier PIFFAUT 2010-12-29 11:07:02 UTC
Version:           1.6.0 (using KDE 4.5.4) 
OS:                Linux

a creation or a deletion, of a tag, takes a very long time if more than 500 tags is present

Reproducible: Always

Steps to Reproduce:
Create a tag tree with more 500 items.

Actual Results:  
> 5 minutes to create or delete a tag


MySQl is used for database
Comment 1 caulier.gilles 2010-12-29 11:21:28 UTC
Give us you DB config from digiKam setup panel.

Do you have the same problem about Rating ?

Gilles Caulier
Comment 2 Olivier PIFFAUT 2010-12-30 09:13:54 UTC
My connection configuration is on localhost with default port (3306) with user digikam.
The version of mysql in 5.1. digikam user has all right on digikam and digikamthumbnail databases.

I found the problem.
When digikam create or delete a tag in "tags" table, digikam can update twice all line of "tags" table. And for each line, the move_tagstree trigger was launch.
This trigger delete all lines in "tagstree" table (DELETE FROM TAGSTREE;) and insert new lines (REPLACE ...).
There are 2n (with n is the number lines in tags table, in my case n=745)  DELETE and 2n REPLACE in a transaction but only the last delete and the last REPLACE are necessaries.

If i delete this trigger, i have a very good response time.
I want to propose a patch in the next month (if i have time to do this)

Regards

Olivier PIFFAUT
Comment 3 Marcel Wiesweg 2010-12-30 16:47:47 UTC
CC'ing Holger.
I'm not familiar with these MySQL triggers (solved differently for SQLite)
Comment 4 Quallenauge 2010-12-31 13:15:10 UTC
Hi Olivier,

thanks for your investigation of the problem. I can reproduce the problem in theory and I'm fine with a patch from you which deletes the trigger and
to move the trigger logic to the responsible function when moving a tag to another position within the tag tree.

:)
Comment 5 Francesco Riosa 2011-06-28 19:42:54 UTC
fixed in 2.0.0-rc