From: hsv Date: October 16 2012 5:38pm Subject: Re: mysql logs query with indexes used to the slow-log and not logging if there is index in reverse order List-Archive: http://lists.mysql.com/mysql/228420 Message-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" >>>> 2012/10/16 12:57 -0400, Michael Dykman >>>> your now() statement is getting executed for every row on the select. try ptting the phrase up front as in: set @ut= unix_timestamp(now()) and then use that in your statement. <<<<<<<< Quote: Functions that return the current date or time each are evaluated only once per query at the start of query execution. This means that multiple references to a function such as NOW() within a single query always produce the same result. (For our purposes, a single query also includes a call to a stored program (stored routine, trigger, or event) and all subprograms called by that program.) This principle also applies to CURDATE(), CURTIME(), UTC_DATE(), UTC_TIME(), UTC_TIMESTAMP(), and to any of their synonyms.