The invention provides a method and system for data storage and reading, and the data storage method comprises the following steps: after obtaining the user information, read the ID number of the user, store the ID number and record the number of stored ID numbers; when the number of read ID numbers reaches the set value, sort and store each ID number in the corresponding array according to the size. The data reading method includes the following steps: obtaining the ID number of the user to be read according to the user information of the user to be read; comparing the ID number of the user to be read with the maximum and minimum value of the ID number in each array, filtering out the array in which the maximum value of the ID number is not less than the user ID number to be read and the minimum value is not greater than the user ID number to be read; querying the array to be read from the filtered array The ID number of the user to get the user data of the user to be queried. The technical scheme provided by the invention can solve the problem of low working efficiency when the data storage method in the prior art stores and reads the data.
【技术实现步骤摘要】
一种数据存储、读取的方法和系统
本专利技术属于数据存储
,具体涉及一种数据存储、读取方法和系统。
技术介绍
在很多领域中,数据的记录、存储非常重要,不仅能够方便用户查询历史记录,还能够为其他研究提供数据支持。现有技术中数据的存储方式只是简单的对数据进行记录,当查询的时候需要根据用户的数据特征对所有的数据进行比对逐一查询。但是随着数据量的增多,便会造成查询时工作量比较大、效率较低的问题。
技术实现思路
本专利技术的目的是提供一种数据存储、读取的方法和系统,以解决现有技术中的数据存储方法在读取时效率比较低的问题。为实现上述目的,本专利技术采用如下技术方案:一种数据存储方法,包括如下步骤:(1)获取用户信息后,从用户信息中读取用户的ID号,将读取的ID号存储,并记录所存储的ID号的数量;(2)当读取的ID号数量达到设定值时,将各ID号按照大小进行排序,并将排序后的ID号转存到相应的数组中,并对存储的ID号重新记录所存储的ID号的数量;所述设定值大于3。进一步的,所述步骤(1)中在存储读取到的ID号时将ID号存储到队列中,队列的长度为所述设定值。一种数据读取方法,包括如下步骤:(1)根据待读取用户的用户信息获取待读取用户的ID号;(2)将待读取用户的ID号与各数组中ID号的最大值和最小值进行比较,筛选出其中ID号最大值不小于待读取用户ID号、最小值不大于待读取用户ID号的数组;(3)从筛选出的数组中查询所述待读取用户的ID号,得到待查询用户的用户数据。一种数据存储系统,包括处理器和存储器,存储器存储有用于在处理器上执行的计算机程序;所述包括如下步骤:(1)获取用 ...
【技术保护点】
1.一种数据存储方法,其特征在于,包括如下步骤:(1)获取用户信息后,从用户信息中读取用户的ID号,将读取的ID号存储,并记录所存储的ID号的数量;(2)当读取的ID号数量达到设定值时,将各ID号按照大小进行排序,并将排序后的ID号转存到相应的数组中,并对存储的ID号重新记录所存储的ID号的数量;所述设定值大于3。
【技术特征摘要】
1.一种数据存储方法,其特征在于,包括如下步骤:(1)获取用户信息后,从用户信息中读取用户的ID号,将读取的ID号存储,并记录所存储的ID号的数量;(2)当读取的ID号数量达到设定值时,将各ID号按照大小进行排序,并将排序后的ID号转存到相应的数组中,并对存储的ID号重新记录所存储的ID号的数量;所述设定值大于3。2.根据权利要求1所述的数据存储方法,其特征在于,所述步骤(1)中在存储读取到的ID号时将ID号存储到队列中,队列的长度为所述设定值。3.一种数据读取方法,其特征在于,包括如下步骤:(1)根据待读取用户的用户信息获取待读取用户的ID号;(2)将待读取用户的ID号与各数组中ID号的最大值和最小值进行比较,筛选出其中ID号最大值不小于待读取用户ID号、最小值不大于待读取用户ID号的数组;(3)从筛选出的数组中查询所述待读取用户的ID号,得到待查询用户的用户数据。4.一种数据存储系统,包括处理器和存储器,存储器存储有用于在处理器...
【专利技术属性】
技术研发人员:张进,吴冠军,毕强伟,张振京,程文平,
申请(专利权)人:北京智慧远景科技产业有限公司,
类型:发明
国别省市:北京,11
还没有人留言评论。发表了对其他浏览者有用的留言会获得科技券。