Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- MariaDB [test]> show create table t20\G
- *************************** 1. row ***************************
- Table: t20
- Create Table: CREATE TABLE `t20` (
- `pk` int(11) NOT NULL,
- `a` int(11) DEFAULT NULL,
- `b` int(11) DEFAULT NULL,
- `c` int(11) DEFAULT NULL,
- PRIMARY KEY (`pk`),
- KEY `a` (`a`)
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1
- MariaDB [test]> set @a=0;
- Query OK, 0 rows affected (0.00 sec)
- MariaDB [test]> truncate table t20;
- Query OK, 0 rows affected (0.26 sec)
- MariaDB [test]> insert into t20 select @a:=@a+1, @a/100, @a/100, @a/100 from seq_1_to_1000;
- Query OK, 1000 rows affected (0.36 sec)
- Records: 1000 Duplicates: 0 Warnings: 0
- MariaDB [test]> select count(*) from t20;
- +----------+
- | count(*) |
- +----------+
- | 1000 |
- +----------+
- 1 row in set (0.01 sec)
- MariaDB [test]> select count(*) from t20 where a=2;
- +----------+
- | count(*) |
- +----------+
- | 100 |
- +----------+
- 1 row in set (0.00 sec)
- MariaDB [test]> explain delete from t20 where a=2;
- +------+-------------+-------+-------+---------------+------+---------+------+------+-------------+
- | id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
- +------+-------------+-------+-------+---------------+------+---------+------+------+-------------+
- | 1 | SIMPLE | t20 | range | a | a | 5 | NULL | 100 | Using where |
- +------+-------------+-------+-------+---------------+------+---------+------+------+-------------+
- 1 row in set (0.00 sec)
Add Comment
Please, Sign In to add comment