Bug 370356

Summary: very slow when delete photos and albums
Product: [Applications] digikam Reporter: Kirill <kirill_v_b>
Component: Database-MysqlAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles, metzpinguin, riverheart201
Priority: NOR    
Version: 5.2.0   
Target Milestone: ---   
Platform: macOS (DMG)   
OS: macOS   
Latest Commit: Version Fixed In: 7.9.0
Sentry Crash Report:

Description Kirill 2016-10-09 17:08:26 UTC
After right-click on empty or non-empty album or photo and click Delete Album or Move to Trash procedure of album or photo deleting take 2 to 5 minutes.

Reproducible: Always

Steps to Reproduce:
1. Right-click on Album
2. Click Delete Album
3. Click  Delete button (or Move to trash button, does not matter) 

Actual Results:  
Deleting takes from 2 to 5 minutes

Expected Results:  
Deleting should take 1 second or less

I am using MySQL DB on remote server (local home network, 20 meters between iMac and server) for digikam databases, wired connection at 1 Gb/s between my iMac and DB server.
39000+ photos
Comment 1 Kirill 2016-10-10 08:41:56 UTC
Additional info. 

1. Photos collection located at mounted network disk.

2. 2-5 minutes for deleting photos and folder only in case if collection located in root of Albums. Like this :

                                                                     Albums
                                                                           |
                                                                            -->My Collection 
                                                                                         |
                                                                                          -->Photo1
                                                                                         |
                                                                                          -->Photo2
                                                                                         |
                                                                                          -->etc...

But, if we place all folders 1 level deep (see schema bellow) from root - everything will start working very fast as expected:

                                                                    Albums
                                                                           |
                                                                            --> My Collection 
                                                                                         |
                                                                                          -->All photos                                                                                                  
                                                                                                      |
                                                                                                       -->Photo1
                                                                                                      |
                                                                                                       -->Photo2
                                                                                                      |
                                                                                                       -->etc...
Comment 2 caulier.gilles 2017-10-22 12:12:26 UTC
A new fresh 5.8.0 pre-release PKG installer for MacOS was just rebuild for testing and is available here :

https://drive.google.com/drive/folders/0BzeiVr-byqt5Y0tIRWVWelRJenM

Please confirm if the problem remains with this version. 
Thanks in advance

Gilles Caulier
Comment 3 Danny 2020-01-30 21:46:21 UTC
On Reddit we are discussing the possibility that slow delete performance may be related to the size limit option. Performance seems to be greatly increased.

Is it possible that every delete operation iterates the entire contents of the recycling bin to determine the size, or there's some other slow code path that happens through that option?

I also noticed that file move operations are similarly much faster with the option unchecked, so this issue could be bigger than it seems.

This may be related to #402704
Comment 4 caulier.gilles 2020-01-31 04:59:28 UTC
402704 is about dolphin and Plasma trash.

digiKam do not use desktop trash which is relevant of KIO and is not portable under MAcOS and Windows. 

Each collection has a hidden trash folder which is located on top of collection directory. DK trash is has the same place than collection so deleting collection files is just a move on same file system. This is perfect for remote or removable collections.

Gillees Caulier
Comment 5 Maik Qualmann 2020-01-31 09:38:27 UTC
As Gilles writes, it is a quick file move because the digiKam trash is on the same partition as the collection. However, we have to do something in the database after each move, the file must be marked as deleted (trashed), etc. Depending on the database, this takes a little time. I no longer find the deletion process slow. MySQL is quite a bit faster here.

Maik
Comment 6 caulier.gilles 2020-08-01 21:46:13 UTC
digiKam 7.0.0 stable release is now published:

https://www.digikam.org/news/2020-07-19-7.0.0_release_announcement/

We need a fresh feedback on this file using this version.

Best Regards

Gilles Caulier
Comment 7 caulier.gilles 2020-12-18 12:09:32 UTC
https://bugs.kde.org/show_bug.cgi?id=426938

--- Comment #4 from caulier.gilles@gmail.com ---
Hi,

digiKam 7.2.0-beta2 pre-release PKG installer now support BigSur and is
compiled with last stable Qt 5.15.2.

https://files.kde.org/digikam/

Problem still reproducible with this version.

Thanks and happy Christmas in advance

Best Regards

Gilles Caulier