A method and apparatus provides for the extraction of environment
information from a target database system. The environment information
includes at least one of cost-related information and random sample
statistics. The cost-related information and/or random sample statistics
are imported to a test system, where the cost-related information and/or
random sample statistics are used in query plan analysis by an optimizer.