Subject | MasterLink: Empty dataset in master query results in very slow execution in detail query |
---|---|
Author | Daniel Albuschat |
Post date | 2005-11-03T14:39:54Z |
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
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