CN110515979B - Data query method, device, device and storage medium - Google Patents
Data query method, device, device and storage medium Download PDFInfo
- Publication number
- CN110515979B CN110515979B CN201910828306.9A CN201910828306A CN110515979B CN 110515979 B CN110515979 B CN 110515979B CN 201910828306 A CN201910828306 A CN 201910828306A CN 110515979 B CN110515979 B CN 110515979B
- Authority
- CN
- China
- Prior art keywords
- data
- activity
- target
- business
- rule
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
- G06F16/2282—Tablespace storage structures; Management thereof
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/23—Updating
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2455—Query execution
- G06F16/24552—Database cache management
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2455—Query execution
- G06F16/24564—Applying rules; Deductive queries
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computational Linguistics (AREA)
- Software Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
本发明实施例公开了一种数据查询方法、装置、设备和存储介质,其中,该方法包括:根据数据查询请求获取预先缓存在存储空间中的目标活动;根据所述目标活动获取数据库待查数据表中的目标业务数据。本发明实施例的预先将待查询的目标活动存储到缓存区域,减少了数据查询过程的数据传输量,无需根据数据查询请求对数据进行筛选,降低了服务器的计算开销,提高了数据库中数据查询的效率。
Embodiments of the present invention disclose a data query method, device, device and storage medium, wherein the method includes: acquiring a target activity pre-cached in a storage space according to a data query request; acquiring data to be queried in a database according to the target activity The target business data in the table. In the embodiment of the present invention, the target activity to be queried is stored in the cache area in advance, which reduces the data transmission amount in the data query process, does not need to filter the data according to the data query request, reduces the computing overhead of the server, and improves the data query in the database. s efficiency.
Description
技术领域technical field
本发明实施例涉及计算机应用技术领域,尤其涉及一种数据查询方法、装置、设备和存储介质。Embodiments of the present invention relate to the technical field of computer applications, and in particular, to a data query method, apparatus, device, and storage medium.
背景技术Background technique
随着互联网技术的发展,数据成功为互联网公司的重要资源,现有互联网公司在存储业务数据时,将不同种类的数据存储到不同的数据库表中,例如,业务活动规则和用户业务信息分别存储到活动规则表和用户业务表。根据存储在活动规则表和用户业务表中的业务活动规则和用户业务生成对应的个人业务信息展示到用户的个人中心。With the development of Internet technology, data has become an important resource for Internet companies. When existing Internet companies store business data, they store different types of data in different database tables. For example, business activity rules and user business information are stored separately. to the activity rules table and the user business table. The personal business information corresponding to the business activity rules stored in the activity rule table and the user business table and the user business is generated and displayed to the user's personal center.
现有技术中业务活动规则和用户业务信息分别存储到活动规则表和用户业务表,参见图1,用户业务表中存储有活动编号和用户编号,活动规则表中存储有规则编号和订单类型,需要查询用户业务数据时,根据用户编号在用户业务数据表中查找到用户所有业务数据,根据订单类型和规则编号获取到活动规则,在缓存中根据查找到的活动规则筛选所有业务数据获取到符合活动要求的用户业务数据。上述的技术方案存在两个问题,首先是需要从数据库中读取用户所有业务数据,网络数据传输开销大;其次是,需要在内存中根据活动规则对所有业务数据进行筛选,当用户业务信息较多时,耗费大量服务器计算资源。In the prior art, business activity rules and user business information are stored in an activity rule table and a user business table, respectively. Referring to Figure 1, an activity number and a user number are stored in the user business table, and a rule number and an order type are stored in the activity rule table. When it is necessary to query user business data, all business data of the user is found in the user business data table according to the user ID, activity rules are obtained according to the order type and rule ID, and all business data are filtered according to the found activity rules in the cache to obtain the matching User business data requested by the activity. The above technical solution has two problems. First, all business data of the user needs to be read from the database, and the network data transmission overhead is high; second, all business data needs to be filtered in the memory according to the activity rules. For a long time, it consumes a lot of server computing resources.
发明内容SUMMARY OF THE INVENTION
本发明提供一种数据查询方法、装置、设备和存储介质,以实现数据库数据的高效查询,降低服务器的计算开销,并提高数据的传输效率。The present invention provides a data query method, device, equipment and storage medium, so as to realize efficient query of database data, reduce server computing overhead, and improve data transmission efficiency.
第一方面,本发明实施例提供了一种数据查询方法,该方法包括:In a first aspect, an embodiment of the present invention provides a data query method, which includes:
根据数据查询请求获取预先缓存在存储空间中的目标活动;Obtain the target activities pre-cached in the storage space according to the data query request;
根据所述目标活动获取数据库待查数据表中的目标业务数据。The target business data in the data table to be checked in the database is acquired according to the target activity.
第二方面,本发明实施例还提供了一种数据查询装置,该装置包括:In a second aspect, an embodiment of the present invention further provides a data query device, the device comprising:
缓存匹配模块,用于根据数据查询请求获取预先缓存在存储空间中的目标活动;The cache matching module is used to obtain the target activities pre-cached in the storage space according to the data query request;
数据库匹配模块,用于根据所述目标活动获取数据库待查数据表中的目标业务数据。The database matching module is used for acquiring the target business data in the data table to be checked in the database according to the target activity.
第三方面,本发明实施例还提供了一种设备,该设备包括:In a third aspect, an embodiment of the present invention further provides a device, and the device includes:
一个或多个处理器;one or more processors;
存储器,用于存储一个或多个程序,memory for storing one or more programs,
当所述一个或多个程序被所述一个或多个处理器执行,使得所述一个或多个处理器实现如本发明实施例中任一所述的数据查询方法。When the one or more programs are executed by the one or more processors, the one or more processors implement the data query method according to any one of the embodiments of the present invention.
第四方面,本发明实施例还提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现如本发明实施例中任一所述的数据查询方法。In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, implements the data query method according to any one of the embodiments of the present invention.
本发明实施例的技术方案,通过数据查询请求获取缓存在存储空间内的目标活动,根据目标活动在数据库中查找对应的目标业务数据,通过预先将活动数据缓存在存储空间内,缩短了获取业务数据的查询时间,降低了服务器的计算开销,可提高数据查询效率。According to the technical solution of the embodiment of the present invention, the target activity cached in the storage space is obtained through a data query request, the corresponding target service data is searched in the database according to the target activity, and the activity data is cached in the storage space in advance, thereby shortening the time for obtaining service. The query time of data is reduced, the computing overhead of the server is reduced, and the efficiency of data query can be improved.
附图说明Description of drawings
图1是现有技术中数据查询的示例图;Fig. 1 is an example diagram of data query in the prior art;
图2是本发明实施例一提供的一种数据查询方法的步骤流程图;2 is a flowchart of steps of a data query method provided in Embodiment 1 of the present invention;
图3是本发明实施例二提供的一种数据查询方法的步骤流程图;3 is a flow chart of steps of a data query method provided in Embodiment 2 of the present invention;
图4是本发明实施例二提供的一种数据查询方法的示例图;4 is an exemplary diagram of a data query method provided in Embodiment 2 of the present invention;
图5是本发明实施例三提供的一种数据查询装置的结构示意图;5 is a schematic structural diagram of a data query device according to Embodiment 3 of the present invention;
图6是本发明实施例四提供的一种设备的结构示意图。FIG. 6 is a schematic structural diagram of a device according to Embodiment 4 of the present invention.
具体实施方式Detailed ways
下面结合附图和实施例对本发明作进一步的详细说明。可以理解的是,此处所描述的具体实施例仅仅用于解释本发明,而非对本发明的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与本发明相关的部分而非全部结构,此外,在不冲突的情况下,本发明中的实施例及实施例中的特征可以相互组合。The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention, but not to limit the present invention. In addition, it should be noted that, for the convenience of description, the drawings only show some but not all of the structures related to the present invention. In addition, the embodiments of the present invention and the features of the embodiments will not conflict with each other. can be combined with each other.
实施例一Example 1
图2是本发明实施例提供的一种数据查询方法的步骤流程图,本实施例可适用于查询分表存储的业务数据的情况,该方法可以由数据查询装置来执行,该装置可以采用硬件和/或软件的方式来实现,参见图2,本发明实施例提供的方法包括如下步骤:FIG. 2 is a flowchart of steps of a data query method provided by an embodiment of the present invention. This embodiment is applicable to the case of querying business data stored in sub-tables. The method can be executed by a data query device, and the device can use hardware and/or software. Referring to FIG. 2, the method provided by the embodiment of the present invention includes the following steps:
步骤101、根据数据查询请求获取预先缓存在存储空间中的目标活动。Step 101: Acquire the target activity pre-cached in the storage space according to the data query request.
其中,数据查询请求可以是用户发出的用于获取数据的请求,例如,可以是用户的点击命令或展示界面打开命令等,存储空间可以是预先存储有活动信息的空间,可以是高速数据交换的存储器,可以直接与中央处理器进行数据交换,目标活动可以是数据查询请求获取的目标数据的原始数据,目标活动通过筛选或者组合后可以是数据查询请求的目标数据。Wherein, the data query request may be a request sent by a user to obtain data, for example, it may be a user's click command or a display interface opening command, etc., and the storage space may be a space in which activity information is pre-stored, or a high-speed data exchange. The memory can directly exchange data with the central processor, the target activity can be the original data of the target data obtained by the data query request, and the target activity can be the target data of the data query request after filtering or combining.
具体的,在获取到数据查询请求时,可以根据数据查询请求在预先缓存的存储空间内查找目标活动,例如,数据查询请求为查询订单对应的活动优惠信息,可以根据数据查询请求中的订单信息在预先缓存的存储空间内获取与订单信息关联的活动,可以将查找到的活动作为目标活动。Specifically, when the data query request is obtained, the target activity can be searched in the pre-cached storage space according to the data query request. For example, the data query request is the activity discount information corresponding to the query order, and the order information in the data query request can be searched according to the data query request. Get the activities associated with the order information in the pre-cached storage space, and use the found activities as the target activities.
步骤102、根据所述目标活动获取数据库待查数据表中的目标业务数据。Step 102: Acquire the target business data in the data table to be checked in the database according to the target activity.
其中,数据库可以是存储有目标活动和业务数据的数据集合,目标活动和业务数据可以存储在数据库中的不同数据表,待查数据表可以是存储有目标业务数据的数据表。可以理解的是,待查数据表中业务数据和目标活动可以具有关联关系,例如,目标活动的标识号可以与业务数据的标识号存在对应关系。The database may be a data set storing target activity and business data, the target activity and business data may be stored in different data tables in the database, and the data table to be checked may be a data table storing target business data. It can be understood that the business data and the target activity in the data table to be checked may have an associated relationship, for example, the identification number of the target activity may have a corresponding relationship with the identification number of the business data.
在本发明实施例中,可以根据目标活动在数据库中的待查数据表中进行查找,当查找到目标活动时,可以将与目标活动关联存储的业务数据作为目标业务数据。例如,数据库中的待查数据表中业务数据可以与目标活动的标识号关联存储,查询到目标活动的标识号时,可以将目标活动标识号对应的业务数据作为目标业务数据。In this embodiment of the present invention, the data table to be searched in the database can be searched according to the target activity, and when the target activity is found, the service data stored in association with the target activity can be used as the target service data. For example, the business data in the data table to be queried in the database can be stored in association with the identification number of the target activity. When the identification number of the target activity is queried, the business data corresponding to the identification number of the target activity can be used as the target business data.
本发明实施例的技术方案,通过在具有预先缓存的存储空间内查找数据查询请求对应的目标活动,根据目标活动在数据库的待查数据表中进行查找,将查找到的数据作为目标业务数据,将数据库存储的活动数据缓存到存储空间啊,提高了数据查找速度,跨表数据查询无需在获取到数据查询请求时在缓存数据内进行数据筛选,降低了服务器的技术开销,提高了数据查询效率。According to the technical solution of the embodiment of the present invention, the target activity corresponding to the data query request is searched in the storage space with pre-cache, search is performed in the data table to be searched in the database according to the target activity, and the found data is used as the target business data, The activity data stored in the database is cached in the storage space, which improves the data search speed, and cross-table data query does not require data filtering in the cached data when the data query request is obtained, which reduces the technical overhead of the server and improves the data query efficiency. .
实施例二Embodiment 2
图3是本发明实施例二提供的一种数据查询方法的步骤流程图,本发明实施例是在上述发明实施基础上的具体化,参见图3,本发明实施例的数据查询方法包括:FIG. 3 is a flow chart of the steps of a data query method provided in Embodiment 2 of the present invention. The embodiment of the present invention is an embodiment based on the implementation of the above-mentioned invention. Referring to FIG. 3 , the data query method according to the embodiment of the present invention includes:
步骤201、分别读取数据库活动表中的活动数据和规则表中的规则数据。Step 201: Read the activity data in the database activity table and the rule data in the rule table respectively.
其中,活动表可以是存储有活动信息的数据表,活动表可以存储活动的相关信息,可以包括活动的活动介绍和活动内容等,规则表可以是存储有活动规则的数据表,规则表可以存储有活动的有效时间和参与要求等规则,规则数据可以是活动表中存储的规则,活动表中的活动数据可以对应不同活动的数据,规则数据可以是规则数据,可以理解的是,规则表中的多个规则数据可以对应相同的活动,可以对活动进行限制。The activity table may be a data table storing activity information, the activity table may store relevant information of the activity, and may include the activity introduction and activity content of the activity, etc. The rule table may be a data table storing activity rules, and the rule table may store There are rules such as the effective time of the activity and participation requirements. The rule data can be the rules stored in the activity table. The activity data in the activity table can correspond to the data of different activities. The rule data can be rule data. It is understandable that in the rule table Multiple rule data of , can correspond to the same activity, and activities can be restricted.
具体的,活动数据和规则数据可以存储在数据库中的活动表和规则表中,可以预先读取数据中存储的所有活动数据和规则数据,可以将读取到的活动数据和规则数据缓存到存储空间。例如,可以在获取到数据查询请求之前,将规则数据和活动数据读取,当获取到数据查询请求时,可以直接读取缓存中存储的数据,无需从数据库缓存到存储空间。Specifically, the activity data and rule data can be stored in the activity table and the rule table in the database, all the activity data and rule data stored in the data can be read in advance, and the read activity data and rule data can be cached in the storage space. For example, before a data query request is obtained, the rule data and activity data can be read, and when a data query request is obtained, the data stored in the cache can be directly read without having to cache from the database to the storage space.
步骤202、将活动数据和规则数据组成业务活动,并将业务活动缓存到空间存储。In
其中,业务活动可以是由活动数据和规则数据组成的活动,业务活动可以包括活动的活动内容和相应的活动规则,活动数据和规则数据的组合可以根据用户选择或者自动选择。The business activity may be an activity composed of activity data and rule data, the business activity may include activity content of the activity and corresponding activity rules, and the combination of activity data and rule data may be selected or automatically selected by the user.
在本发明实施例中,可以将活动数据和规则数据按照用户需要或者配置文件进行组合以生成业务活动,业务活动可以在活动数据和规则数据缓存的活动空间内生成。例如,可以将活动编号和规则编号关联为活动项编号,可以将活动项编号作为对应的业务活动,可以理解的是,活动数据可以对应多个规则数据,业务活动可以包括一个活动数据和多个规则数据。In this embodiment of the present invention, activity data and rule data can be combined according to user needs or configuration files to generate business activities, and business activities can be generated in the activity space of the activity data and rule data caches. For example, the activity number and the rule number can be associated with the activity item number, and the activity item number can be used as the corresponding business activity. It can be understood that the activity data can correspond to multiple rule data, and the business activity can include one activity data and multiple rule data.
步骤203、提取数据查询请求中的待查属性信息。Step 203: Extract the attribute information to be checked in the data query request.
其中,待查属性信息可以包括用户信息和订单类型等,待查属性信息可以用户获取对应的业务活动,例如,根据不同的订单类型可以对应不同的业务活动。The attribute information to be queried may include user information and order types, etc. The attribute information to be queried can be obtained by the user for corresponding business activities. For example, different order types can correspond to different business activities.
在本发明实施例中,数据查询请求中可以包括用户的待查属性信息,获取到数据查询请求时,可以提取数据查询请求中包括的用户信息和订单类型等待查属性信息。In this embodiment of the present invention, the data query request may include the user's property information to be checked. When the data query request is obtained, the user information and order type included in the data query request may be extracted to wait for the property information to be checked.
步骤204确定存储空间中待查属性信息满足的规则数据对应的目标业务活动。Step 204 determines the target business activity corresponding to the rule data satisfied by the attribute information to be checked in the storage space.
其中,存储空间可以是直接与中央处理器进行数据交互的存储器,存储空间内可以存储有业务活动,当获取到数据查询请求时,可以根据待查属性信息查询对应的目标业务活动。The storage space may be a memory that directly interacts with the central processor, and business activities may be stored in the storage space. When a data query request is obtained, the corresponding target business activity may be queried according to the attribute information to be queried.
具体的,业务活动可以包括由规则数据,可以根据待查属性信息查找对应的规则数据,若待查属性信息满足规则数据对应的活动规则,例如,订单类型与规则数据中的订单类型相同,可以将规则数据对应的业务活动作为数据查询请求需要查询的目标业务活动。Specifically, the business activity can include the rule data, and the corresponding rule data can be searched according to the attribute information to be checked. If the attribute information to be checked satisfies the activity rules corresponding to the rule data, for example, the order type is the same as the order type in the rule data, it can be The business activity corresponding to the rule data is used as the target business activity to be queried in the data query request.
步骤205、将所述目标业务活动对应的活动数据作为目标活动。Step 205: Use the activity data corresponding to the target business activity as the target activity.
在本发明实施例中,目标业务活动可以包括规则数据和业务数据,当数据查询请求中的待查属性满足规则数据的要求时,可以获取与规则数据关联的活动数据,例如,可以获取到与规则数据关联存储的活动编号,可以将获取到的活动数据作为数据查询请求的目标活动。In this embodiment of the present invention, the target business activity may include rule data and business data. When the to-be-checked attribute in the data query request meets the requirements of the rule data, the activity data associated with the rule data can be obtained, for example, the activity data associated with the rule data can be obtained. The activity number stored in association with the rule data, and the acquired activity data can be used as the target activity of the data query request.
步骤206、确定数据查询请求中的数据查询数量。Step 206: Determine the data query quantity in the data query request.
其中,数据查询请求可以是用户信息展示界面的刷新请求,可以根据数据查询请求查询目标数据展示在用户信息展示界面中,可以根据用户信息展示界面中需要展示目标数据的数量确定数据查询请求中数据查询数量,数据查询数量可以是查询目标数据的数量。The data query request may be a refresh request of the user information display interface, the query target data may be displayed in the user information display interface according to the data query request, and the data in the data query request may be determined according to the quantity of target data to be displayed in the user information display interface The number of queries, the number of data queries can be the number of query target data.
具体的,数据查询请求中包括需要查询目标数据的数据查询数量,可以解析数据查询请求提取到数据查询数量。进一步的,数据查询数量可以与用户信息展示界面中展示目标数据的数量相关,例如,用户信息展示界面中需要展示20条目标数据,可以将数据查询请求中的数据查询数量确定为20。Specifically, the data query request includes the data query quantity that needs to query the target data, and the data query quantity can be extracted by analyzing the data query request. Further, the number of data queries may be related to the number of target data displayed in the user information display interface. For example, if 20 pieces of target data need to be displayed in the user information display interface, the number of data queries in the data query request may be determined as 20.
步骤207、根据目标活动在数据库待查数据表中查找数据查询数量的业务数据,其中,待查数据表关联存储业务数据和活动数据。Step 207 : Search the data table to be searched in the database for business data of the number of data queries according to the target activity, wherein the data table to be searched stores the business data and the activity data in association.
其中,待查数据表可以将业务数据和活动数据关联存储,例如,业务数据可以与目标活动的活动编号关联存储,可以根据目标活动的活动数据查询到对应的业务数据。The data table to be queried can store business data and activity data in association, for example, business data can be stored in association with the activity number of the target activity, and corresponding business data can be queried according to the activity data of the target activity.
具体的,根据数据查询请求获取到目标活动后,可以根据目标活动在数据库中查找对应的业务数据,获取数据查询数量的业务数据作为目标业务数据。例如,可以根据目标活动的活动编号在数据库中的待查数据表查找业务数据,可以获取其中数据查询数量的业务数据作为目标业务数据,可以直接查找数据查询数量的业务数据,无需获取全部满足要求的业务数据,提高了数据查询的速度。Specifically, after the target activity is obtained according to the data query request, the corresponding business data can be searched in the database according to the target activity, and the business data of the data query quantity is obtained as the target business data. For example, according to the activity number of the target activity, the business data can be searched in the data table to be searched in the database, the business data of the data query quantity can be obtained as the target business data, and the business data of the data query quantity can be directly searched without obtaining all the business data that meet the requirements. business data, which improves the speed of data query.
步骤208、将查找到的业务数据作为目标业务数据。Step 208: Use the found service data as the target service data.
在本发明实施例中,可以将根据目标活动查询到的业务数据作为目标业务数据。In this embodiment of the present invention, the service data queried according to the target activity may be used as the target service data.
本发明实施例的技术方案,通过读取数据库活动表和规则表以获取活动数据和规则数据,将活动数据和规则数据组成业务活动,将业务活动存储到存储空间,获取数据查询请求中的待查属性信息,根据待查属性信息确定存储空间内满足的规则数据对应的目标业务活动,将目标业务活动的活动数据作为作为目标活动,确定数据查询请求的数据查询数量,在数据库待查数据表中查找数据查询数量的业务数据作为目标业务数据;通过预先将业务活动缓存在存储空间,获取数据查询请求时,无需查找数据库获取活动数据和规则数据,提高了数据查询效率,无需根据活动数据和规则数据查询所有的业务数据,降低了服务器的计算开销,提高了数据查询效率。The technical solution of the embodiment of the present invention is to obtain the activity data and the rule data by reading the database activity table and the rule table, compose the activity data and the rule data into a business activity, store the business activity in the storage space, and obtain the pending data in the data query request. Check the attribute information, determine the target business activity corresponding to the rule data satisfied in the storage space according to the attribute information to be checked, take the activity data of the target business activity as the target activity, and determine the number of data queries requested by the data query. The business data of the number of search data queries in the system is used as the target business data; by pre-caching business activities in the storage space, when obtaining data query requests, there is no need to search the database to obtain the activity data and rule data, which improves the data query efficiency, and does not need to be based on the activity data and the rule data. The rule data queries all business data, which reduces the computing overhead of the server and improves the data query efficiency.
进一步的,在上述发明实施例的基础上,将活动数据和规则数据组成业务活动,包括:Further, on the basis of the above embodiments of the invention, the activity data and the rule data are formed into business activities, including:
获取用户预先配置的关联关系;根据关联关系将活动数据和规则数据进行关联作为业务活动。Obtain the association relationship pre-configured by the user; associate the activity data and the rule data according to the association relationship as a business activity.
在本发明实施例中,关联关系可以是活动数据与规则数据的对应关系,一个活动数据可以对应多个规则数据,关联关系可以预先存储在配置文件中,当需要将活动数据和规则数据进行组成时,可以根据配置文件中的关联关系,将活动数据和规则数据进行组成生成活动规则集,可以将活动规则集作为业务活动。In this embodiment of the present invention, the association relationship may be the corresponding relationship between activity data and rule data, one activity data may correspond to multiple rule data, and the association relationship may be pre-stored in a configuration file. When the activity data and the rule data need to be composed At the time, activity data and rule data can be composed according to the association relationship in the configuration file to generate an activity rule set, and the activity rule set can be regarded as a business activity.
进一步的,在上述发明实施例的基础上,还包括:Further, on the basis of the above embodiments of the invention, it also includes:
当前时间不在存储空间内业务活动的活动时间范围时,将所述业务活动从存储空间内删除;当数据库活动表更新时,根据更新数据生成更新业务活动缓存到存储空间。When the current time is not within the activity time range of the business activity in the storage space, the business activity is deleted from the storage space; when the database activity table is updated, the updated business activity cache is generated and stored in the storage space according to the updated data.
其中,当前时间可以是更新存储空间内业务活动的时间,活动时间范围可以是业务活动的规则数据,若当前时间不在业务活动的活动时间范围内时,可以确定业务活动失效,或者,当数据库中的活动表更新时,例如,活动表中存储入新的活动数据时,可以根据新的活动数据添加到存储空间形成新的业务活动。Wherein, the current time can be the time when the business activity in the storage space is updated, and the activity time range can be the rule data of the business activity. If the current time is not within the activity time range of the business activity, it can be determined that the business activity is invalid, or, when the database When the activity table is updated, for example, when new activity data is stored in the activity table, a new business activity can be formed according to the new activity data added to the storage space.
具体的,获取存储空间内业务活动的规则数据,若当前时间不再活动时间的范围内时,可以将对应的业务活动从存储空间内删除;若数据库中活动表存储入更新数据时,其中,更新数据可以时新的活动数据,当活动表中存储入新的活动数据时,可以根据活动数据生成更新业务活动缓存到存储空间。Specifically, the rule data of the business activities in the storage space is obtained, and if the current time is no longer within the range of the active time, the corresponding business activity can be deleted from the storage space; if the activity table in the database is stored in the update data, among them, The update data can be new activity data. When new activity data is stored in the activity table, the update business activity cache can be generated according to the activity data and stored in the storage space.
进一步的,在上述发明实施例的基础上,当数据库活动表更新时,根据更新数据生成更新业务活动缓存到存储空间,包括:Further, on the basis of the above-mentioned embodiments of the invention, when the database activity table is updated, generating and updating the business activity cache to the storage space according to the update data, including:
获取数据库活动表中的更新活动数据和规则表中的规则数据;根据更新活动数据和规则数据生成更新业务活动;将所述更新业务活动缓存到存储空间。Obtain the update activity data in the database activity table and the rule data in the rule table; generate the update business activity according to the update activity data and the rule data; cache the update business activity in the storage space.
具体的,可以获取数据库活动表中新添加的更新活动数据,可以根据更新活动数据组及规则表中的规则数据组成更新业务活动,可以将更新业务活动缓存到存储空间。Specifically, the update activity data newly added in the database activity table can be acquired, the update business activity can be formed according to the update activity data group and the rule data in the rule table, and the update business activity can be cached in the storage space.
示例性的,图4是本发明实施例二提供的一种数据查询方法的示例图,参见图4,通过定时脚本将活动表中活动数据和规则表中规则数据组成订单类型和活动编号的活动项,可以将活动项作为业务活动存储在缓存中,当获取到数据查询请求时,可以在缓存中查找业务活动获取到活动编号,可以根据活动编号在待查数据表中查找目标业务数据,可实现目标数据的快速查找。Exemplarily, FIG. 4 is an example diagram of a data query method provided by Embodiment 2 of the present invention. Referring to FIG. 4 , the activity data in the activity table and the rule data in the rule table are formed into an activity of order type and activity number through a timing script. The activity item can be stored in the cache as a business activity. When a data query request is obtained, the activity number can be obtained by looking up the business activity in the cache, and the target business data can be searched in the data table to be checked according to the activity number. Realize fast search of target data.
实施例三Embodiment 3
图5是本发明实施例三提供的一种数据查询装置的结构示意图,参见图5,本发明实施例提供的数据查询装置可以执行本发明任意实施例提供的数据查询方法,具备执行方法相应的功能模块和有益效果,该装置可以由软件和/或硬件实现具体包括:缓存匹配模块301和数据库匹配模块302。FIG. 5 is a schematic structural diagram of a data query apparatus provided by Embodiment 3 of the present invention. Referring to FIG. 5 , the data query apparatus provided by the embodiment of the present invention can execute the data query method provided by any embodiment of the present invention, and has corresponding execution methods. Functional modules and beneficial effects, the apparatus can be implemented by software and/or hardware, and specifically includes: a
其中,缓存匹配模块301,用于根据数据查询请求获取预先缓存在存储空间中的目标活动。The
数据库匹配模块302,用于根据所述目标活动获取数据库待查数据表中的目标业务数据。The
本发明实施例的技术方案,通过缓存匹配模块在具有预先缓存的存储空间内查找数据查询请求对应的目标活动,数据库匹配模块根据目标活动在数据库的待查数据表中进行查找,将查找到的数据作为目标业务数据,将数据库存储的活动数据缓存到存储空间啊,提高了数据查找速度,跨表数据查询无需在获取到数据查询请求时在缓存数据内进行数据筛选,降低了服务器的技术开销,提高了数据查询效率。In the technical solution of the embodiment of the present invention, the cache matching module searches for the target activity corresponding to the data query request in the pre-cached storage space, and the database matching module searches the data table to be searched in the database according to the target activity, and searches the found data The data is used as the target business data, and the activity data stored in the database is cached in the storage space, which improves the data search speed. Cross-table data query does not need to filter the data in the cached data when the data query request is obtained, which reduces the technical overhead of the server. , which improves the data query efficiency.
进一步的,在上述发明实施例的基础上,数据查询装置还包括:Further, on the basis of the above embodiments of the invention, the data query device further includes:
数据读取模块,用于分别读取数据库活动表中的活动数据和规则表中的规则数据。The data reading module is used to read the activity data in the database activity table and the rule data in the rule table respectively.
活动缓存模块,用于将活动数据和规则数据组成业务活动,并将业务活动缓存到存储空间。The activity cache module is used to compose activity data and rule data into business activities, and cache the business activities to the storage space.
进一步的,在上述发明实施例的基础上,活动缓存模块包括:Further, on the basis of the above embodiments of the invention, the active cache module includes:
配置获取单元,用于获取用户预先配置的关联关系。The configuration obtaining unit is used to obtain the association relationship preconfigured by the user.
活动确定单元,用于根据关联关系将活动数据和规则数据进行关联作为业务活动。The activity determination unit is used for associating activity data and rule data as business activities according to the association relationship.
进一步的,在上述发明实施例的基础上,缓存匹配模块包括:Further, on the basis of the above embodiments of the invention, the cache matching module includes:
信息提取单元,用于提取数据查询请求中的待查属性信息。The information extraction unit is used to extract the attribute information to be checked in the data query request.
缓存查找单元,用于确定存储空间中待查属性信息满足的规则数据对应的目标业务活动。The cache search unit is used to determine the target business activity corresponding to the rule data satisfied by the attribute information to be searched in the storage space.
目标活动单元,用于将所述目标业务活动对应的活动数据作为目标活动。The target activity unit is configured to use the activity data corresponding to the target business activity as the target activity.
进一步的,在上述发明实施例的基础上,数据库匹配模块包括:Further, on the basis of the above embodiments of the invention, the database matching module includes:
数量确定单元,用于确定数据查询请求中的数据查询数量。The quantity determining unit is used to determine the data query quantity in the data query request.
数据查找单元,用于根据目标活动在数据库待查数据表中查找数据查询数量的业务数据,其中,待查数据表关联存储业务数据和活动数据。The data search unit is configured to search for the business data of the data query quantity in the data table to be searched in the database according to the target activity, wherein the data table to be searched stores the business data and the activity data in association.
目标数据确定单元,用于将查找到的业务数据作为目标业务数据。The target data determination unit is used for taking the found business data as the target business data.
进一步的,在上述发明实施例的基础上,还包括:Further, on the basis of the above embodiments of the invention, it also includes:
活动删除模块,用于当前时间不在存储空间内业务活动的活动时间范围时,将所述业务活动从存储空间内删除。The activity deletion module is used to delete the business activity from the storage space when the current time is not within the activity time range of the business activity in the storage space.
业务更新模块,用于当数据库活动表更新时,根据更新数据生成更新业务活动缓存到存储空间。The business update module is used to generate and update the business activity cache to the storage space according to the update data when the database activity table is updated.
进一步的,在上述发明实施例的基础上,业务更新模块包括:Further, on the basis of the above embodiments of the invention, the service update module includes:
更新数据单元,用于获取数据库活动表中的更新活动数据和规则表中的规则数据。The update data unit is used to obtain the update activity data in the database activity table and the rule data in the rule table.
更新业务活动单元,用于根据更新活动数据和规则数据生成更新业务活动;The update business activity unit is used to generate the update business activity according to the update activity data and the rule data;
更新缓存单元,用于将所述更新业务活动缓存到存储空间。An update cache unit, configured to cache the update service activity in the storage space.
实施例四Embodiment 4
图6是本发明实施例四提供的一种设备的结构示意图,如图6所示,该设备包括处理器40、存储器41、输入装置42和输出装置43;设备中处理器40的数量可以是一个或多个,图6中以一个处理器40为例;设备中的处理器40、存储器41、输入装置42和输出装置43可以通过总线或其他方式连接,图6中以通过总线连接为例。FIG. 6 is a schematic structural diagram of a device according to Embodiment 4 of the present invention. As shown in FIG. 6 , the device includes a
存储器71作为一种计算机可读存储介质,可用于存储软件程序、计算机可执行程序以及模块,如本发明实施例中的数据查询方法对应的程序模块(例如,数据查询模块中的缓存匹配模块301和数据库匹配模块302)。处理器40通过运行存储在存储器41中的软件程序、指令以及模块,从而执行设备的各种功能应用以及数据处理,即实现上述的数据查询方法。As a computer-readable storage medium, the memory 71 can be used to store software programs, computer-executable programs, and modules, such as program modules corresponding to the data query method in the embodiment of the present invention (for example, the
存储器41可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序;存储数据区可存储根据终端的使用所创建的数据等。此外,存储器41可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他非易失性固态存储器件。在一些实例中,存储器41可进一步包括相对于处理器40远程设置的存储器,这些远程存储器可以通过网络连接至设备。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。The
输入装置42可用于接收输入的数字或字符信息,以及产生与设备的用户设置以及功能控制有关的键信号输入。输出装置73可包括显示屏等显示设备。The
实施例五Embodiment 5
本发明实施例五还提供一种包含计算机可执行指令的存储介质,所述计算机可执行指令在由计算机处理器执行时用于执行一种数据查询方法,该方法包括:Embodiment 5 of the present invention further provides a storage medium containing computer-executable instructions, where the computer-executable instructions are used to execute a data query method when executed by a computer processor, and the method includes:
根据数据查询请求获取预先缓存在存储空间中的目标活动;Obtain the target activities pre-cached in the storage space according to the data query request;
根据所述目标活动获取数据库待查数据表中的目标业务数据。The target business data in the data table to be checked in the database is acquired according to the target activity.
当然,本发明实施例所提供的一种包含计算机可执行指令的存储介质,其计算机可执行指令不限于如上所述的方法操作,还可以执行本发明任意实施例所提供的数据查询方法中的相关操作。Of course, a storage medium containing computer-executable instructions provided by an embodiment of the present invention, the computer-executable instructions of the storage medium are not limited to the above-mentioned method operations, and can also execute any of the data query methods provided by any embodiment of the present invention. related operations.
通过以上关于实施方式的描述,所属领域的技术人员可以清楚地了解到,本发明可借助软件及必需的通用硬件来实现,当然也可以通过硬件实现,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在计算机可读存储介质中,如计算机的软盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(RandomAccess Memory,RAM)、闪存(FLASH)、硬盘或光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述的方法。From the above description of the embodiments, those skilled in the art can clearly understand that the present invention can be realized by software and necessary general-purpose hardware, and of course can also be realized by hardware, but in many cases the former is a better embodiment . Based on such understanding, the technical solutions of the present invention can be embodied in the form of software products in essence or the parts that make contributions to the prior art, and the computer software products can be stored in a computer-readable storage medium, such as a floppy disk of a computer , read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), flash memory (FLASH), hard disk or CD, etc., including several instructions to make a computer device (which can be a personal computer, A server, or a network device, etc.) executes the methods described in the various embodiments of the present invention.
值得注意的是,上述数据查询装置的实施例中,所包括的各个单元和模块只是按照功能逻辑进行划分的,但并不局限于上述的划分,只要能够实现相应的功能即可;另外,各功能单元的具体名称也只是为了便于相互区分,并不用于限制本发明的保护范围。It is worth noting that, in the above-mentioned embodiment of the data query apparatus, the units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be realized; The specific names of the functional units are only for the convenience of distinguishing from each other, and are not used to limit the protection scope of the present invention.
注意,上述仅为本发明的较佳实施例及所运用技术原理。本领域技术人员会理解,本发明不限于这里所述的特定实施例,对本领域技术人员来说能够进行各种明显的变化、重新调整和替代而不会脱离本发明的保护范围。因此,虽然通过以上实施例对本发明进行了较为详细的说明,但是本发明不仅仅限于以上实施例,在不脱离本发明构思的情况下,还可以包括更多其他等效实施例,而本发明的范围由所附的权利要求范围决定。Note that the above are only preferred embodiments of the present invention and applied technical principles. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the protection scope of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and can also include more other equivalent embodiments without departing from the concept of the present invention. The scope is determined by the scope of the appended claims.
Claims (7)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201910828306.9A CN110515979B (en) | 2019-09-03 | 2019-09-03 | Data query method, device, device and storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201910828306.9A CN110515979B (en) | 2019-09-03 | 2019-09-03 | Data query method, device, device and storage medium |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN110515979A CN110515979A (en) | 2019-11-29 |
| CN110515979B true CN110515979B (en) | 2022-04-22 |
Family
ID=68630515
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201910828306.9A Active CN110515979B (en) | 2019-09-03 | 2019-09-03 | Data query method, device, device and storage medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN110515979B (en) |
Families Citing this family (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN111831692A (en) * | 2020-01-21 | 2020-10-27 | 北京嘀嘀无限科技发展有限公司 | Information processing method, device, equipment and storage medium |
| CN113254480B (en) * | 2020-02-13 | 2024-04-19 | 中国移动通信集团广东有限公司 | Data query method and device |
| CN111260257A (en) * | 2020-02-26 | 2020-06-09 | 平安科技(深圳)有限公司 | Risk control model construction method, risk control audit method, device and computer equipment |
| CN111708848B (en) * | 2020-06-12 | 2024-02-23 | 北京思特奇信息技术股份有限公司 | Data query method, system and electronic equipment |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101102367A (en) * | 2007-08-16 | 2008-01-09 | 华为技术有限公司 | Method and system for providing business information |
| CN104834691A (en) * | 2015-04-22 | 2015-08-12 | 中国建设银行股份有限公司 | Voice robot |
| CN105787768A (en) * | 2016-03-03 | 2016-07-20 | 陈包容 | Method and device for obtaining goods sales data |
| CN110019319A (en) * | 2017-09-30 | 2019-07-16 | 北京国双科技有限公司 | Data query method and device |
-
2019
- 2019-09-03 CN CN201910828306.9A patent/CN110515979B/en active Active
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101102367A (en) * | 2007-08-16 | 2008-01-09 | 华为技术有限公司 | Method and system for providing business information |
| CN104834691A (en) * | 2015-04-22 | 2015-08-12 | 中国建设银行股份有限公司 | Voice robot |
| CN105787768A (en) * | 2016-03-03 | 2016-07-20 | 陈包容 | Method and device for obtaining goods sales data |
| CN110019319A (en) * | 2017-09-30 | 2019-07-16 | 北京国双科技有限公司 | Data query method and device |
Also Published As
| Publication number | Publication date |
|---|---|
| CN110515979A (en) | 2019-11-29 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN110515979B (en) | Data query method, device, device and storage medium | |
| CN112800287B (en) | Full-text indexing method and system based on graph database | |
| CN111339171B (en) | Data query method, device and device | |
| CN104252501B (en) | A kind of computing device and method executing database manipulation order | |
| CN107103011B (en) | Method and device for realizing terminal data search | |
| CN111625552B (en) | Data collection method, device, equipment and readable storage medium | |
| CN106372266A (en) | Cache and accessing method of cloud operation system based on aspects and configuration documents | |
| CN104423982A (en) | Request processing method and device | |
| WO2024230502A1 (en) | Domain name resolution method and apparatus for content distribution network, electronic device, and storage medium | |
| CN116842292A (en) | Dynamic page caching methods, electronic devices, vehicles and storage media | |
| CN114398520A (en) | Data retrieval method, system, device, electronic device and storage medium | |
| CN116226275B (en) | Data query method and device, electronic device and readable storage medium | |
| CN106326317A (en) | Data processing method and device | |
| CN111061719B (en) | Data collection method, device, equipment and storage medium | |
| CN117971898A (en) | Data caching method and system, electronic equipment and storage medium | |
| US20240089339A1 (en) | Caching across multiple cloud environments | |
| CN116450805A (en) | Text processing method, device, equipment and storage medium | |
| CN115695521B (en) | Distributed session method and device | |
| WO2024159628A1 (en) | Ldap-based memory management method and apparatus, device, and storage medium | |
| CN115994148B (en) | Multi-table data updating method and device, electronic equipment and readable storage medium | |
| WO2024016789A1 (en) | Log data query method and apparatus, and device and medium | |
| CN118897845A (en) | A data query method, device, system and equipment | |
| CN111209304B (en) | Data processing method, device and system | |
| CN114281921A (en) | Data processing method, device, storage medium and device | |
| CN112181391A (en) | Method and system capable of dynamically expanding data |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant | ||
| PE01 | Entry into force of the registration of the contract for pledge of patent right |
Denomination of invention: Data query method, device, equipment and storage medium Granted publication date: 20220422 Pledgee: Guangzhou Bank Co.,Ltd. Shenzhen Yuehai Branch Pledgor: SHENZHEN LEXIN SOFTWARE TECHNOLOGY Co.,Ltd. Registration number: Y2025980032003 |
|
| PE01 | Entry into force of the registration of the contract for pledge of patent right |