DERBY-2130 - Optimizer performance slowdown from 10.1 to 10.2

backporting change #1534465 from trunk to 10.10

Patch contributed by Army Brown



git-svn-id: https://svn.apache.org/repos/asf/db/derby/code/branches/10.10@1572351 13f79535-47bb-0310-9956-ffa450edef68