mysql 索引的使用
mysql> explain SELECT * from uchome_feed force index(uid) WHERE uid IN ('0',16,109,164,182,238,268,388,403,475);
+----+-------------+-------------+------+---------------+------+---------+------+--------+-------------+
| id | select_type | table | type | possible_keys | key | key_len | ref | rows | Extra |
+----+-------------+-------------+------+---------------+------+---------+------+--------+-------------+
| 1 | SIMPLE | uchome_feed | ALL | uid | NULL | NULL | NULL | 449779 | Using where |
+----+-------------+-------------+------+---------------+------+---------+------+--------+-------------+
强制使用索引居然也没用,mysql in操作难道不走索引??
该如何优化??
mysql> show index from uchome_feed;
+-------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
+-------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| uchome_feed | 0 | PRIMARY | 1 | feedid | A | 449779 | NULL | NULL | | BTREE | |
| uchome_feed | 1 | uid | 1 | uid | A | 449779 |
相关问答:
我是用mysql自带的C API
if(mysql_real_connect(&mysql,"125.0.0.108","root","root","home",3306,NULL,0))
{
AfxMessageBox("数据库连接失败") ......
我已经按照教程上配置tomcat的server.xml
<Context path = "/POS" docBase = "POS" debug = "5" reloadable = "true" crossContext = "true" workDir = &quo ......
String SQL="insert into 学生信息表 values(StudentNumber,StudentName,StudentAge)";其中StudentNumber,StudentName,StudentAge都是变量。这样写不对……到底该咋写啊
万分感谢!
String SQL=&q ......
100215 9:55:47 [Warning] Aborted connection 247 to db: 'gases' user: 'root' host: 'localhost' (Got an error reading communication packets)
100215 9:55:47 [Warning] Aborted connection 257 to db: 'ga ......
如何用sql查看表的列长度
show create table xxx;
可以获得建表命令,再进行分析,应该能得到想要的信息
MySQL 5 以上,你可以从数据字典中查到
select TABLE_SCHEMA,TABLE_NAME,COLUMN_NAME,DATA_TYPE,CHAR ......