1. A computer program product for database query optimization, comprising a non-transitory computer usable medium having a computer readable program, wherein the computer readable program, when executed on a computer, causes the computer to: receive a database query; search the database query for a literal term; replace the literal term in the database query with a placeholder term to put the database query in a template form; search a directory for a replacement query that corresponds to the database query in the template form; replace the database query with the replacement query and include the placeholder term in the replacement query; check that the processing of the database query in the template form and the replacement query produces a same number of columns for the replacement query; check that the processing of the database query in the template form and the replacement query produces a same data-types in the columns for the database query and the same data-types in the columns for the replacement query; replace the placeholder term in the replacement query with the corresponding literal term to put the replacement query in an executable format; wherein the replacement query is an optimized substitute for the database query; and running the replacement query instead of the database query to provide query results to a requesting client; wherein the literal term is ignored such that a match is declared even when the database query and the replacement query have non-matching terms.
1. A computer program product for database query optimization, comprising a non-transitory computer usable medium having a computer readable program, wherein the computer readable program, when executed on a computer, causes the computer to: receive a database query; search the database query for a literal term; replace the literal term in the database query with a placeholder term to put the database query in a template form; search a directory for a replacement query that corresponds to the database query in the template form; replace the database query with the replacement query and include the placeholder term in the replacement query; check that the processing of the database query in the template form and the replacement query produces a same number of columns for the replacement query; check that the processing of the database query in the template form and the replacement query produces a same data-types in the columns for the database query and the same data-types in the columns for the replacement query; replace the placeholder term in the replacement query with the corresponding literal term to put the replacement query in an executable format; wherein the replacement query is an optimized substitute for the database query; and running the replacement query instead of the database query to provide query results to a requesting client; wherein the literal term is ignored such that a match is declared even when the database query and the replacement query have non-matching terms. 4. The computer program product of claim 1 , wherein the computer readable program, when executed on the computer, further causes the computer to activate the directory, wherein activating the directory includes receiving an input of the replacement query and a corresponding designated query to the directory, and wherein searching the directory comprises searching for a match between the database query and the designated query.