From: Lars-Erik Bjørk Date: April 29 2009 9:02pm Subject: Re: max() and min() List-Archive: http://lists.mysql.com/falcon/707 Message-Id: MIME-Version: 1.0 Content-Type: text/plain; delsp=yes; format=flowed; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE On Apr 29, 2009, at 4:50 PM, Kevin Lewis wrote: > Lars-Erik, > > 43668 was re-triages yesterday and assigned to Igor as lead. I jus= t =20 > changed 43669 to Server:Types also and set it to be re-triaged. = =20 > This is a problem for the server folks to solve since the server = =20 > gets the wrong answer on InnoDB and MyISAM if there is no index. It= =20 > needs to be able to handle '02'. Thanks for looking into this. > Thanks Kevin! That was my plan too, I agree that the formatting is a server problem= , =20 I just wanted to be sure that we did not miss to use the index when w= e =20 were supposed to. > Kevin > > Lars-Erik Bj=F8rk wrote: >> Hi all! >> Does anyone know how the server decided witch technique to use to = =20 >> get the max() min() values from the engine? (select max(c1) from t= 1) >> 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= =20 >> MIN() for YEAR values >> I have concluded that bug#43668 is a server bug. MyISAM and InnoDB= =20 >> implements a handler function called ::index_last that finds the = =20 >> last value in the index directly, and therefore the engines only = =20 >> return one row to the server. Falcon does not implement this, and = =20 >> does not use the index and returns all the rows to the server. The= =20 >> server then makes the wrong decision on which YEAR-value that is = =20 >> the biggest. I have confirmed this by testing for the other engine= s =20 >> without having an index on the YEAR field, in which case we also = =20 >> get the wrong result. (f. ex 99 > 01). >> Bug#43669 is less important. Falcon returns different number of = =20 >> digits when asked for the min() value. F. ex InnoDB and MyISAM = =20 >> returns '2', whereas Falcon returns '02'. The same case is =20 >> happening here, the index is used by the other engines, but not by= =20 >> Falcon. If we don't use an index for the other engines either, the= y =20 >> also return the "wrong" number of digits. >> The strange thing here is that Falcon seems to implement the =20 >> handler functions used by the other engines, i.e ::index_first, so= =20 >> I am not sure why the index is not used here. >> Does anyone know how the server asks Falcon which technique to use= ? =20 >> Is there some flag returned by Falcon for this? Does the same flag= =20 >> cover both max() and min()? >> Best, >> Lars-Erik