GetFinalSQL causing full table scans with Master/Detail

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
mikeho
Posts: 41
Joined: Thu 11 Nov 2004 21:23
Location: Middle Tennessee USA

GetFinalSQL causing full table scans with Master/Detail

Post by mikeho » Thu 06 Mar 2014 20:46

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.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: GetFinalSQL causing full table scans with Master/Detail

Post by AlexP » Fri 07 Mar 2014 14:10

Hello,

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

mikeho
Posts: 41
Joined: Thu 11 Nov 2004 21:23
Location: Middle Tennessee USA

Re: GetFinalSQL causing full table scans with Master/Detail

Post by mikeho » Fri 07 Mar 2014 15:41

Hello Alex,
When will this be available? Can we get a early preview/beta release?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: GetFinalSQL causing full table scans with Master/Detail

Post by AlexP » Tue 11 Mar 2014 10:24

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

mikeho
Posts: 41
Joined: Thu 11 Nov 2004 21:23
Location: Middle Tennessee USA

Re: GetFinalSQL causing full table scans with Master/Detail

Post by mikeho » Thu 13 Mar 2014 14:13

Alex,
Sent you an email.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: GetFinalSQL causing full table scans with Master/Detail

Post by AlexP » Fri 14 Mar 2014 09:57

The license you have sent has expired in October 2013. Please send a new license number

Post Reply