Server IP : 185.86.78.101 / Your IP : 216.73.216.213 Web Server : Apache System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /www/server/mysql/mysql-test/r/ |
Upload File : |
CREATE TABLE t1 ( id int NOT NULL auto_increment PRIMARY KEY, b int NOT NULL, c datetime NOT NULL, INDEX idx_b(b), INDEX idx_c(c) ) ENGINE=InnoDB; CREATE TABLE t2 ( b int NOT NULL auto_increment PRIMARY KEY, c datetime NOT NULL ) ENGINE= MyISAM; INSERT INTO t2(c) VALUES ('2007-01-01'); INSERT INTO t2(c) SELECT c FROM t2; INSERT INTO t2(c) SELECT c FROM t2; INSERT INTO t2(c) SELECT c FROM t2; INSERT INTO t2(c) SELECT c FROM t2; INSERT INTO t2(c) SELECT c FROM t2; INSERT INTO t2(c) SELECT c FROM t2; INSERT INTO t2(c) SELECT c FROM t2; INSERT INTO t2(c) SELECT c FROM t2; INSERT INTO t2(c) SELECT c FROM t2; INSERT INTO t2(c) SELECT c FROM t2; INSERT INTO t1(b,c) SELECT b,c FROM t2; UPDATE t2 SET c='2007-01-02'; INSERT INTO t1(b,c) SELECT b,c FROM t2; UPDATE t2 SET c='2007-01-03'; INSERT INTO t1(b,c) SELECT b,c FROM t2; set @@sort_buffer_size=8192; Warnings: Warning 1292 Truncated incorrect sort_buffer_size value: '8192' SELECT COUNT(*) FROM t1; COUNT(*) 3072 EXPLAIN SELECT COUNT(*) FROM t1 FORCE INDEX(idx_b, idx_c) WHERE (c >= '2007-01-02' AND c <= '2007-01-03') OR b >= 1; id select_type table partitions type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 NULL index_merge idx_b,idx_c idx_c,idx_b 5,4 NULL # 100.00 Using sort_union(idx_c,idx_b); Using where Warnings: Note 1003 /* select#1 */ select count(0) AS `COUNT(*)` from `test`.`t1` FORCE INDEX (`idx_c`) FORCE INDEX (`idx_b`) where (((`test`.`t1`.`c` >= '2007-01-02') and (`test`.`t1`.`c` <= '2007-01-03')) or (`test`.`t1`.`b` >= 1)) SELECT COUNT(*) FROM t1 FORCE INDEX(idx_b, idx_c) WHERE (c >= '2007-01-02' AND c <= '2007-01-03') OR b >= 1; COUNT(*) 3072 set @@sort_buffer_size=default; DROP TABLE t1,t2; set optimizer_switch='semijoin=off'; set optimizer_switch='materialization=off'; CREATE TABLE t1 (topic BIGINT NOT NULL DEFAULT 0); SET @@session.sort_buffer_size=32768; SELECT * from t1 WHERE topic IN (SELECT topic FROM t1 GROUP BY topic HAVING topic < 2000) LIMIT 2 ; topic 1370 1369 SET @@session.sort_buffer_size=DEFAULT; drop table t1; set optimizer_switch=default;