データが大量にあるテーブルをselectすると、反応が返ってこなくなる
事があります。where句できちんとフィルター出来れば良いけれども
調査の段階ではミスする事もありえるので、こんなオプションを知って
おいても良いかもしれません。
[root@colinux ~]# mysql –help | grep imit
–delimiter=name Delimiter to be used.
–select_limit=# Automatic limit for SELECT when using –safe-updates
–max_join_size=# Automatic limit for rows in a join when using
[root@colinux ~]# mysql -u root -p –prompt=”\u@\h-DB:\d>” –safe-updates –select_limit=3
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 5.1.30 MySQL Community Server (GPL)
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
root@localhost-DB:(none)>use test
Database changed
root@localhost-DB:test>select count(*) from T1;
+———-+
| count(*) |
+———-+
| 9 |
+———-+
1 row in set (0.00 sec)
root@localhost-DB:test>select * from T1;
+—-+————+—————+
| id | name | comment |
+—-+————+—————+
| 1 | SHOW WARIN | test update |
| 2 | SHOW WARIN | 22222222222 |
| 3 | select_lim | test 20090117 |
+—-+————+—————+
3 rows in set (0.00 sec)
root@localhost-DB:test>
–select_limitオプションでMax3件までのデータが表示されています。

select-limit