List:General Discussion« Previous MessageNext Message »
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
View as plain text  
>>>> 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
<file:///C:/Program%20Files/MySQL/MySQL%20Server%205.5/HELP/functions.html#function_now>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
<file:///C:/Program%20Files/MySQL/MySQL%20Server%205.5/HELP/functions.html#function_curdate>CURDATE(),
<file:///C:/Program%20Files/MySQL/MySQL%20Server%205.5/HELP/functions.html#function_curtime>CURTIME(),
<file:///C:/Program%20Files/MySQL/MySQL%20Server%205.5/HELP/functions.html#function_utc-date>UTC_DATE(),
<file:///C:/Program%20Files/MySQL/MySQL%20Server%205.5/HELP/functions.html#function_utc-time>UTC_TIME(),
<file:///C:/Program%20Files/MySQL/MySQL%20Server%205.5/HELP/functio
ns.html#function_utc-timestamp>UTC_TIMESTAMP(), and to any of their synonyms. 


Thread
mysql logs query with indexes used to the slow-log and not logging ifthere is index in reverse orderspameden15 Oct
  • Re: mysql logs query with indexes used to the slow-log and notlogging if there is index in reverse orderspameden15 Oct
  • RE: mysql logs query with indexes used to the slow-log and notlogging if there is index in reverse orderRick James15 Oct
    • Re: mysql logs query with indexes used to the slow-log and notlogging if there is index in reverse orderspameden15 Oct
      • Re: mysql logs query with indexes used to the slow-log and notlogging if there is index in reverse orderspameden15 Oct
        • RE: mysql logs query with indexes used to the slow-log and notlogging if there is index in reverse orderRick James15 Oct
          • Re: mysql logs query with indexes used to the slow-log and notlogging if there is index in reverse orderspameden15 Oct
            • Re: mysql logs query with indexes used to the slow-log and not loggingif there is index in reverse orderShawn Green16 Oct
              • Re: mysql logs query with indexes used to the slow-log and notlogging if there is index in reverse orderspameden16 Oct
                • Re: mysql logs query with indexes used to the slow-log and notlogging if there is index in reverse orderMichael Dykman16 Oct
                  • Re: mysql logs query with indexes used to the slow-log and notlogging if there is index in reverse orderspameden16 Oct
                  • Re: mysql logs query with indexes used to the slow-log and notlogging if there is index in reverse orderhsv16 Oct
                    • Re: mysql logs query with indexes used to the slow-log and notlogging if there is index in reverse orderspameden16 Oct
      • RE: mysql logs query with indexes used to the slow-log and notlogging if there is index in reverse orderRick James15 Oct