Subject | Re: [firebird-support] Re: Master-Detail query help, please... :) |
---|---|
Author | hobbit |
Post date | 2005-09-29T18:13:22Z |
> Greg wroteThe disctinct will only have to work with the subset of data returned
>> SELECT distinct(M.*)
>> FROM TableChild C
>> JOIN TableMaster M ON M.MID = C.MID
>> WHERE C.SomeValue IN (A, B)
> The problem with SELECT distinct(M.*) is that it is very slow since
> all columns in M will be considered when evaluating distinctness (is
> that even a word??).
>
> If I could do
> SELECT distinct(M.MID), M.*
> then we might be OK, but DISTINCT always works on the full set of
> data...
from the join with its child table, so its actually quite effecient
(unless of course the join returns most of the data, which kind of
defeats the point). In the tests I did before answering you, I was
getting sub second results on 300000 records.
Gary