Hi,
I have one "master" table and one "child" table. Each record of the master
table is connected to mutiple records of the child table by field
"masterid".
Question is - is the query with user-defined function faster than without
it?
1. select m.*,
(select count(*) from child c1 where c1.masterid = m.masterid and postind =
'Y') ,
(select count(*) from child c2 where c2.masterid = m.masterid and postind =
'X')
from master m where m.masterid = 235423
2. select m.*, GetNrOfChild(m.masterid, 'Y'), GetNrOfChild(m.masterid, 'X')
from master m where m.masterid = 235423
Of course, "GetNrOfChild" is user-defined function that is basically (select
count(*) from child c2 where c2.masterid = <something> and postind =
<something_else>)
Thx in advance
Armin