Performance problem for retrieving single page views and downloads

Hi,

this is my first post in this forum, so if I missed something, please let me know.

Now back to our problem: we are trying to get exact statistics for single pages and downloads from matomo. As we collect quite a lot of data we set the top 500 grouping as described in
After the top 500 or top 1000 rows, Matomo automatically groups pages, keywords, websites, etc. under the label “Others”; How do I force Matomo to not limit the data?
higher so that none of the data is grouped for the actions tables. This is working fine in perspective of the correct values right now, but it is really slow (up from 30 seconds as we are requesting the last twelve month from now). We tried to set a higher memory for PHP as described, but that doesn’t affect the result too much, as it was already set higher than default.
So our question is, can we speed up these requests or do we have to go the way to directly request the database, as it is described here:
Manual query to calculate Downloads
This is of course not our favorite way, as we would have to grant our application access to the database. And of course if the database structure changes, we will need to adjust the requests. But anyway it seems so much faster (one request is way below 1s and we would need twelve for each of the last 12 month).
There are some posts that sound a quite similar to our problem in terms of performance, like this one
Display pages for full year with a lot of data
but I think segmentation wouldn’t be helpful for our use case and they ended up with a direct database query anyway.
Maybe someone experiencing a similar problem can help me a little, to find the best way, as I am quite new to Matomo.

Best Regards,
Matthias