Quantcast
Channel: SCN: Message List - SAP Adaptive Server Enterprise (SAP ASE) for Custom Applications
Viewing all articles
Browse latest Browse all 3587

Re: optimize union in ase query

$
0
0

Actually, what happened was he did a 'set option show long'....under the common misconception that it is the same as 'set option show on' but with more detail.......but it is different.   Plus, looking through it, I noted 3 issues:

 

1) Compatibility mode was on....

 

COMPATIBILITY MODE: Invoking the old style optimizer

COMPATIBILITY MODE: Generated the old style AP,

 

 

2) Either there was a plan clause or aqp_load was on....


!! Scans already primed by abstract plans !!

Full query plan specified via Abstract Plan. Skipping Plan Generation

3) Weird, but even for tables with small rows to be returned, we used the large IO pool and prefetching....


Cache Strategy: [
  prefetch=YES
  iosize=16384 Bytes
  bufreplace=LRU

 

....it needs to be run with

 

set switch on 3604  -- or dbcc traceon(3604)

go

set option show on

set option show_missing_stats on

go

 

Also, I am not sure if

 

query 1

union

query 2

union all

query 3

union

query4

 

....is what I was thinking (thinking about it abit)....what is needed is:

 

(query 1

union

query 2)

union all

(query 3

union

query 4)

 

....they are not the same thing.....I think what ASE did given the first was simply do them in order when what we need is the union all of the two halves....


Viewing all articles
Browse latest Browse all 3587

Trending Articles



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