Guest User

Untitled

a guest
May 20th, 2018
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. MariaDB [test]> show create table t20\G
  2. *************************** 1. row ***************************
  3. Table: t20
  4. Create Table: CREATE TABLE `t20` (
  5. `pk` int(11) NOT NULL,
  6. `a` int(11) DEFAULT NULL,
  7. `b` int(11) DEFAULT NULL,
  8. `c` int(11) DEFAULT NULL,
  9. PRIMARY KEY (`pk`),
  10. KEY `a` (`a`)
  11. ) ENGINE=InnoDB DEFAULT CHARSET=latin1
  12.  
  13.  
  14. MariaDB [test]> set @a=0;
  15. Query OK, 0 rows affected (0.00 sec)
  16.  
  17. MariaDB [test]> truncate table t20;
  18. Query OK, 0 rows affected (0.26 sec)
  19.  
  20. MariaDB [test]> insert into t20 select @a:=@a+1, @a/100, @a/100, @a/100 from seq_1_to_1000;
  21. Query OK, 1000 rows affected (0.36 sec)
  22. Records: 1000 Duplicates: 0 Warnings: 0
  23.  
  24. MariaDB [test]> select count(*) from t20;
  25. +----------+
  26. | count(*) |
  27. +----------+
  28. | 1000 |
  29. +----------+
  30. 1 row in set (0.01 sec)
  31.  
  32. MariaDB [test]> select count(*) from t20 where a=2;
  33. +----------+
  34. | count(*) |
  35. +----------+
  36. | 100 |
  37. +----------+
  38. 1 row in set (0.00 sec)
  39.  
  40. MariaDB [test]> explain delete from t20 where a=2;
  41. +------+-------------+-------+-------+---------------+------+---------+------+------+-------------+
  42. | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
  43. +------+-------------+-------+-------+---------------+------+---------+------+------+-------------+
  44. | 1 | SIMPLE | t20 | range | a | a | 5 | NULL | 100 | Using where |
  45. +------+-------------+-------+-------+---------------+------+---------+------+------+-------------+
  46. 1 row in set (0.00 sec)
Add Comment
Please, Sign In to add comment