![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Mysql
hj_545
老男人!
展开
-
mysql海量数据插入
mysql海量数据插入可以使用构造SQL语句的方法,mysql支持一条SQL语句,插入多条记录。(ORACLE不支持)SQL:INSERT INTO tb_name VALUES (record1),(record1),(record1),(record1);需要注意的是,mysql有设置接收sql语句的大小,所有构造的记录不能超过其限制,举例:构造1W条记录的SQL语句正常插入,但是超过2W条插入的话,程序会报错;也就是说构造的SQL语句尽量不要大于100K,尽量避免网络连接等方面出现的问题。原创 2011-05-10 09:24:00 · 2539 阅读 · 0 评论 -
Sql优化
<br />filed like 'M%'<br />substr(filed,1,1) = 'M' 上下功能相同,下面效率好<br />substr(filed,-2,2) 表示后面开始<br />where str = '@@@' and id >2000<br />where id > 2000 and str = '@@@' 下面比上面效率高<br />count(*)不比count(字段)慢 <br />filed内容越多,count时间越长,<br />count(*)可能自动查找filed转载 2011-05-10 16:12:00 · 575 阅读 · 0 评论 -
Mysql table 表 随机 rand() 一条记录 record
<br />SELECT * <br />FROM tb_name<br />ORDER BY RAND() <br />LIMIT 1;原创 2011-04-26 15:42:00 · 555 阅读 · 0 评论