基于百万数据集的登录存储过程
Posted 人间最美二月天
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了基于百万数据集的登录存储过程相关的知识,希望对你有一定的参考价值。
现在jtthink数据库有用户表 user_sys有100万用户,书写登录
1、设置user_name为唯一索引,搜索更加快
2、存储过程书写如下:
1 BEGIN 2 #Routine body goes here... 3 4 set @gid = 0; 5 set @user_name=‘‘; 6 set @_result = ‘login success‘; 7 SELECT id,user_name into @gid,@user_name from user_sys WHERE user_name=_user_name and user_pwd=_user_pwd limit 1; 8 9 if @gid=0 THEN #登录不成功 10 set @_result = ‘login error‘; 11 end if; 12 SELECT * from (SELECT @_result as _result) a,(SELECT @gid,@user_name) b; #不管正确还是错误,都有结果返回 13 14 END
以上是关于基于百万数据集的登录存储过程的主要内容,如果未能解决你的问题,请参考以下文章