Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.19 KB | None | 0 0
  1. MySQL [(none)]> use test;
  2. Database changed
  3. MySQL [test]> CREATE TABLE tr2 (
  4. -> id varchar(10) COLLATE latin1_bin NOT NULL,
  5. -> c1 varchar(10) COLLATE latin1_bin DEFAULT NULL,
  6. -> PRIMARY KEY (id)
  7. -> ) ENGINE=MyISAM;
  8. Query OK, 0 rows affected (0.00 sec)
  9.  
  10. MySQL [test]>
  11. MySQL [test]> insert into tr2 values ('a', 'a'), ('b', 'b'), ('c', 'c'), ('d', 'd');
  12. Query OK, 4 rows affected (0.00 sec)
  13. Records: 4 Duplicates: 0 Warnings: 0
  14.  
  15. MySQL [test]> analyze table tr2;
  16. +----------+---------+----------+----------+
  17. | Table | Op | Msg_type | Msg_text |
  18. +----------+---------+----------+----------+
  19. | test.tr2 | analyze | status | OK |
  20. +----------+---------+----------+----------+
  21. 1 row in set (0.00 sec)
  22.  
  23. MySQL [test]> explain select c1 from tr2 where id between 'b' and 'c';
  24. +----+-------------+-------+-------+---------------+---------+---------+------+------+-----------------------+
  25. | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
  26. +----+-------------+-------+-------+---------------+---------+---------+------+------+-----------------------+
  27. | 1 | SIMPLE | tr2 | range | PRIMARY | PRIMARY | 12 | NULL | 1 | Using index condition |
  28. +----+-------------+-------+-------+---------------+---------+---------+------+------+-----------------------+
  29. 1 row in set (0.00 sec)
  30.  
  31. MySQL [test]> explain update tr2 set c1='A' where id between 'b' and 'c';
  32. +----+-------------+-------+-------+---------------+---------+---------+-------+------+-------------+
  33. | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
  34. +----+-------------+-------+-------+---------------+---------+---------+-------+------+-------------+
  35. | 1 | SIMPLE | tr2 | range | PRIMARY | PRIMARY | 12 | const | 1 | Using where |
  36. +----+-------------+-------+-------+---------------+---------+---------+-------+------+-------------+
  37. 1 row in set (0.00 sec)
  38.  
  39. MySQL [test]> create database test2;
  40. Query OK, 1 row affected (0.00 sec)
  41.  
  42. MySQL [test]> use test;2
  43. Database changed
  44. -> \c
  45. MySQL [test]> use test2;
  46. Database changed
  47. MySQL [test2]>
  48. MySQL [test2]> CREATE TABLE tr2 (
  49. -> id varchar(10) COLLATE latin1_bin NOT NULL,
  50. -> c1 varchar(10) COLLATE latin1_bin DEFAULT NULL,
  51. -> PRIMARY KEY (id)
  52. -> ) ENGINE=innodb DEFAULT CHARSET=latin1 COLLATE=latin1_bin;
  53. Query OK, 0 rows affected (0.02 sec)
  54.  
  55. MySQL [test2]>
  56. MySQL [test2]> insert into tr2 values
  57. -> ('A','a'),
  58. -> ('B','b'),
  59. -> ('c','X'),
  60. -> ('d','X'),
  61. -> ('e','e'),
  62. -> ('f','e');
  63. Query OK, 6 rows affected (0.00 sec)
  64. Records: 6 Duplicates: 0 Warnings: 0
  65.  
  66. MySQL [test2]>
  67. MySQL [test2]> analyze table tr2;
  68. +-----------+---------+----------+----------+
  69. | Table | Op | Msg_type | Msg_text |
  70. +-----------+---------+----------+----------+
  71. | test2.tr2 | analyze | status | OK |
  72. +-----------+---------+----------+----------+
  73. 1 row in set (0.02 sec)
  74.  
  75. MySQL [test2]>
  76. MySQL [test2]> explain select c1 from tr2 where id between 'b' and 'c';
  77. +----+-------------+-------+-------+---------------+---------+---------+------+------+-------------+
  78. | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
  79. +----+-------------+-------+-------+---------------+---------+---------+------+------+-------------+
  80. | 1 | SIMPLE | tr2 | range | PRIMARY | PRIMARY | 12 | NULL | 1 | Using where |
  81. +----+-------------+-------+-------+---------------+---------+---------+------+------+-------------+
  82. 1 row in set (0.00 sec)
  83.  
  84. MySQL [test2]> explain update tr2 set c1='A' where id between 'b' and 'c';
  85. +----+-------------+-------+-------+---------------+---------+---------+-------+------+-------------+
  86. | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
  87. +----+-------------+-------+-------+---------------+---------+---------+-------+------+-------------+
  88. | 1 | SIMPLE | tr2 | range | PRIMARY | PRIMARY | 12 | const | 1 | Using where |
  89. +----+-------------+-------+-------+---------------+---------+---------+-------+------+-------------+
  90. 1 row in set (0.00 sec)
  91.  
  92. MySQL [test2]> create database test3;
  93. ERROR 2006 (HY000): MySQL server has gone away
  94. No connection. Trying to reconnect...
  95. ERROR 1049 (42000): Unknown database 'test2'
  96. ERROR: Can't connect to the server
  97.  
  98. unknown [test2]> use test3;
  99. No connection. Trying to reconnect...
  100. Connection id: 2
  101. Current database: *** NONE ***
  102.  
  103. ERROR 1049 (42000): Unknown database 'test3'
  104. MySQL [(none)]> use test;
  105. Database changed
  106. MySQL [test]> create database test3;
  107. Query OK, 1 row affected (0.00 sec)
  108.  
  109. MySQL [test]> use test3;
  110. Database changed
  111. MySQL [test3]> CREATE TABLE tr2 (
  112. -> id varchar(10) COLLATE latin1_bin NOT NULL,
  113. -> c1 varchar(10) COLLATE latin1_bin DEFAULT NULL,
  114. -> PRIMARY KEY (id)
  115. -> ) ENGINE=rocksdb DEFAULT CHARSET=latin1 COLLATE=latin1_bin;
  116. Query OK, 0 rows affected (0.10 sec)
  117.  
  118. MySQL [test3]>
  119. MySQL [test3]> insert into tr2 values
  120. -> ('A','a'),
  121. -> ('B','b'),
  122. -> ('c','X'),
  123. -> ('d','X'),
  124. -> ('e','e'),
  125. -> ('f','e');
  126. ERROR 1105 (HY000): Can't execute updates on master with binlog_format != ROW.
  127. MySQL [test3]>
  128. MySQL [test3]> analyze table tr2;
  129. +-----------+---------+----------+----------+
  130. | Table | Op | Msg_type | Msg_text |
  131. +-----------+---------+----------+----------+
  132. | test3.tr2 | analyze | status | OK |
  133. +-----------+---------+----------+----------+
  134. 1 row in set (0.00 sec)
  135.  
  136. MySQL [test3]>
  137. MySQL [test3]> explain select c1 from tr2 where id between 'b' and 'c';
  138. +----+-------------+-------+-------+---------------+---------+---------+------+------+-------------+
  139. | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
  140. +----+-------------+-------+-------+---------------+---------+---------+------+------+-------------+
  141. | 1 | SIMPLE | tr2 | range | PRIMARY | PRIMARY | 12 | NULL | 1 | Using where |
  142. +----+-------------+-------+-------+---------------+---------+---------+------+------+-------------+
  143. 1 row in set (0.00 sec)
  144.  
  145. MySQL [test3]> explain update tr2 set c1='A' where id between 'b' and 'c';
  146. +----+-------------+-------+-------+---------------+---------+---------+-------+------+-------------+
  147. | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
  148. +----+-------------+-------+-------+---------------+---------+---------+-------+------+-------------+
  149. | 1 | SIMPLE | tr2 | range | PRIMARY | PRIMARY | 12 | const | 1 | Using where |
  150. +----+-------------+-------+-------+---------------+---------+---------+-------+------+-------------+
  151. 1 row in set (0.01 sec)
  152.  
  153. MySQL [test3]>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement