CM# database optimalization