ASA 7.04.3396

We have three tables : Documents, DocItems, Doctypes

Documents has pkey with two columns : Doctype, Docnumber
Documents has foreign key to Doctypes : Doctype = Doctype
DocItems has pkey with three columns : Doctype, Docnumber,
ItemId
DocItems has foreign key to Documents : Doctype = Doctype
and Docnumber and Docnumber

Our sql is like :
select Docitems.* , Documents.datedoc
from Docitems join Documents
where Documents.datedoc between date1 and date2

We found in iSql query plan that query optimezer use
Documents foreign key instead primary key to scroll through
Documents

If we change join clause and add text : .. on
Docitems.Doctype = Documents.Doctype and Docitems.Docnumber
= Documents.Docnumber
than query optimezer work fine.

Ok we could use sintax with "join .. on " but it was work
fine on version Asa 6.x.

Also we found in 3396ebf readme.txt :
=================(Build #3299 - Engineering Case
#272834)=================

The optimizer could have chosen a query plan that was less
than optimal,
if it used unique indexes, for which one or two columns had
no matching
predicates This was due to an incorrect computation of the
estimated
number of rows for an intermediate result. This has now been
fixed.

Is it in some corelation ?
p.s.
This is not only one situation where we detect this problem.
In several databases and at differnt users. Above
construction is simple version of database model.