My assumption is that there is a possibility that the optimization may get into a state where it may take a very long time to complete or may even be looping.
So what I would like to explore is under what conditions could the optimizer get into a state where it might loop or make no progress for a very long period of time.
Are you able to try the patch for DERBY-2130 in your environment? https://issues.apache.org/jira/browse/DERBY-2130 At the time that I was wrestling with this problem (years ago, sorry), I was experiencing great instability in optimization times. Sometimes it would run in a few seconds. Sometimes it would take 15 minutes. If you can provide any feedback on whether the DERBY-2130 change alters the behaviors that you see, that would be great! bryan
