基于百万数据集的登录存储过程

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

 

以上是关于基于百万数据集的登录存储过程的主要内容,如果未能解决你的问题,请参考以下文章

用于存储大型数据集的数据结构 [关闭]

java 登录过程 - android片段,异步任务登录,Asp.net控制器,存储库

JAVA获取ORACLE存储过程返回结果集的问题

Mysql使用存储过程快速添加百万数据

存储过程中数据集的表名

finereport报表,使用带参数的sql存储过程,报没有返回数据集的错