Raimund Jacob wrote:

> i am constructing a rather longish join where i want to 
> select distinct 
> rows only. however, i know that the join-rows i collect are distinct 
> within the first two columns (it's a primary key of one of the join 
> partners). many more columns are selected.
> 
> question: can the optimizer tell how much of the query result to test 
> for distinctness ? can i help by providing the information to the 
> optimizer ?

Always the whole result will be tested for distinctness. There is no chance
to tell 'only the first x columns plus column y and z should be checked' -->
therefore no chance to provide this info to the optimizer.

But,
maybe I did not understand your explanation correctly, but you mean
that you do have a result like this (without DISTINCT)

c1  c2  c3    c4
---------------------
a     b     1    2
a     b     7    3
f      s     2    4

and you want to say DISTINCTNESS for c1 and c2, no matter what the rest of
the columns show? 
No, that must be a misunderstanding.

Second try: if you know that two columns are distinct (the primary key) and
you do have
a 1 : 1 -join, then there is no need to say DISTINCT. 

Just an idea (without really catching the problem): could it be helpful to
use a FROM-select
with DISTINCT for one table before joining it with the other (depends on the
join 1:1, 1:n, n:m)?

Elke
SAP Labs Berlin
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to