Page 1 of 1

GetFinalSQL causing full table scans with Master/Detail

Posted: Thu 06 Mar 2014 20:46
by mikeho
When we updated our ODAC to build 9.2.7, we started noticing some screens taking quite a bit longer to open than we previously experienced.

Using dbMonitor, we started seeing where the queries run against the detail tables started having OR ( (DTLFld IS NULL ) AND ( :MSTFld IS NULL ) ) add for each of the linked fields to the master table. This is causing full table scans on huge tables. Here is are some examples of what we now see running:

SELECT T.*
FROM ORDERHDR T
WHERE ( ( LOADNO = :LOADNO ) OR ( ( LOADNO IS NULL ) AND ( :LOADNO IS NULL ) ) )
ORDER BY ORDERID,SHIPID

SELECT T.*
FROM ORDERHDRPASSTHRUS T
WHERE ( ( ORDERID = :ORDERID ) OR ( ( ORDERID IS NULL ) AND ( :ORDERID IS NULL ) ) ) AND ( ( SHIPID = :SHIPID ) OR ( ( SHIPID IS NULL ) AND ( :SHIPID IS NULL ) ) )
ORDER BY ORDERID,SHIPID

TCustomDADataSet.GetFinalSQL is where this code is added. Can the code be smart enough that if the fields are required fields then do not add the IS NULL portion?

Setting LocalMasterDetail = True does not speed up the process since the where clause is no longer there.

Re: GetFinalSQL causing full table scans with Master/Detail

Posted: Fri 07 Mar 2014 14:10
by AlexP
Hello,

We will change this behavior in the next version. It will be optional

Re: GetFinalSQL causing full table scans with Master/Detail

Posted: Fri 07 Mar 2014 15:41
by mikeho
Hello Alex,
When will this be available? Can we get a early preview/beta release?

Re: GetFinalSQL causing full table scans with Master/Detail

Posted: Tue 11 Mar 2014 10:24
by AlexP
Please send us the license number and an e-mail address to alexp*devart*com where I can send you the beta version, also specify the used IDE

Re: GetFinalSQL causing full table scans with Master/Detail

Posted: Thu 13 Mar 2014 14:13
by mikeho
Alex,
Sent you an email.

Re: GetFinalSQL causing full table scans with Master/Detail

Posted: Fri 14 Mar 2014 09:57
by AlexP
The license you have sent has expired in October 2013. Please send a new license number