Not the answer you need?
Register and ask your own question!

Question about sysdate() query

linuxxunillinuxxunil EntrantCurrent User Role Beginner
Server version: 5.6.25-73.1-log Percona Server (GPL), Release 73.1, Revision 07b797f on Centos 6

I tried to upload a 10k screen capture unsuccessfully, but here is my question. when I use the CLI to run the query SELECT sysdate(), SLEEP(5), sysdate(); I get the same time and date to the second. even with a 60 second sleep.

when I manually run successive CLI queries of queries of SELECT sysdate();, I get identical results if run quickly, if I pause between individual queries of about 5 seconds then I get the results I expected to get different values.

Is this because the query is cached?

Comments

  • scott.nemesscott.nemes MySQL Sage Current User Role Patron
    Hi linuxxunil;

    I'm not quite following your exact test case, so if you could just copy/paste your terminal text that would help.

    That aside, I'd check to see if you have sysdate-is-now set to true.

    https://dev.mysql.com/doc/refman/5.6/en/server-options.html#option_mysqld_sysdate-is-now

    -Scott
  • jriverajrivera Percona Support Engineer Percona Staff Role
    Double check you queries:

    I tried to test it but I don't get same results as you explained.
      
    +---------------------+
    | sysdate()           |
    +---------------------+
    | 2015-08-17 22:11:10 |
    +---------------------+
    1 row in set (0.00 sec)
    
    +-----------+
    | sleep(10) |
    +-----------+
    |         0 |
    +-----------+
    1 row in set (10.00 sec)
    
    +---------------------+
    | sysdate()           |
    +---------------------+
    | 2015-08-17 22:11:20 |
    +---------------------+
    1 row in set (0.00 sec)
      
    +-----------------+------------------------------------------------------+
    | @@version       | @@version_comment                                    |
    +-----------------+------------------------------------------------------+
    | 5.6.25-73.1-log | Percona Server (GPL), Release 73.1, Revision 07b797f |
    +-----------------+------------------------------------------------------+
    1 row in set (0.00 sec)
    
    
  • linuxxunillinuxxunil Entrant Current User Role Beginner
    My apologies for not getting back to this topic in a timely fashion. Work has moved me to another task but I will revisit this at a future date.
    .
    Thank you every one for your help, I will revisit this issue.
Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.