On DSpace 4, we are able index our production repository in 2-3 hours.
We migrated a copy of this database from DSpace 4 to DSpace 6 and then attempted to re-index discovery.
The process ran for 12+ hours and then terminated with a heap error. In that time, only 30,000 of 250,000 items were indexed.
As this was running, I noticed several queries that seemed to take a long time. I attempted to add additional indexes to uuid columns that were identified as foreign keys.