Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MySQL [(none)]> use test;
- Database changed
- MySQL [test]> CREATE TABLE tr2 (
- -> id varchar(10) COLLATE latin1_bin NOT NULL,
- -> c1 varchar(10) COLLATE latin1_bin DEFAULT NULL,
- -> PRIMARY KEY (id)
- -> ) ENGINE=MyISAM;
- Query OK, 0 rows affected (0.00 sec)
- MySQL [test]>
- MySQL [test]> insert into tr2 values ('a', 'a'), ('b', 'b'), ('c', 'c'), ('d', 'd');
- Query OK, 4 rows affected (0.00 sec)
- Records: 4 Duplicates: 0 Warnings: 0
- MySQL [test]> analyze table tr2;
- +----------+---------+----------+----------+
- | Table | Op | Msg_type | Msg_text |
- +----------+---------+----------+----------+
- | test.tr2 | analyze | status | OK |
- +----------+---------+----------+----------+
- 1 row in set (0.00 sec)
- MySQL [test]> explain select c1 from tr2 where id between 'b' and 'c';
- +----+-------------+-------+-------+---------------+---------+---------+------+------+-----------------------+
- | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
- +----+-------------+-------+-------+---------------+---------+---------+------+------+-----------------------+
- | 1 | SIMPLE | tr2 | range | PRIMARY | PRIMARY | 12 | NULL | 1 | Using index condition |
- +----+-------------+-------+-------+---------------+---------+---------+------+------+-----------------------+
- 1 row in set (0.00 sec)
- MySQL [test]> explain update tr2 set c1='A' where id between 'b' and 'c';
- +----+-------------+-------+-------+---------------+---------+---------+-------+------+-------------+
- | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
- +----+-------------+-------+-------+---------------+---------+---------+-------+------+-------------+
- | 1 | SIMPLE | tr2 | range | PRIMARY | PRIMARY | 12 | const | 1 | Using where |
- +----+-------------+-------+-------+---------------+---------+---------+-------+------+-------------+
- 1 row in set (0.00 sec)
- MySQL [test]> create database test2;
- Query OK, 1 row affected (0.00 sec)
- MySQL [test]> use test;2
- Database changed
- -> \c
- MySQL [test]> use test2;
- Database changed
- MySQL [test2]>
- MySQL [test2]> CREATE TABLE tr2 (
- -> id varchar(10) COLLATE latin1_bin NOT NULL,
- -> c1 varchar(10) COLLATE latin1_bin DEFAULT NULL,
- -> PRIMARY KEY (id)
- -> ) ENGINE=innodb DEFAULT CHARSET=latin1 COLLATE=latin1_bin;
- Query OK, 0 rows affected (0.02 sec)
- MySQL [test2]>
- MySQL [test2]> insert into tr2 values
- -> ('A','a'),
- -> ('B','b'),
- -> ('c','X'),
- -> ('d','X'),
- -> ('e','e'),
- -> ('f','e');
- Query OK, 6 rows affected (0.00 sec)
- Records: 6 Duplicates: 0 Warnings: 0
- MySQL [test2]>
- MySQL [test2]> analyze table tr2;
- +-----------+---------+----------+----------+
- | Table | Op | Msg_type | Msg_text |
- +-----------+---------+----------+----------+
- | test2.tr2 | analyze | status | OK |
- +-----------+---------+----------+----------+
- 1 row in set (0.02 sec)
- MySQL [test2]>
- MySQL [test2]> explain select c1 from tr2 where id between 'b' and 'c';
- +----+-------------+-------+-------+---------------+---------+---------+------+------+-------------+
- | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
- +----+-------------+-------+-------+---------------+---------+---------+------+------+-------------+
- | 1 | SIMPLE | tr2 | range | PRIMARY | PRIMARY | 12 | NULL | 1 | Using where |
- +----+-------------+-------+-------+---------------+---------+---------+------+------+-------------+
- 1 row in set (0.00 sec)
- MySQL [test2]> explain update tr2 set c1='A' where id between 'b' and 'c';
- +----+-------------+-------+-------+---------------+---------+---------+-------+------+-------------+
- | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
- +----+-------------+-------+-------+---------------+---------+---------+-------+------+-------------+
- | 1 | SIMPLE | tr2 | range | PRIMARY | PRIMARY | 12 | const | 1 | Using where |
- +----+-------------+-------+-------+---------------+---------+---------+-------+------+-------------+
- 1 row in set (0.00 sec)
- MySQL [test2]> create database test3;
- ERROR 2006 (HY000): MySQL server has gone away
- No connection. Trying to reconnect...
- ERROR 1049 (42000): Unknown database 'test2'
- ERROR: Can't connect to the server
- unknown [test2]> use test3;
- No connection. Trying to reconnect...
- Connection id: 2
- Current database: *** NONE ***
- ERROR 1049 (42000): Unknown database 'test3'
- MySQL [(none)]> use test;
- Database changed
- MySQL [test]> create database test3;
- Query OK, 1 row affected (0.00 sec)
- MySQL [test]> use test3;
- Database changed
- MySQL [test3]> CREATE TABLE tr2 (
- -> id varchar(10) COLLATE latin1_bin NOT NULL,
- -> c1 varchar(10) COLLATE latin1_bin DEFAULT NULL,
- -> PRIMARY KEY (id)
- -> ) ENGINE=rocksdb DEFAULT CHARSET=latin1 COLLATE=latin1_bin;
- Query OK, 0 rows affected (0.10 sec)
- MySQL [test3]>
- MySQL [test3]> insert into tr2 values
- -> ('A','a'),
- -> ('B','b'),
- -> ('c','X'),
- -> ('d','X'),
- -> ('e','e'),
- -> ('f','e');
- ERROR 1105 (HY000): Can't execute updates on master with binlog_format != ROW.
- MySQL [test3]>
- MySQL [test3]> analyze table tr2;
- +-----------+---------+----------+----------+
- | Table | Op | Msg_type | Msg_text |
- +-----------+---------+----------+----------+
- | test3.tr2 | analyze | status | OK |
- +-----------+---------+----------+----------+
- 1 row in set (0.00 sec)
- MySQL [test3]>
- MySQL [test3]> explain select c1 from tr2 where id between 'b' and 'c';
- +----+-------------+-------+-------+---------------+---------+---------+------+------+-------------+
- | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
- +----+-------------+-------+-------+---------------+---------+---------+------+------+-------------+
- | 1 | SIMPLE | tr2 | range | PRIMARY | PRIMARY | 12 | NULL | 1 | Using where |
- +----+-------------+-------+-------+---------------+---------+---------+------+------+-------------+
- 1 row in set (0.00 sec)
- MySQL [test3]> explain update tr2 set c1='A' where id between 'b' and 'c';
- +----+-------------+-------+-------+---------------+---------+---------+-------+------+-------------+
- | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
- +----+-------------+-------+-------+---------------+---------+---------+-------+------+-------------+
- | 1 | SIMPLE | tr2 | range | PRIMARY | PRIMARY | 12 | const | 1 | Using where |
- +----+-------------+-------+-------+---------------+---------+---------+-------+------+-------------+
- 1 row in set (0.01 sec)
- MySQL [test3]>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement