Quantcast
Channel: SCN: Message List - SAP Advantage Database Server
Viewing all articles
Browse latest Browse all 997

ADS 11.10.0.24 Performance Issue

$
0
0

I am having an issue with a script that I am running. In the example below, it takes a lot longer to run the query if @InputAccountNumber is equal to 1 instead of null, when I would expect the query to filter the records and be significantly faster.  In contrast, if I set the @InputPostingDate value to be today I don’t see the same slowness issue. 

 

//Create some test data
DECLARE i integer;

TRY
createtable#TEMP ( AccountNumber integer, PostingDate date);
createindex AccountNumber on#TEMP(AccountNumber);
createindex PostingDate on#TEMP(PostingDate);
CATCHALL
deletefrom#TEMP;
ENDTRY;

insertinto#TEMP ( AccountNumber, PostingDate )
values( 1, CURDATE());

i
= 1;

while i < 10 do
insertinto#TEMP ( AccountNumber, PostingDate )
select AccountNumber + 1, PostingDate + 1
from#TEMP;

i
= i + 1;
endwhile;

selectcount(*)from#TEMP


//Run the script to test the issue

DECLARE@InputAccountNumber integer;
DECLARE@InputPostingDate date;

@InputPostingDate =null;
@InputAccountNumber = 1;

select*
from#TEMP
where(@InputAccountNumber isnullor AccountNumber =@InputAccountNumber )
and(@InputPostingDate isnullor PostingDate <=@InputPostingDate )


Viewing all articles
Browse latest Browse all 997

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>