A common practice in pattern recognition is to classify an unknown object by matching its feature vector with all the feature vectors stored in a database. When the number of class types and the set of stored entities are both large, it is essential to speed up the matching process. This can be achieved more effectively by eliminating unlikely candidates, rather than impossible candidates, from the process. We propose two methods for this purpose: one employs multiple trees, while the other employs a sub-vector matching technique. Both approaches use a learning procedure to estimate the optimal value of certain parameters. An online matching is then performed with a combination of the two methods, which matches candidates rapidly without sacrificing accuracy rates. The process is demonstrated by experiments in which we apply the proposed methods to handwriting recognition.