Bug #60811 | slow timezone functions | ||
---|---|---|---|
Submitted: | 8 Apr 2011 23:41 | Modified: | 10 Apr 2011 9:29 |
Reporter: | Steven Barre | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: General | Severity: | S5 (Performance) |
Version: | 5.0.93, 5.5.12, 5.0.77-4.el5_5.4 | OS: | Any (RHEL 5.5, Mac OS X) |
Assigned to: | CPU Architecture: | Any |
[8 Apr 2011 23:41]
Steven Barre
[10 Apr 2011 9:29]
Valeriy Kravchuk
Verified with current 5.0.93 from bzr on Mac OS X: macbook-pro:5.0 openxs$ bin/mysql -uroot test Reading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.0.93-debug Source distribution Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> SET time_zone = 'US/Central'; SELECT BENCHMARK( 1000000, FROM_UNIXTIME( 1302301855)); Query OK, 0 rows affected (0.01 sec) +-------------------------------------------------+ | BENCHMARK( 1000000, FROM_UNIXTIME( 1302301855)) | +-------------------------------------------------+ | 0 | +-------------------------------------------------+ 1 row in set (1.13 sec) mysql> SET time_zone = 'US/Central'; SELECT BENCHMARK( 1000000, FROM_UNIXTIME( 1302301855)); Query OK, 0 rows affected (0.00 sec) +-------------------------------------------------+ | BENCHMARK( 1000000, FROM_UNIXTIME( 1302301855)) | +-------------------------------------------------+ | 0 | +-------------------------------------------------+ 1 row in set (1.13 sec) mysql> SET time_zone = 'SYSTEM'; SELECT BENCHMARK( 1000000, FROM_UNIXTIME( 1302301855)); Query OK, 0 rows affected (0.00 sec) +-------------------------------------------------+ | BENCHMARK( 1000000, FROM_UNIXTIME( 1302301855)) | +-------------------------------------------------+ | 0 | +-------------------------------------------------+ 1 row in set (1.48 sec) mysql> SET time_zone = 'SYSTEM'; SELECT BENCHMARK( 1000000, FROM_UNIXTIME( 1302301855)); Query OK, 0 rows affected (0.00 sec) +-------------------------------------------------+ | BENCHMARK( 1000000, FROM_UNIXTIME( 1302301855)) | +-------------------------------------------------+ | 0 | +-------------------------------------------------+ 1 row in set (1.45 sec)
[10 Apr 2011 9:32]
Valeriy Kravchuk
MySQL 5.5 is also affected: macbook-pro:5.5 openxs$ bin/mysql -uroot testReading table information for completion of table and column names You can turn off this feature to get a quicker startup with -A Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.5.12-debug Source distribution Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> SET time_zone = 'US/Central'; SELECT BENCHMARK( 1000000, FROM_UNIXTIME( 1302301855)); Query OK, 0 rows affected (0.03 sec) +-------------------------------------------------+ | BENCHMARK( 1000000, FROM_UNIXTIME( 1302301855)) | +-------------------------------------------------+ | 0 | +-------------------------------------------------+ 1 row in set (1.12 sec) mysql> SET time_zone = 'US/Central'; SELECT BENCHMARK( 1000000, FROM_UNIXTIME( 1302301855)); Query OK, 0 rows affected (0.00 sec) +-------------------------------------------------+ | BENCHMARK( 1000000, FROM_UNIXTIME( 1302301855)) | +-------------------------------------------------+ | 0 | +-------------------------------------------------+ 1 row in set (1.11 sec) mysql> SET time_zone = 'SYSTEM'; SELECT BENCHMARK( 1000000, FROM_UNIXTIME( 1302301855)); Query OK, 0 rows affected (0.01 sec) +-------------------------------------------------+ | BENCHMARK( 1000000, FROM_UNIXTIME( 1302301855)) | +-------------------------------------------------+ | 0 | +-------------------------------------------------+ 1 row in set (1.43 sec) mysql> SET time_zone = 'SYSTEM'; SELECT BENCHMARK( 1000000, FROM_UNIXTIME( 1302301855)); Query OK, 0 rows affected (0.00 sec) +-------------------------------------------------+ | BENCHMARK( 1000000, FROM_UNIXTIME( 1302301855)) | +-------------------------------------------------+ | 0 | +-------------------------------------------------+ 1 row in set (1.47 sec)
[15 Aug 2020 10:10]
Maxim Turkin
Looks like this bug also affects selects from table by timestamp column mysql> SET time_zone = 'UTC'; mysql> select count(*) from `tablename` where `date` < '2020-08-15 00:00:00'; 1 row in set (0.12 sec) mysql> SET time_zone = 'SYSTEM'; mysql> select count(*) from `tablename` where `date` < '2020-08-15 00:00:00'; 1 row in set (0.33 sec)