List:Falcon Storage Engine« Previous MessageNext Message »
From:Lars-Erik Bjørk Date:April 29 2009 10:24am
Subject:max() and min()
View as plain text  
Hi all!

Does anyone know how the server decided witch technique to use to get 
the max() min() values from the engine? (select max(c1) from t1)

I have looked briefly at bugs

* #43668 Falcon returns wrong MAX() value with year(2) type
* #43669 Falcon returns diff. no of digits than other engines with MIN() 
for YEAR values

I have concluded that bug#43668 is a server bug. MyISAM and InnoDB 
implements a handler function called ::index_last that finds the last 
value in the index directly, and therefore the engines only return one 
row to the server. Falcon does not implement this, and does not use the 
index and returns all the rows to the server. The server then makes the 
wrong decision on which YEAR-value that is the biggest. I have confirmed 
this by testing for the other engines without having an index on the 
YEAR field, in which case we also get the wrong result. (f. ex 99 > 01).

Bug#43669 is less important. Falcon returns different number of digits 
when asked for the min() value. F. ex InnoDB and MyISAM returns '2', 
whereas Falcon returns '02'. The same case is happening here, the index 
is used by the other engines, but not by Falcon. If we don't use an 
index for the other engines either, they also return the "wrong" number 
of digits.
The strange thing here is that Falcon seems to implement the handler 
functions used by the other engines, i.e ::index_first, so I am not sure 
why the index is not used here.

Does anyone know how the server asks Falcon which technique to use? Is 
there some flag returned by Falcon for this? Does the same flag cover 
both max() and min()?


max() and min()Lars-Erik Bjørk29 Apr
  • Re: max() and min()Kevin Lewis29 Apr
    • Re: max() and min()Lars-Erik Bjørk29 Apr