It happens when we select multiple folder groups for categorisation.
I wish I could give you a benchmark (like saying it happens when you select 20 folders or something like that) but I can't.
The queries are more likely to time out when:
- More than one user is connected
- Other background tasks like Auto Sync or import is also running
- Queries increase in complexity
The SQL queries' complexity can be reduced by assigning categories (or other non-folder tags) to groups of images... This worked for me.
You are right - it is an issue with folder tags...