A method, computer program, and database system are disclosed for
executing database queries. The database includes a first table (T1)
having a primary key (PK) column and a first correlated value column
(CV1) and a second table (T2) having a foreign key (FK) column related to
the primary key column of the first table and a second correlated value
column (CV2). One implementation of the method includes preparing a
database query for execution based at least in part on application of a
derived constraint rule (DCR) having the form,
(PK=FK).fwdarw.CV.sub.2+C.sub.1.ltoreq.CV.sub.1.ltoreq.CV.sub.2+C.sub.2,
where C.sub.1 and C.sub.2 are constants and ".fwdarw." means "implies,"
to produce an execution plan. Abort steps that are conditioned on changes
in the DCR are also included in the execution plan. The plan is then
executed.