A database query optimizer for a computer system having dynamically configurable
logical partitions generates an optimized query strategy which is dependent on
a logical partition configuration. When the query is executed, the configuration
of the logical partition in which the query is executed is compared to the logical
partition configuration for which the query was optimized. If the configurations
are different, a new query can be automatically generated. Optimizing database
queries to the current system configuration of a dynamic, logically partitioned
system potentially offers greater efficiency in the execution of database queries
for complex, logically partitioned systems.