[Mulgara-general] iTQL
Andrae Muys
andrae at netymon.com
Fri Jan 11 04:12:35 UTC 2008
On 04/01/2008, at 12:18 PM, Hero Modaress wrote:
> In the SQL we have distinct command, how we can use that command in
> the iTQL ?
> I want write a qeury in the iTQL for return all list without any
> repetitious.
iTQL doesn't need a distinct command as mulgara always removes
duplicates by equality.
It is worth noting the distinction between removing duplicates by
equality and removing duplicates by equivalence in that we don't
eliminate any redundancies introduced by UNBOUND results.
As UNBOUND results can only be introduced via disjunction (and even
then, only if the arguments are not union-compatible), you can ignore
this disctiction 99.99% of the time.
So you will never see a result such as:
X | Y
foo bar
foo baz *
foo baz *
fog biq
as the two marked rows are equal, however if you were to ask a query
such as:
select $X $Y from <> where $X <p1> $Y or $X <p2> 'bar';
you could see a result such as:
X | Y
foo UNBOUND *
foo bar **
foo baz **
... ...
fog big
where, if we were pedantic and removing by equivalence, should be
simplified to:
X | Y
foo UNBOUND
fog big
There were plans to implement the fix required to provide the
pedantic result, however the code is:
1) Subtle in its complexity and its interaction with the join code
2) Consequently a fair amount of effort
3) So far unrequested by people actually using disjunctions
So we haven't committed the time required to implement it.
If I remember correctly (and this is a sketchy memory from several
years ago) the estimated complexity was an (Nlog N)^M (for N rows,
and M columns with suspected UNBOUND's) factor on top of the existing
cost of any join - but please don't quote me on it ;).
Anyway most people seem happy with distinct by equality as a simple
and cheap alternative - and hopefully it isn't a problem for you either.
Andrae
--
Andrae Muys
andrae at netymon.com
Senior RDF/SemanticWeb Consultant
Netymon Pty Ltd
--
Andrae Muys
andrae at netymon.com
Senior RDF/SemanticWeb Consultant
Netymon Pty Ltd
More information about the Mulgara-general
mailing list