I tried to use 'list[<step>]' to show the plan after each optimizer step, but I found that the intermediate plan did not change no matter what value of 'step' is.
The procedures I take is as follows:
1): 'sql> debug SELECT COUNT(*) from customer;' to enter the debugger
2): use 'next' commands several times to enter into the body of the MAL plan.
3): use 'optimizer' command to show the effectiveness of optimizer steps:
========================================================
user.s6_1[ 0] optimizer.SQLgetstatistics actions= 3 time=19 usec
user.s6_1[ 1] inline actions= 0 time=3 usec
user.s6_1[ 2] remap actions= 0 time=2 usec
user.s6_1[ 3] costModel actions= 1 time=1 usec
user.s6_1[ 4] coercions actions= 0 time=1 usec
user.s6_1[ 5] evaluate actions= 0 time=2 usec
user.s6_1[ 6] aliases actions= 0 time=3 usec
user.s6_1[ 7] pushselect actions= 0 time=2 usec
user.s6_1[ 8] mitosis actions= 0 time=4 usec
user.s6_1[ 9] mergetable actions= 0 time=14 usec
user.s6_1[10] deadcode actions= 9 time=4 usec
user.s6_1[11] commonTerms actions= 0 time=3 usec
user.s6_1[12] joinPath actions= 0 time=2 usec
user.s6_1[13] reorder actions= 1 time=8 usec
user.s6_1[14] deadcode actions= 9 time=3 usec
user.s6_1[15] reduce actions=15 time=6 usec
user.s6_1[16] matpack actions= 0 time=1 usec
user.s6_1[17] dataflow actions= 0 time=0 usec
user.s6_1[18] querylog actions= 0 time=1 usec
user.s6_1[19] multiplex actions= 0 time=1 usec
user.s6_1[20] generator actions= 0 time=3 usec
user.s6_1[21] garbageCollector actions= 1 time=3 usec
user.s6_1[22] garbageCollector actions= 1 time=3 usec
=========================================================
From the summary we can see at least deadcode (step 14) and reduce (step 15) DO change the plan (actions=9 and actions=15, respectively.)
4) I would like to see what instructions have changed in detail, so I use commands 'list[13]' and 'list[15]'.
Result of 'list[13]':
======================================================================
function user.s6_1{autoCommit=true}():void; #
X_2 := sql.mvc(); # SQLmvc
X_3:bat[:oid,:oid] := sql.tid(X_2,"sys","customer"); # SQLtid
X_6:bat[:oid,:int] := sql.bind(X_2,"sys","customer","c_custkey",0); # mvc_bind_wrap
(X_9,r1_9) := sql.bind(X_2,"sys","customer","c_custkey",2); # mvc_bind_wrap
X_12:bat[:oid,:int] := sql.bind(X_2,"sys","customer","c_custkey",1); # mvc_bind_wrap
X_14 := sql.delta(X_6,X_9,r1_9,X_12); # DELTAbat
X_15 := algebra.leftfetchjoin(X_3,X_14); # ALGleftfetchjoin
X_16 := aggr.count(X_15); # ALGcount_bat
sql.resultSet("sys.L1","L1","wrd",64,0,7,X_16); # mvc_scalar_value_wrap
end user.s6_1; #
# querylog.define("debug select count(*) from customer;","default_pipe") #
optimizer.deadcode(); # OPTwrapper
optimizer.reduce(); # OPTwrapper
optimizer.matpack(); # OPTwrapper
optimizer.dataflow(); # OPTwrapper
optimizer.querylog(); # OPTwrapper
optimizer.multiplex(); # OPTwrapper
optimizer.generator(); # OPTwrapper
optimizer.garbageCollector(); # OPTwrapper
#optimizer.SQLgetstatistics actions= 3 time=19 usec #
#inline actions= 0 time=3 usec #
#remap actions= 0 time=2 usec #
#costModel actions= 1 time=1 usec #
#coercions actions= 0 time=1 usec #
#evaluate actions= 0 time=2 usec #
#aliases actions= 0 time=3 usec #
#pushselect actions= 0 time=2 usec #
#mitosis actions= 0 time=4 usec #
#mergetable actions= 0 time=14 usec #
#deadcode actions= 9 time=4 usec #
#commonTerms actions= 0 time=3 usec #
#joinPath actions= 0 time=2 usec #
#reorder actions= 1 time=8 usec #
========================================================
Result of 'list[15]':
======================================================================
function user.s6_1{autoCommit=true}():void; #
X_2 := sql.mvc(); # SQLmvc
X_3:bat[:oid,:oid] := sql.tid(X_2,"sys","customer"); # SQLtid
X_6:bat[:oid,:int] := sql.bind(X_2,"sys","customer","c_custkey",0); # mvc_bind_wrap
(X_9,r1_9) := sql.bind(X_2,"sys","customer","c_custkey",2); # mvc_bind_wrap
X_12:bat[:oid,:int] := sql.bind(X_2,"sys","customer","c_custkey",1); # mvc_bind_wrap
X_14 := sql.delta(X_6,X_9,r1_9,X_12); # DELTAbat
X_15 := algebra.leftfetchjoin(X_3,X_14); # ALGleftfetchjoin
X_16 := aggr.count(X_15); # ALGcount_bat
sql.resultSet("sys.L1","L1","wrd",64,0,7,X_16); # mvc_scalar_value_wrap
end user.s6_1; #
# querylog.define("debug select count(*) from customer;","default_pipe") #
optimizer.matpack(); # OPTwrapper
optimizer.dataflow(); # OPTwrapper
optimizer.querylog(); # OPTwrapper
optimizer.multiplex(); # OPTwrapper
optimizer.generator(); # OPTwrapper
optimizer.garbageCollector(); # OPTwrapper
#optimizer.SQLgetstatistics actions= 3 time=19 usec #
#inline actions= 0 time=3 usec #
#remap actions= 0 time=2 usec #
#costModel actions= 1 time=1 usec #
#coercions actions= 0 time=1 usec #
#evaluate actions= 0 time=2 usec #
#aliases actions= 0 time=3 usec #
#pushselect actions= 0 time=2 usec #
#mitosis actions= 0 time=4 usec #
#mergetable actions= 0 time=14 usec #
#deadcode actions= 9 time=4 usec #
#commonTerms actions= 0 time=3 usec #
#joinPath actions= 0 time=2 usec #
#reorder actions= 1 time=8 usec #
#deadcode actions= 9 time=3 usec #
#reduce actions=15 time=6 usec #
=========================================================================
My question is, why the above two plans are identical? Also, the plan is exactly the final plan (I use EXPLAIN statement to check that).
Why 'list[<step>]' command does not work? Did I miss something? Thank you very much for your help.
Best,
Wenjian