1. A method for searching a database using an external program, comprising the steps of: as part of a database update function: replicating a table, including data records stored in the table, from the database to the external program, wherein the external program uses processing resources separate from those of a database manage system that manages the database; adding the table to a list at the database for tables that have been replicated to the external program; at the external program, generating a statistical data item for the replicated data records, wherein the statistical data item represents a distribution of values in an attribute of the replicated table; replicating the statistical data item to the database for use by a query optimizer in the database; capturing changes to the data records in the database; transmitting the captured changes to the external program; updating the statistical data item at the external program according to the changes; replicating the updated statistical data item to the database; in response to a search request: determining whether to dispatch a search to the external program or the database, if choosing the external program, conducting the search at the external program; and if choosing the database, calculating, by the query optimizer, optimal database queries at the database using the replicated statistical data item.