13. The non-transitory computer-readable storage medium of claim 12 further including: using the index to service incoming queries.
12. A non-transitory computer-readable storage medium containing program instructions to be executed on a computer, the program instructions for selecting a set of n-grams for indexing string data in a database management system (DBMS) in relation to resources available to the DBMS, wherein the computer performs the following functions comprising: providing a set of candidate n-grams, each n-gram comprising a sequence of characters; receiving an n-gram space constraint to define an amount “k” of the set of candidate n-grams eligible for a minimal set of n-grams, the n-gram space constraint based on resources available to the DBMS; comparing each of the candidate n-grams from the provided set of candidate n-grams with sample queries and database records to determine a benefit associated with the candidate n-grams in reducing false hits; selecting the minimal set of n-grams, the minimal set of n-grams having a highest total benefit and being subject to the n-gram space constraint; selecting an updated minimal set of n-grams responsive to receiving an updated n-gram space constraint, the updated minimal set of n-grams having a highest total benefit and being subject to the updated n-gram space constraint, wherein the updated minimal set of n-grams consists of no more than “k” n-grams; and generating an index, based on the minimal set of selected n-grams or the updated minimal set of n-grams, that indexes string data contained in the database records.