
MySQL分库分表总结参考
单库单表单库单表是最常见的数据库设计,例如,有一张用户(user)表放在数据库db中,所有的用户都可以在db库中的user表中查到。单库多表随着用户数量的增加,user表的数据量会越来越大,当数据量达到一定程度的时候对user表的查询会渐渐的变慢,从而影响整个DB

mysql 存储过程项目小结
1. false :0 true 1 切记官方文档:http://dev.mysql.com/doc/refman/5.0/en/numeric-type-overview.htmlBOOL,BOOLEANThese types are synonyms forTINYINT(1). A value of zero is considered false. Nonzero values are considered true:mysql SELECT IF(0

Declaring a handler
This tutorial shows you how to use MySQL handler to handle exceptions or errors encountered in stored procedures.When an error occurs inside a stored procedure, it is important to handle it appropriately, such as continuing or exiting the c

mysql 异常处理实例
1. 语法:DECLARE handler_action HANDLERFOR condition_value [, condition_value] …statementhandler_action:CONTINUE| EXIT| UNDOcondition_value:mysql_error_code| SQLSTATE [VALUE] sqlstate_value| condition_name| SQLWARNING| NOT FOUND| SQLEXCEP

myqltransactionRollbackexception deadlock found when trying
linux 下远程连接mysq命令:mysql -h 1.0.0.1 -u username -p1获 取锁等待情况可以通过检查 table_locks_waited和table_locks_immediate状态变量来分析系统上的表锁定争夺:mysql show status like Table%;+—————————-+———-+| Variab

SQL 四种连接:内连接、左外连接、右外连接、全连接–转载
原文:http://zwdsmileface.iteye.com/blog/2191730个人理解内连接(INNER JOIN)(典型的连接运算,使用像 = 或 之类的比较运算符)。包括相等连接和自然连接。 内连接使用比较运算符根据每个表共有的列的值匹配两个表中的行左连接(LEFT JOIN 或 LEFT OUTER J

mysql @变量和变量的区别及怎么判断记录唯一性
DELIMITER//drop PROCEDURE if EXISTS test.express;create PROCEDURE test.express()BEGINselect count(1) into @a from test.test_user where userid=user;select @a;IF @a1 THENselect hello world;ELSEselect error;END IF;END//CALL test.express();通过

mysql –The MEMORY Storage Engine–官方文档
原文地址:http://dev.mysql.com/doc/refman/5.7/en/memory-storage-engine.htmlTheMEMORYstorage engine (formerly known asHEAP) creates special-purpose tables with contents that are stored in memory. Because the data is vulnerable to crashes, ha

mysql 批量插入数据过多的解决方法
使用场景:测试时需要插入100w的数据,跑sql脚本插入非常慢。存储过程如下://DELIMITERDROP PROCEDURE if EXISTS createAmountCount;create PROCEDURE createAmountCount()BEGINDECLARE i int;set i=0;drop table if exists person ;create table person(id

HASH Partitioning–转载
原文地址:https://dev.mysql.com/doc/refman/5.1/en/partitioning-hash.htmlHASH Partitioning[+/-]18.2.3.1 LINEAR HASH PartitioningPartitioning byHASHis used primarily to ensure an even distribution of data among a predetermined number of parti