Hi I have just imported a 4 million images bespoke solution into Xen Gallery through a custom CLI importer I wrote. The import was the easy part, but now I am having a hard time. For starters, the rebuild thumbnails has been running for two days now and keeps hanging in between. I am going to write a CLI function for that now. Talking about rebuild, how does one cancel a rebuild process which is queued in deferred? I cancelled the thumbnail creation rebuild process and deleted the row from xf_deferred table but the "There are manual rebuild process pending..." link still shows up. How can I clear that? However the main trouble is that the media index and album index is now impossible to open. I have set the past number of days to 1 now, but that does not seem to be helping. I have just only begun to look into the queries and the permission queries seem to be the main culprit. I will dig deeper though... The first thing which showed up was the count(*) queries to count album and media in album and media models. A simple count(album_id) and count(media_id) would utilize the benefit of the primary key index and would be be much faster. I am looking to see how I can optimize things further and make it usable. Will be happy to report back what I do.