Solving the ticket MatmaRex mentioned (T20493) would remove the 5,000 limitation and address several other major tech debt in our databases. It's on the roadmap of the database work (T297633) and I hope to start it later in this year or early next. It will take a while but we will get there and the problem is on our radar.
HTH