Subject Re: MasterLink: Empty dataset in master query results in very slow execution in
Author Svein Erling Tysvær
Hi Daniel!

I just have two questions:

a) Why do you use add_protocol.id_contact rather than p.id_contact?
It just doesn't seem right when you use an alias and then all of a
sudden refer to the table name rather than the alias.

b) Why do you use "T" and not 'T'.
The delimiter has always been single quotes.

Though I don't know whether this will help you at all,
Set

--- In IBObjects@yahoogroups.com, Daniel Albuschat wrote:
>
> Hello,
>
> I have the following SQL in a detail query that is linked to a
specific master:
>
> Select p.* from add_protocol p left join add_tasks t on
> t.id_protocol = p.id
> where (t.id_protocol is null or t.Done = "T")
>
> The master link is: add_protocol.id_contact=add_contact.id
>
> IB Objects translates this to the following SQL statement when
> automatically adding the master link:
>
> Select p.* from add_protocol p left join add_tasks t on
> t.id_protocol = p.id
> WHERE ( add_protocol.id_contact=? /* MLNK_ID_CONTACT_0 */ )
> AND ( (t.id_protocol is null or t.Done = "T")
> )
>
> This newly created query has the problem that the execution is very
> slow if the parameter for id_contact (MLNK_ID_CONTACT_0) is not set.
> In fact, it is as slow as the original SQL, which returns 350000
> datasets.
>
> Is there any way speed up the execution when the master query is
> EOF?
>
> Thanks,
> Daniel
>
> --
> eat(this); // delicious suicide