Bug 514970

Summary: Create index on ImageTagProperties.property
Product: [Applications] digikam Reporter: Terényi, Balázs <balazs>
Component: Database-ModelsAssignee: Digikam Developers <digikam-bugs-null>
Status: REPORTED ---    
Severity: normal CC: caulier.gilles
Priority: NOR    
Version First Reported In: 8.8.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Terényi, Balázs 2026-01-23 11:27:49 UTC
SUMMARY
Face confirmation is slow on my setup, so I checked what can I do to make it faster. I enabled mysql slow query log, and one query was always over 1s. So I added an index on ImageTagProperties.property column, which made the UI experience much better.

STEPS TO REPRODUCE
1. Work on People tab: tag assigment/confirmation is slow
2. Create the index in the database
3. The UI is much more responsive, tagging is noticeably faster. Didn't experienced any slowdown because of the new index in other workflows of Digikam.

OBSERVED RESULT
Tag confirmation/assignment on the People tab is slow.

EXPECTED RESULT
Tag confirmation/assignment on the People tab is faster.

SOFTWARE/OS VERSIONS
My digikam database engine is mysql on a NAS on gigabit LAN.

ADDITIONAL INFORMATION
MariaDB [digikam]> SELECT tagid, COUNT(*) FROM ImageTagProperties LEFT JOIN Images ON Images.id=ImageTagProperties.imageid  WHERE ImageTagProperties.property='autodetectedFace' AND Images.status=1 GROUP BY tagid;
+-------+----------+
| tagid | COUNT(*) |
+-------+----------+
|     1 |     6652 |
...
|   154 |       87 |
+-------+----------+
20 rows in set (1.34 sec)

MariaDB [digikam]> create index imagetagproperties_property on ImageTagProperties (property(24));
Query OK, 0 rows affected (1.44 sec)
Records: 0  Duplicates: 0  Warnings: 0

MariaDB [digikam]> SELECT tagid, COUNT(*) FROM ImageTagProperties LEFT JOIN Images ON Images.id=ImageTagProperties.imageid  WHERE ImageTagProperties.property='autodetectedFace' AND Images.status=1 GROUP BY tagid;
+-------+----------+
| tagid | COUNT(*) |
+-------+----------+
|     1 |     6652 |
...
|   154 |       87 |
+-------+----------+
20 rows in set (0.92 sec)