[go: up one dir, main page]

CN115203246A - A joint table query method, device, electronic device and storage medium - Google Patents

A joint table query method, device, electronic device and storage medium Download PDF

Info

Publication number
CN115203246A
CN115203246A CN202210931199.4A CN202210931199A CN115203246A CN 115203246 A CN115203246 A CN 115203246A CN 202210931199 A CN202210931199 A CN 202210931199A CN 115203246 A CN115203246 A CN 115203246A
Authority
CN
China
Prior art keywords
field value
value
target
index value
mapping
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.)
Pending
Application number
CN202210931199.4A
Other languages
Chinese (zh)
Inventor
安琪
许欣
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Agricultural Bank of China
Original Assignee
Agricultural Bank of China
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Agricultural Bank of China filed Critical Agricultural Bank of China
Priority to CN202210931199.4A priority Critical patent/CN115203246A/en
Publication of CN115203246A publication Critical patent/CN115203246A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2246Trees, e.g. B+trees
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (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

本发明公开了一种联表查询方法、装置、电子设备及存储介质,包括:根据驱动表中各索引值与字段值之间的映射关系,构建与所述驱动表匹配的映射树;所述映射树中每个索引值对应至少一个字段值;获取与所述驱动表对应的被驱动表,对所述被驱动表中的各个字段值进行遍历,并将被驱动表中的各个字段值与映射树中的字段值进行比较;根据比较结果,在所述被驱动表中确定目标字段值以及目标索引值,并根据所述目标索引值确定联表查询结果。本发明实施例的技术方案可以减少联表查询过程中数据的遍历次数和比较次数,提高联表查询效率。

Figure 202210931199

The invention discloses a method, device, electronic device and storage medium for querying a linked table, comprising: constructing a mapping tree matching the driving table according to the mapping relationship between each index value and field value in the driving table; Each index value in the mapping tree corresponds to at least one field value; obtain the driven table corresponding to the driving table, traverse each field value in the driven table, and compare each field value in the driven table with the value of each field in the driven table. The field values in the mapping tree are compared; according to the comparison result, the target field value and the target index value are determined in the driven table, and the linked table query result is determined according to the target index value. The technical solutions of the embodiments of the present invention can reduce the number of times of traversal and comparison of data in the process of joint table query, and improve the efficiency of joint table query.

Figure 202210931199

Description

一种联表查询方法、装置、电子设备及存储介质A joint table query method, device, electronic device and storage medium

技术领域technical field

本发明涉及计算机技术领域,尤其涉及一种联表查询方法、装置、电子设备及存储介质。The present invention relates to the field of computer technology, and in particular, to a method, device, electronic device and storage medium for querying a linked table.

背景技术Background technique

随着计算机技术的发展,大多数业务系统会涉及到联表查询,联表查询方法的执行效率对于业务系统的响应性能至关重要。With the development of computer technology, most business systems will involve the query of the joint table, and the execution efficiency of the query method of the joint table is very important for the response performance of the business system.

现有技术中,联表查询方法主要有简单嵌套循环联接(Simple Nested-LoopsJoin,SNLJ)算法、基于索引的嵌套循环联接(Index Nested-Loops Join,INLJ)算法,以及基于块的嵌套循环联接(Block Nested-Loops Join,BNLJ)算法。由于SNLJ算法过于暴力,访问次数太多,因此现有技术中不常使用SNLJ算法。目前常用的就是BNLJ算法和INLJ算法。In the prior art, join table query methods mainly include Simple Nested-Loops Join (SNLJ) algorithm, Index Nested-Loops Join (INLJ) algorithm, and block-based nesting Loop join (Block Nested-Loops Join, BNLJ) algorithm. Because the SNLJ algorithm is too violent and the number of visits is too many, the SNLJ algorithm is not often used in the prior art. At present, the BNLJ algorithm and the INLJ algorithm are commonly used.

其中,BNLJ算法主要应用于被驱动表的联接字段没有索引的情况,对于大多数业务系统而言,在进行联表查询时通常都设有索引,所以INLJ算法是业务系统中最普遍适用的联表查询方法。但是,INLJ算法只善于处理重复率高的联接字段,对于联接字段重复率较低的场景,INLJ算法将退化为BNLJ算法,导致联表查询效率较低。Among them, the BNLJ algorithm is mainly used in the case where the join field of the driven table does not have an index. For most business systems, there is usually an index when performing a join table query, so the INLJ algorithm is the most commonly used in business systems. Table query method. However, the INLJ algorithm is only good at dealing with join fields with a high repetition rate. For scenarios with a low repetition rate of join fields, the INLJ algorithm will degenerate into the BNLJ algorithm, resulting in lower query efficiency for join tables.

发明内容SUMMARY OF THE INVENTION

本发明提供了一种联表查询方法、装置、电子设备及存储介质,可以减少联表查询过程中数据的遍历次数和比较次数,提高联表查询效率。The invention provides a joint table query method, device, electronic equipment and storage medium, which can reduce the number of times of traversing and comparison of data in the joint table query process and improve the joint table query efficiency.

根据本发明的一方面,提供了一种联表查询方法,包括:According to an aspect of the present invention, a method for querying a joint table is provided, comprising:

根据驱动表中各索引值与字段值之间的映射关系,构建与所述驱动表匹配的映射树;所述映射树中每个索引值对应至少一个字段值;According to the mapping relationship between each index value and field value in the driving table, a mapping tree matching the driving table is constructed; each index value in the mapping tree corresponds to at least one field value;

获取与所述驱动表对应的被驱动表,对所述被驱动表中的各个字段值进行遍历,并将被驱动表中的各个字段值与映射树中的字段值进行比较;Acquire the driven table corresponding to the driven table, traverse each field value in the driven table, and compare each field value in the driven table with the field value in the mapping tree;

根据比较结果,在所述被驱动表中确定目标字段值以及目标索引值,并根据所述目标索引值确定联表查询结果。According to the comparison result, a target field value and a target index value are determined in the driven table, and a linked table query result is determined according to the target index value.

可选的,在构建与所述驱动表匹配的映射树之后,还包括:Optionally, after building the mapping tree matching the drive table, the method further includes:

将所述映射树存储至预设的映射缓存区中;storing the mapping tree in a preset mapping buffer;

所述将被驱动表中的各个字段值与映射树中的字段值进行比较,包括:The comparison of each field value in the driven table with the field value in the mapping tree includes:

将被驱动表中的各个字段值,与所述映射缓存区中的字段值进行比较。Compare each field value in the driven table with the field value in the mapping buffer area.

可选的,根据比较结果,在所述被驱动表中确定目标字段值以及目标索引值,包括:Optionally, according to the comparison result, determine the target field value and the target index value in the driven table, including:

判断所述被驱动表中是否存在与映射树相同的字段值;Determine whether the driven table has the same field value as the mapping tree;

若是,则将所述字段值作为目标字段值,并将所述被驱动表中目标字段值对应的索引值作为目标索引值。If so, take the field value as the target field value, and take the index value corresponding to the target field value in the driven table as the target index value.

可选的,根据所述目标索引值确定联表查询结果,包括:Optionally, determining the query result of the join table according to the target index value, including:

判断所述目标索引值,是否与映射树上目标字段值对应的索引值相一致;Determine whether the target index value is consistent with the index value corresponding to the target field value on the mapping tree;

若是,则在所述被驱动表中获取目标索引值的关联数据,并将所述关联数据作为联表查询结果。If so, obtain the associated data of the target index value in the driven table, and use the associated data as the query result of the linked table.

可选的,所述索引值为驱动表中各字段值对应的主键值。Optionally, the index value is a primary key value corresponding to each field value in the driver table.

根据本发明的另一方面,提供了一种联表查询装置,所述装置包括:According to another aspect of the present invention, a joint table query device is provided, the device comprising:

映射树构建模块,用于根据驱动表中各索引值与字段值之间的映射关系,构建与所述驱动表匹配的映射树;所述映射树中每个索引值对应至少一个字段值;a mapping tree building module, configured to construct a mapping tree matching the driving table according to the mapping relationship between each index value and the field value in the driving table; each index value in the mapping tree corresponds to at least one field value;

遍历模块,用于获取与所述驱动表对应的被驱动表,对所述被驱动表中的各个字段值进行遍历,并将被驱动表中的各个字段值与映射树中的字段值进行比较;The traversal module is used to obtain the driven table corresponding to the driven table, traverse each field value in the driven table, and compare each field value in the driven table with the field value in the mapping tree ;

结果确定模块,用于根据比较结果,在所述被驱动表中确定目标字段值以及目标索引值,并根据所述目标索引值确定联表查询结果。The result determination module is configured to determine the target field value and the target index value in the driven table according to the comparison result, and determine the linked table query result according to the target index value.

可选的,所述映射树构建模块包括:Optionally, the mapping tree building module includes:

映射树存储单元,用于将所述映射树存储至预设的映射缓存区中;a mapping tree storage unit for storing the mapping tree in a preset mapping buffer area;

所述遍历模块包括:The traversal module includes:

比较单元,用于将被驱动表中的各个字段值,与所述映射缓存区中的字段值进行比较。The comparison unit is used for comparing each field value in the driven table with the field value in the mapping buffer area.

可选的,所述结果确定模块包括:Optionally, the result determination module includes:

字段值判断单元,用于判断所述被驱动表中是否存在与映射树相同的字段值;a field value judgment unit for judging whether the driven table has the same field value as the mapping tree;

目标字段值确定单元,用于所述被驱动表中存在与映射树相同的字段值时,将所述字段值作为目标字段值,并将所述被驱动表中目标字段值对应的索引值作为目标索引值。The target field value determination unit is used for taking the field value as the target field value when the driven table has the same field value as the mapping tree, and taking the index value corresponding to the target field value in the driven table as the target field value target index value.

根据本发明的另一方面,提供了一种电子设备,所述电子设备包括:According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

至少一个处理器;以及at least one processor; and

与所述至少一个处理器通信连接的存储器;其中,a memory communicatively coupled to the at least one processor; wherein,

所述存储器存储有可被所述至少一个处理器执行的计算机程序,所述计算机程序被所述至少一个处理器执行,以使所述至少一个处理器能够执行本发明任一实施例所述的联表查询方法。The memory stores a computer program executable by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform any of the embodiments of the present invention. Link table query method.

根据本发明的另一方面,提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机指令,所述计算机指令用于使处理器执行时实现本发明任一实施例所述的联表查询方法。According to another aspect of the present invention, a computer-readable storage medium is provided, where computer instructions are stored in the computer-readable storage medium, and the computer instructions are used to cause a processor to implement any of the embodiments of the present invention when executed. The join table query method.

本发明实施例提供的技术方案,通过根据驱动表中各索引值与字段值之间的映射关系,构建与所述驱动表匹配的映射树,获取与所述驱动表对应的被驱动表,对所述被驱动表中的各个字段值进行遍历,并将被驱动表中的各个字段值与映射树中的字段值进行比较,根据比较结果,在所述被驱动表中确定目标字段值以及目标索引值,并根据所述目标索引值确定联表查询结果的技术手段,可以减少联表查询过程中数据的遍历次数和比较次数,提高联表查询效率。According to the technical solution provided by the embodiment of the present invention, a mapping tree matching the driving table is constructed according to the mapping relationship between each index value and field value in the driving table, and the driven table corresponding to the driving table is obtained, and the corresponding driving table is obtained. Each field value in the driven table is traversed, and each field value in the driven table is compared with the field value in the mapping tree, and according to the comparison result, the target field value and the target field value are determined in the driven table. The technical means of determining the query result of the linked table according to the target index value can reduce the number of times of traversal and comparison of data in the process of the linked table query, and improve the efficiency of the linked table query.

应当理解,本部分所描述的内容并非旨在标识本发明的实施例的关键或重要特征,也不用于限制本发明的范围。本发明的其它特征将通过以下的说明书而变得容易理解。It should be understood that the content described in this section is not intended to identify key or critical features of the embodiments of the invention, nor is it intended to limit the scope of the invention. Other features of the present invention will become readily understood from the following description.

附图说明Description of drawings

为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the technical solutions in the embodiments of the present invention more clearly, the following briefly introduces the accompanying drawings used in the description of the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can also be obtained from these drawings without creative effort.

图1是根据本发明实施例提供的一种联表查询方法的流程图;1 is a flowchart of a method for querying a linked table according to an embodiment of the present invention;

图2是根据本发明实施例提供的另一种联表查询方法的流程图;2 is a flowchart of another method for querying a linked table provided according to an embodiment of the present invention;

图3是根据本发明实施例提供的另一种联表查询方法的流程图;3 is a flowchart of another method for querying a linked table provided according to an embodiment of the present invention;

图4是根据本发明实施例提供的一种联表查询装置的结构示意图;4 is a schematic structural diagram of a joint table query device provided according to an embodiment of the present invention;

图5是实现本发明实施例的联表查询方法的电子设备的结构示意图。FIG. 5 is a schematic structural diagram of an electronic device implementing the method for querying a linked table according to an embodiment of the present invention.

具体实施方式Detailed ways

为了使本技术领域的人员更好地理解本发明方案,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分的实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本发明保护的范围。In order to make those skilled in the art better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only Embodiments are part of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.

需要说明的是,本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本发明的实施例能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。It should be noted that the terms "first", "second" and the like in the description and claims of the present invention and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific sequence or sequence. It is to be understood that the data so used may be interchanged under appropriate circumstances such that the embodiments of the invention described herein can be practiced in sequences other than those illustrated or described herein. Furthermore, the terms "comprising" and "having" and any variations thereof, are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those expressly listed Rather, those steps or units may include other steps or units not expressly listed or inherent to these processes, methods, products or devices.

图1为本发明实施例一提供的一种联表查询方法的流程图,本实施例可适用于在业务系统关联的多个数据表中,查询目标数据的情况,该方法可以由联表查询装置来执行,该联表查询装置可以采用硬件和/或软件的形式实现,该联表查询装置可配置于具备数据处理功能的电子设备(例如终端或者服务器)中。如图1所示,该方法包括:FIG. 1 is a flowchart of a method for querying a linked table according to Embodiment 1 of the present invention. This embodiment can be applied to the case of querying target data in multiple data tables associated with a business system, and the method can be queried by a linked table. The combined table query device can be implemented in the form of hardware and/or software, and the combined table query device can be configured in an electronic device (such as a terminal or a server) with a data processing function. As shown in Figure 1, the method includes:

步骤110、根据驱动表中各索引值与字段值之间的映射关系,构建与所述驱动表匹配的映射树;所述映射树中每个索引值对应至少一个字段值。Step 110: Build a mapping tree matching the driving table according to the mapping relationship between each index value and field value in the driving table; each index value in the mapping tree corresponds to at least one field value.

在本实施例中,所述驱动表通常为数据库中数据量较少的数据表,其可以为结构化查询语言(Structured Query Language,SQL)语句执行过程中,被优先读取的数据表。索引可以为数据库中专门用于帮助用户快速查询数据的一种数据结构。具体的,索引可以为数据表的目录,在对数据表查找数据之前,用户可以先在目录中查找索引位置,以便快速定位查询数据。In this embodiment, the driving table is usually a data table with a small amount of data in the database, which may be a data table that is preferentially read during the execution of a Structured Query Language (SQL) statement. An index can be a data structure in a database that is specially used to help users query data quickly. Specifically, the index may be a directory of the data table. Before searching for data in the data table, the user may first search the index position in the directory, so as to quickly locate the query data.

在此步骤中,可以获取驱动表中各索引值与对应字段值之间的映射关系。其中,所述字段可以为驱动表与被驱动表之间的联接查询字段。所述被驱动表通常为数据库中数据量较大的数据表,其可以为SQL语句执行过程中,被后读取的数据表。In this step, the mapping relationship between each index value in the driver table and the corresponding field value can be obtained. Wherein, the field may be a join query field between the driving table and the driven table. The driven table is usually a data table with a large amount of data in the database, which may be a data table that is read later during the execution of the SQL statement.

在获取到驱动表中各索引值与字段值之间的映射关系后,可以根据所述映射关系构建映射树。具体的,当驱动表中索引值具备唯一性约束时,每个索引值则可以对应一个字段值;当索引值不具备唯一性约束时,每个索引值可以对应多个字段值。After acquiring the mapping relationship between each index value and field value in the drive table, a mapping tree can be constructed according to the mapping relationship. Specifically, when the index value in the driver table has the unique constraint, each index value can correspond to one field value; when the index value does not have the unique constraint, each index value can correspond to multiple field values.

步骤120、获取与所述驱动表对应的被驱动表,对所述被驱动表中的各个字段值进行遍历,并将被驱动表中的各个字段值与映射树中的字段值进行比较。Step 120: Acquire a driven table corresponding to the driven table, traverse each field value in the driven table, and compare each field value in the driven table with the field value in the mapping tree.

步骤130、根据比较结果,在所述被驱动表中确定目标字段值以及目标索引值,并根据所述目标索引值确定联表查询结果。Step 130: Determine a target field value and a target index value in the driven table according to the comparison result, and determine a linked table query result according to the target index value.

在此步骤中,可以判断被驱动表中是否存在与映射树相同的字段值,若是,则可以将该字段值作为目标字段值,并将被驱动表中与目标字段值对应的索引值,作为目标索引值,然后在所述被驱动表中获取目标索引值的关联数据,将此关联数据作为联表查询结果。In this step, it can be judged whether the driven table has the same field value as the mapping tree, if so, the field value can be used as the target field value, and the index value corresponding to the target field value in the driven table can be used as The target index value is obtained, and the associated data of the target index value is obtained in the driven table, and the associated data is used as the query result of the linked table.

现有技术中,大多数业务系统会涉及到联表查询。以金融业务系统为例,联表查询过程中可能涉及到大量的查询字段,例如申请人的申请信息、征信情况以及负债信息等。在这种情况下,一味新增查询字段会对数据库的写入性能造成影响;删除旧索引、改为联合索引等又会影响现有的业务。因此,现有的BNLJ算法和INLJ算法均不能满足实际的联表查询需求。In the prior art, most of the business systems will involve query of linked tables. Taking the financial business system as an example, a large number of query fields may be involved in the joint table query process, such as the applicant's application information, credit information, and debt information. In this case, blindly adding query fields will affect the write performance of the database; deleting the old index, changing to a joint index, etc. will affect the existing business. Therefore, the existing BNLJ algorithm and INLJ algorithm can not meet the actual query requirements of join tables.

在本实施例中,通过构建索引与字段之间的映射树,可以减少数据的遍历次数和比较次数,提高联表查询效率;其次,对于联接字段较多、重复率较低的场景,可以满足实际的联表查询需求,提高联表查询方法的适用性。In this embodiment, by building a mapping tree between indexes and fields, the number of data traversals and comparisons can be reduced, and the query efficiency of join tables can be improved; The actual query requirements of the joint table, improve the applicability of the joint table query method.

本发明实施例提供的技术方案,通过根据驱动表中各索引值与字段值之间的映射关系,构建与所述驱动表匹配的映射树,获取与所述驱动表对应的被驱动表,对所述被驱动表中的各个字段值进行遍历,并将被驱动表中的各个字段值与映射树中的字段值进行比较,根据比较结果,在所述被驱动表中确定目标字段值以及目标索引值,并根据所述目标索引值确定联表查询结果的技术手段,可以减少联表查询过程中数据的遍历次数和比较次数,提高联表查询效率。According to the technical solution provided by the embodiment of the present invention, a mapping tree matching the driving table is constructed according to the mapping relationship between each index value and field value in the driving table, and the driven table corresponding to the driving table is obtained, and the corresponding driving table is obtained. Each field value in the driven table is traversed, and each field value in the driven table is compared with the field value in the mapping tree, and according to the comparison result, the target field value and the target field value are determined in the driven table. The technical means of determining the query result of the linked table according to the target index value can reduce the number of times of traversal and comparison of data in the process of the linked table query, and improve the efficiency of the linked table query.

图2为本发明实施例二提供的一种联表查询方法的流程图,本实施例是对上述实施例的进一步细化。如图2所示,该方法包括:FIG. 2 is a flowchart of a method for querying a joint table according to Embodiment 2 of the present invention. This embodiment is a further refinement of the above-mentioned embodiment. As shown in Figure 2, the method includes:

步骤210、根据驱动表中各索引值与字段值之间的映射关系,构建与所述驱动表匹配的映射树。Step 210: Build a mapping tree matching the driving table according to the mapping relationship between each index value and the field value in the driving table.

在本实施例的一个实施方式中,所述索引值为驱动表中各字段值对应的主键值ID。具体的,假设所述字段为“name”,则可以获取驱动表中不同ID与“name”值之间的映射关系,并根据所述映射关系构建映射树。In one implementation of this embodiment, the index value is the primary key value ID corresponding to each field value in the drive table. Specifically, assuming that the field is "name", the mapping relationship between different IDs in the driver table and the "name" value can be obtained, and a mapping tree can be constructed according to the mapping relationship.

步骤220、将所述映射树存储至预设的映射缓存区中。Step 220: Store the mapping tree in a preset mapping buffer.

在此步骤中,可以基于buffer机制,将所述映射树存储至映射缓存区(map_buffer)中。In this step, the map tree may be stored in a map buffer (map_buffer) based on a buffer mechanism.

步骤230、获取与所述驱动表对应的被驱动表,对所述被驱动表中的各个字段值进行遍历。Step 230: Acquire a driven table corresponding to the driving table, and traverse each field value in the driven table.

步骤240、将被驱动表中的各个字段值,与所述映射缓存区中的字段值进行比较。Step 240: Compare each field value in the driven table with the field value in the mapping buffer area.

这样设置的好处在于,通过将映射树存储至map_buffer中,可以将驱动表中的记录缓存下来,减少驱动表中数据的遍历次数,实现对联接查询方法进行优化。The advantage of this setting is that by storing the map tree in the map_buffer, the records in the driver table can be cached, reducing the number of traversals of the data in the driver table, and optimizing the join query method.

步骤250、根据比较结果,在所述被驱动表中确定目标字段值以及目标索引值,并根据所述目标索引值确定联表查询结果。Step 250: Determine a target field value and a target index value in the driven table according to the comparison result, and determine a linked table query result according to the target index value.

本发明实施例提供的技术方案,通过根据驱动表中各索引值与字段值之间的映射关系,构建与所述驱动表匹配的映射树,将所述映射树存储至预设的映射缓存区中,获取与所述驱动表对应的被驱动表,对所述被驱动表中的各个字段值进行遍历,将被驱动表中的各个字段值,与所述映射缓存区中的字段值进行比较,根据比较结果,在所述被驱动表中确定目标字段值以及目标索引值,并根据所述目标索引值确定联表查询结果的技术手段,可以减少联表查询过程中数据的遍历次数和比较次数,提高联表查询效率。According to the technical solution provided by the embodiments of the present invention, a mapping tree matching the driving table is constructed according to the mapping relationship between each index value and field value in the driving table, and the mapping tree is stored in a preset mapping buffer area. , obtain the driven table corresponding to the driven table, traverse each field value in the driven table, and compare each field value in the driven table with the field value in the mapping buffer area , according to the comparison result, determine the target field value and the target index value in the driven table, and determine the technical means of the query result of the linked table according to the target index value, which can reduce the number of times of traversing and comparison of data in the query process of the linked table The number of times to improve the query efficiency of the joint table.

图3为本发明实施例三提供的一种联表查询方法的流程图,本实施例是对上述实施例的进一步细化。如图3所示,该方法包括:FIG. 3 is a flowchart of a joint table query method provided in Embodiment 3 of the present invention, and this embodiment is a further refinement of the above-mentioned embodiment. As shown in Figure 3, the method includes:

步骤310、根据驱动表中各索引值与字段值之间的映射关系,构建与所述驱动表匹配的映射树。Step 310: Build a mapping tree matching the driving table according to the mapping relationship between each index value and the field value in the driving table.

步骤320、获取与所述驱动表对应的被驱动表,对所述被驱动表中的各个字段值进行遍历,并将被驱动表中的各个字段值与映射树中的字段值进行比较。Step 320: Acquire a driven table corresponding to the driven table, traverse each field value in the driven table, and compare each field value in the driven table with the field value in the mapping tree.

步骤330、判断所述被驱动表中是否存在与映射树相同的字段值,若是,执行步骤340,若否,执行步骤370。Step 330: Determine whether the driven table has the same field value as the mapping tree, if yes, go to step 340, if not, go to step 370.

步骤340、将所述字段值作为目标字段值,并将所述被驱动表中目标字段值对应的索引值作为目标索引值。Step 340: Use the field value as the target field value, and use the index value corresponding to the target field value in the driven table as the target index value.

步骤350、判断所述目标索引值,是否与映射树上目标字段值对应的索引值相一致,若是,执行步骤360,若否,执行步骤370。Step 350: Determine whether the target index value is consistent with the index value corresponding to the target field value on the mapping tree, if so, go to step 360, if not, go to step 370.

步骤360、在所述被驱动表中获取目标索引值的关联数据,并将所述关联数据作为联表查询结果。Step 360: Acquire the associated data of the target index value in the driven table, and use the associated data as the query result of the linked table.

步骤370、结束联表查询过程。Step 370: End the query process of the joint table.

在一个具体的实施方式中,假设在联接查询具体业务中,有数据表a(数据量约一千万)与数据表b(数据量约十万),ID为组织表内数据的聚集索引,name为数据表a与数据表b之间的联接查询字段。由于数据表a的数据量远大于数据表b,则可以将数据表b作为驱动表,将数据表a作为被驱动表。In a specific implementation, it is assumed that in the specific business of join query, there are data table a (data volume of about 10 million) and data table b (data volume of about 100,000), ID is the clustered index of the data in the organization table, name is the join query field between data table a and data table b. Since the data volume of data table a is much larger than that of data table b, data table b can be used as a driving table, and data table a can be used as a driven table.

在联接查询过程中,可以逐行遍历驱动表b,并根据驱动表b中不同ID与name值之间的映射关系构建映射树,然后将所述映射树存储至map_buffer中,在存储完成之后逐行遍历被驱动表a,判断被驱动表a中的各name值是否与驱动表b中的name值一致,如果一致,则比较该name值在被驱动表a中的ID是否与映射树中的ID一致,如果一致,则在被驱动表a中获取与该ID对应的关联数据,并将此关联数据作为联表结果。During the join query process, the driver table b can be traversed row by row, and a mapping tree can be constructed according to the mapping relationship between different IDs and name values in the driver table b, and then the mapping tree is stored in the map_buffer. The row traverses the driven table a, and judges whether each name value in the driven table a is consistent with the name value in the driving table b. If they are consistent, compare whether the ID of the name value in the driven table a is the same as the one in the mapping tree. The IDs are consistent. If they are consistent, the associated data corresponding to the ID is obtained in the driven table a, and the associated data is used as the result of the associated table.

现有技术中,以上述数据表为例,采用INLJ算法进行联表查询时,需要先遍历驱动表b,读取每一行数据再依次遍历被驱动表a,遍历次数为十万*一千万。采用BNLJ算法进行联表查询时,需要逐行遍历驱动表b,将每一行的数据分块存于join_buffer中,且join_buffer中的数据是无序的,所以在遍历被驱动表a时,每行数据需要比较十万次,总的遍历次数为一千万零十万次,比较次数为一千万*十万(也即一亿)次。In the prior art, taking the above data table as an example, when using the INLJ algorithm to perform a joint table query, it is necessary to traverse the driving table b first, read each row of data, and then traverse the driven table a in turn, and the number of traversals is 100,000 * 10 million. . When using the BNLJ algorithm for join table query, it is necessary to traverse the driving table b row by row, and store the data of each row in the join_buffer in blocks, and the data in the join_buffer is out of order, so when traversing the driven table a, each row The data needs to be compared 100,000 times, the total number of traversals is 10,000,000 times, and the number of comparisons is 10 million * 100,000 (ie, 100 million) times.

在本实施例中,相比于现有技术而言,通过构建映射树,可以实现遍历次数为一千万零十万次,比较次数少于一亿次,由此可以提高联表查询效率;其次,通过将字段与索引进行双重比较,可以提高联表查询结果的准确性。In this embodiment, compared with the prior art, by constructing a mapping tree, the number of traversal times can be 10,000,000, and the number of comparisons is less than 100 million times, thereby improving the query efficiency of join tables; Second, by double-comparing the field with the index, the accuracy of the query result of the join table can be improved.

本发明实施例提供的技术方案,通过根据驱动表中各索引值与字段值之间的映射关系,构建与所述驱动表匹配的映射树,获取与所述驱动表对应的被驱动表,对所述被驱动表中的各个字段值进行遍历,并将被驱动表中的各个字段值与映射树中的字段值进行比较,判断所述被驱动表中是否存在与映射树相同的字段值,若是,将所述字段值作为目标字段值,并将所述被驱动表中目标字段值对应的索引值作为目标索引值,判断所述目标索引值,是否与映射树上目标字段值对应的索引值相一致,若是,在所述被驱动表中获取目标索引值的关联数据,并将所述关联数据作为联表查询结果的技术手段,可以减少联表查询过程中数据的遍历次数和比较次数,提高联表查询效率。According to the technical solution provided by the embodiment of the present invention, a mapping tree matching the driving table is constructed according to the mapping relationship between each index value and field value in the driving table, and the driven table corresponding to the driving table is obtained, and the corresponding driving table is obtained. Each field value in the driven table is traversed, and each field value in the driven table is compared with the field value in the mapping tree to determine whether the driven table has the same field value as the mapping tree, If so, take the field value as the target field value, and take the index value corresponding to the target field value in the driven table as the target index value, and judge whether the target index value is the index corresponding to the target field value on the mapping tree If the values are consistent, if so, obtain the associated data of the target index value in the driven table, and use the associated data as a technical means for the query result of the associated table, which can reduce the number of times of traversal and comparison of data in the process of querying the associated table. , to improve the query efficiency of the joint table.

图4为本发明实施例四提供的一种联表查询装置的结构示意图,如图4所示,该装置包括:映射树构建模块410、遍历模块420和结果确定模块430。FIG. 4 is a schematic structural diagram of a joint table query device according to Embodiment 4 of the present invention. As shown in FIG. 4 , the device includes: a mapping tree construction module 410 , a traversal module 420 and a result determination module 430 .

其中,映射树构建模块410,用于根据驱动表中各索引值与字段值之间的映射关系,构建与所述驱动表匹配的映射树;所述映射树中每个索引值对应至少一个字段值;Wherein, the mapping tree construction module 410 is configured to construct a mapping tree matching the driving table according to the mapping relationship between each index value and field value in the driving table; each index value in the mapping tree corresponds to at least one field value;

遍历模块420,用于获取与所述驱动表对应的被驱动表,对所述被驱动表中的各个字段值进行遍历,并将被驱动表中的各个字段值与映射树中的字段值进行比较;The traversal module 420 is configured to obtain the driven table corresponding to the driven table, traverse each field value in the driven table, and compare each field value in the driven table with the field value in the mapping tree. Compare;

结果确定模块430,用于根据比较结果,在所述被驱动表中确定目标字段值以及目标索引值,并根据所述目标索引值确定联表查询结果。The result determination module 430 is configured to determine a target field value and a target index value in the driven table according to the comparison result, and determine a linked table query result according to the target index value.

本发明实施例提供的技术方案,通过根据驱动表中各索引值与字段值之间的映射关系,构建与所述驱动表匹配的映射树,获取与所述驱动表对应的被驱动表,对所述被驱动表中的各个字段值进行遍历,并将被驱动表中的各个字段值与映射树中的字段值进行比较,根据比较结果,在所述被驱动表中确定目标字段值以及目标索引值,并根据所述目标索引值确定联表查询结果的技术手段,可以减少联表查询过程中数据的遍历次数和比较次数,提高联表查询效率。According to the technical solution provided by the embodiment of the present invention, a mapping tree matching the driving table is constructed according to the mapping relationship between each index value and field value in the driving table, and the driven table corresponding to the driving table is obtained, and the corresponding driving table is obtained. Each field value in the driven table is traversed, and each field value in the driven table is compared with the field value in the mapping tree, and according to the comparison result, the target field value and the target field value are determined in the driven table. The technical means of determining the query result of the linked table according to the target index value can reduce the number of times of traversal and comparison of data in the process of the linked table query, and improve the efficiency of the linked table query.

在上述实施例的基础上,所述索引值为驱动表中各字段值对应的主键值。Based on the above embodiment, the index value is the primary key value corresponding to each field value in the drive table.

所述映射树构建模块410包括:The mapping tree building module 410 includes:

映射树存储单元,用于将所述映射树存储至预设的映射缓存区中。The mapping tree storage unit is used for storing the mapping tree in a preset mapping buffer area.

所述遍历模块420包括:The traversal module 420 includes:

比较单元,用于将被驱动表中的各个字段值,与所述映射缓存区中的字段值进行比较。The comparison unit is used for comparing each field value in the driven table with the field value in the mapping buffer area.

所述结果确定模块430包括:The result determination module 430 includes:

字段值判断单元,用于判断所述被驱动表中是否存在与映射树相同的字段值;a field value judgment unit for judging whether the driven table has the same field value as the mapping tree;

目标字段值确定单元,用于所述被驱动表中存在与映射树相同的字段值时,将所述字段值作为目标字段值,并将所述被驱动表中目标字段值对应的索引值作为目标索引值;The target field value determination unit is used for taking the field value as the target field value when the driven table has the same field value as the mapping tree, and taking the index value corresponding to the target field value in the driven table as the target field value target index value;

索引值判断单元,用于判断所述目标索引值,是否与映射树上目标字段值对应的索引值相一致;an index value judgment unit for judging whether the target index value is consistent with the index value corresponding to the target field value on the mapping tree;

关联数据获取单元,用于在所述被驱动表中获取目标索引值的关联数据,并将所述关联数据作为联表查询结果。The associated data obtaining unit is configured to obtain the associated data of the target index value in the driven table, and use the associated data as the query result of the associated table.

上述装置可执行本发明前述所有实施例所提供的方法,具备执行上述方法相应的功能模块和有益效果。未在本发明实施例中详尽描述的技术细节,可参见本发明前述所有实施例所提供的方法。The above-mentioned apparatus can execute the methods provided by all the foregoing embodiments of the present invention, and has corresponding functional modules and beneficial effects for executing the above-mentioned methods. For technical details not described in detail in the embodiments of the present invention, reference may be made to the methods provided by all the foregoing embodiments of the present invention.

图5示出了可以用来实施本发明的实施例的电子设备10的结构示意图。电子设备旨在表示各种形式的数字计算机,诸如,膝上型计算机、台式计算机、工作台、个人数字助理、服务器、刀片式服务器、大型计算机、和其它适合的计算机。电子设备还可以表示各种形式的移动装置,诸如,个人数字处理、蜂窝电话、智能电话、可穿戴设备(如头盔、眼镜、手表等)和其它类似的计算装置。本文所示的部件、它们的连接和关系、以及它们的功能仅仅作为示例,并且不意在限制本文中描述的和/或者要求的本发明的实现。FIG. 5 shows a schematic structural diagram of an electronic device 10 that can be used to implement embodiments of the present invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic devices may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smart phones, wearable devices (eg, helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are by way of example only, and are not intended to limit implementations of the inventions described and/or claimed herein.

如图5所示,电子设备10包括至少一个处理器11,以及与至少一个处理器11通信连接的存储器,如只读存储器(ROM)12、随机访问存储器(RAM)13等,其中,存储器存储有可被至少一个处理器执行的计算机程序,处理器11可以根据存储在只读存储器(ROM)12中的计算机程序或者从存储单元18加载到随机访问存储器(RAM)13中的计算机程序,来执行各种适当的动作和处理。在RAM 13中,还可存储电子设备10操作所需的各种程序和数据。处理器11、ROM 12以及RAM 13通过总线14彼此相连。输入/输出(I/O)接口15也连接至总线14。As shown in FIG. 5, the electronic device 10 includes at least one processor 11, and a memory, such as a read only memory (ROM) 12, a random access memory (RAM) 13, etc., connected in communication with the at least one processor 11, wherein the memory stores There is a computer program executable by at least one processor, and the processor 11 can be executed according to a computer program stored in a read only memory (ROM) 12 or loaded from a storage unit 18 into a random access memory (RAM) 13. Various appropriate actions and processes are performed. In the RAM 13, various programs and data necessary for the operation of the electronic device 10 can also be stored. The processor 11 , the ROM 12 and the RAM 13 are connected to each other through a bus 14 . An input/output (I/O) interface 15 is also connected to the bus 14 .

电子设备10中的多个部件连接至I/O接口15,包括:输入单元16,例如键盘、鼠标等;输出单元17,例如各种类型的显示器、扬声器等;存储单元18,例如磁盘、光盘等;以及通信单元19,例如网卡、调制解调器、无线通信收发机等。通信单元19允许电子设备10通过诸如因特网的计算机网络和/或各种电信网络与其他设备交换信息/数据。Various components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a magnetic disk, an optical disk, etc. etc.; and a communication unit 19, such as a network card, modem, wireless communication transceiver, and the like. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices through a computer network such as the Internet and/or various telecommunication networks.

处理器11可以是各种具有处理和计算能力的通用和/或专用处理组件。处理器11的一些示例包括但不限于中央处理单元(CPU)、图形处理单元(GPU)、各种专用的人工智能(AI)计算芯片、各种运行机器学习模型算法的处理器、数字信号处理器(DSP)、以及任何适当的处理器、控制器、微控制器等。处理器11执行上文所描述的各个方法和处理,例如联表查询方法。The processor 11 may be various general and/or special purpose processing components having processing and computing capabilities. Some examples of processors 11 include, but are not limited to, central processing units (CPUs), graphics processing units (GPUs), various specialized artificial intelligence (AI) computing chips, various processors that run machine learning model algorithms, digital signal processing processor (DSP), and any suitable processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the linked table query method.

在一些实施例中,联表查询方法可被实现为计算机程序,其被有形地包含于计算机可读存储介质,例如存储单元18。在一些实施例中,计算机程序的部分或者全部可以经由ROM 12和/或通信单元19而被载入和/或安装到电子设备10上。当计算机程序加载到RAM 13并由处理器11执行时,可以执行上文描述的联表查询方法的一个或多个步骤。备选地,在其他实施例中,处理器11可以通过其他任何适当的方式(例如,借助于固件)而被配置为执行联表查询方法。In some embodiments, the linked table query method may be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as storage unit 18 . In some embodiments, part or all of the computer program may be loaded and/or installed on the electronic device 10 via the ROM 12 and/or the communication unit 19 . When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the linked table lookup method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the linked table lookup method by any other suitable means (eg, by means of firmware).

本文中以上描述的系统和技术的各种实施方式可以在数字电子电路系统、集成电路系统、场可编程门阵列(FPGA)、专用集成电路(ASIC)、专用标准产品(ASSP)、芯片上系统的系统(SOC)、负载可编程逻辑设备(CPLD)、计算机硬件、固件、软件、和/或它们的组合中实现。这些各种实施方式可以包括:实施在一个或者多个计算机程序中,该一个或者多个计算机程序可在包括至少一个可编程处理器的可编程系统上执行和/或解释,该可编程处理器可以是专用或者通用可编程处理器,可以从存储系统、至少一个输入装置、和至少一个输出装置接收数据和指令,并且将数据和指令传输至该存储系统、该至少一个输入装置、和该至少一个输出装置。Various implementations of the systems and techniques described herein above may be implemented in digital electronic circuitry, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips system (SOC), load programmable logic device (CPLD), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include being implemented in one or more computer programs executable and/or interpretable on a programmable system including at least one programmable processor that The processor, which may be a special purpose or general-purpose programmable processor, may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device an output device.

用于实施本发明的方法的计算机程序可以采用一个或多个编程语言的任何组合来编写。这些计算机程序可以提供给通用计算机、专用计算机或其他可编程数据处理装置的处理器,使得计算机程序当由处理器执行时使流程图和/或框图中所规定的功能/操作被实施。计算机程序可以完全在机器上执行、部分地在机器上执行,作为独立软件包部分地在机器上执行且部分地在远程机器上执行或完全在远程机器或服务器上执行。Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/operations specified in the flowcharts and/or block diagrams to be carried out. The computer program may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.

在本发明的上下文中,计算机可读存储介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地使用的计算机程序。计算机可读存储介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。备选地,计算机可读存储介质可以是机器可读信号介质。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in connection with the instruction execution system, apparatus or device. Computer-readable storage media may include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices, or devices, or any suitable combination of the foregoing. Alternatively, the computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media would include one or more wire-based electrical connections, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), fiber optics, compact disk read only memory (CD-ROM), optical storage, magnetic storage, or any suitable combination of the foregoing.

为了提供与用户的交互,可以在电子设备上实施此处描述的系统和技术,该电子设备具有:用于向用户显示信息的显示装置(例如,CRT(阴极射线管)或者LCD(液晶显示器)监视器);以及键盘和指向装置(例如,鼠标或者轨迹球),用户可以通过该键盘和该指向装置来将输入提供给电子设备。其它种类的装置还可以用于提供与用户的交互;例如,提供给用户的反馈可以是任何形式的传感反馈(例如,视觉反馈、听觉反馈、或者触觉反馈);并且可以用任何形式(包括声输入、语音输入或者、触觉输入)来接收来自用户的输入。To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having a display device (eg, a CRT (cathode ray tube) or an LCD (liquid crystal display)) for displaying information to the user monitor); and a keyboard and pointing device (eg, a mouse or trackball) through which a user can provide input to the electronic device. Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (eg, visual feedback, auditory feedback, or tactile feedback); and can be in any form (including acoustic input, voice input, or tactile input) to receive input from the user.

可以将此处描述的系统和技术实施在包括后台部件的计算系统(例如,作为数据服务器)、或者包括中间件部件的计算系统(例如,应用服务器)、或者包括前端部件的计算系统(例如,具有图形用户界面或者网络浏览器的用户计算机,用户可以通过该图形用户界面或者该网络浏览器来与此处描述的系统和技术的实施方式交互)、或者包括这种后台部件、中间件部件、或者前端部件的任何组合的计算系统中。可以通过任何形式或者介质的数字数据通信(例如,通信网络)来将系统的部件相互连接。通信网络的示例包括:局域网(LAN)、广域网(WAN)、区块链网络和互联网。The systems and techniques described herein may be implemented on a computing system that includes back-end components (eg, as a data server), or a computing system that includes middleware components (eg, an application server), or a computing system that includes front-end components (eg, a user computer having a graphical user interface or web browser through which a user may interact with implementations of the systems and techniques described herein), or including such backend components, middleware components, Or any combination of front-end components in a computing system. The components of the system may be interconnected by any form or medium of digital data communication (eg, a communication network). Examples of communication networks include: Local Area Networks (LANs), Wide Area Networks (WANs), blockchain networks, and the Internet.

计算系统可以包括客户端和服务器。客户端和服务器一般远离彼此并且通常通过通信网络进行交互。通过在相应的计算机上运行并且彼此具有客户端-服务器关系的计算机程序来产生客户端和服务器的关系。服务器可以是云服务器,又称为云计算服务器或云主机,是云计算服务体系中的一项主机产品,以解决了传统物理主机与VPS服务中,存在的管理难度大,业务扩展性弱的缺陷。A computing system can include clients and servers. Clients and servers are generally remote from each other and usually interact through a communication network. The relationship of client and server arises by computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also known as a cloud computing server or a cloud host. It is a host product in the cloud computing service system to solve the traditional physical host and VPS services, which are difficult to manage and weak in business scalability. defect.

应该理解,可以使用上面所示的各种形式的流程,重新排序、增加或删除步骤。例如,本发明中记载的各步骤可以并行地执行也可以顺序地执行也可以不同的次序执行,只要能够实现本发明的技术方案所期望的结果,本文在此不进行限制。It should be understood that steps may be reordered, added or deleted using the various forms of flow shown above. For example, the steps described in the present invention can be performed in parallel, sequentially or in different orders, and as long as the desired results of the technical solutions of the present invention can be achieved, no limitation is imposed herein.

上述具体实施方式,并不构成对本发明保护范围的限制。本领域技术人员应该明白的是,根据设计要求和其他因素,可以进行各种修改、组合、子组合和替代。任何在本发明的精神和原则之内所作的修改、等同替换和改进等,均应包含在本发明保护范围之内。The above-mentioned specific embodiments do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modifications, equivalent replacements and improvements made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.

Claims (10)

1. A method for performing a link lookup, comprising:
constructing a mapping tree matched with a driving table according to the mapping relation between each index value and each field value in the driving table; each index value in the mapping tree corresponds to at least one field value;
acquiring a driven table corresponding to the driving table, traversing each field value in the driven table, and comparing each field value in the driven table with a field value in a mapping tree;
and according to the comparison result, determining a target field value and a target index value in the driven table, and determining an associative table query result according to the target index value.
2. The method of claim 1, after constructing the mapping tree matching the driving table, further comprising:
storing the mapping tree into a preset mapping cache region;
comparing each field value in the driven table with the field values in the mapping tree, including:
each field value in the driven table is compared with the field value in the mapping cache region.
3. The method of claim 1, wherein determining a target field value and a target index value in the driven table based on the comparison comprises:
judging whether the field value identical to the mapping tree exists in the driven table or not;
and if so, taking the field value as a target field value, and taking an index value corresponding to the target field value in the driven table as a target index value.
4. The method of claim 1, wherein determining a joint table query result from the target index value comprises:
judging whether the target index value is consistent with an index value corresponding to a target field value on a mapping tree or not;
and if so, acquiring the associated data of the target index value in the driven table, and taking the associated data as an associated table query result.
5. The method of claim 1, wherein the index value is a primary key value corresponding to each field value in a driving table.
6. A link lookup apparatus, comprising:
the mapping tree construction module is used for constructing a mapping tree matched with the driving table according to the mapping relation between each index value and the field value in the driving table; each index value in the mapping tree corresponds to at least one field value;
the traversal module is used for acquiring a driven table corresponding to the driving table, traversing each field value in the driven table, and comparing each field value in the driven table with a field value in a mapping tree;
and the result determining module is used for determining a target field value and a target index value in the driven table according to the comparison result, and determining an associated table query result according to the target index value.
7. The apparatus of claim 6, wherein the map tree construction module comprises:
the mapping tree storage unit is used for storing the mapping tree into a preset mapping cache region;
the traversal module comprises:
and the comparison unit is used for comparing each field value in the driven table with the field value in the mapping cache region.
8. The apparatus of claim 6, wherein the result determination module comprises:
a field value judging unit for judging whether a field value identical to a mapping tree exists in the driven table;
and the target field value determining unit is used for taking the field value as a target field value and taking an index value corresponding to the target field value in the driven table as a target index value when the field value identical to the mapping tree exists in the driven table.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the associative table lookup method of any one of claims 1-5.
10. A computer-readable storage medium storing computer instructions for causing a processor to perform the associative table lookup method according to any one of claims 1 to 5 when executed.
CN202210931199.4A 2022-08-04 2022-08-04 A joint table query method, device, electronic device and storage medium Pending CN115203246A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210931199.4A CN115203246A (en) 2022-08-04 2022-08-04 A joint table query method, device, electronic device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210931199.4A CN115203246A (en) 2022-08-04 2022-08-04 A joint table query method, device, electronic device and storage medium

Publications (1)

Publication Number Publication Date
CN115203246A true CN115203246A (en) 2022-10-18

Family

ID=83585322

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210931199.4A Pending CN115203246A (en) 2022-08-04 2022-08-04 A joint table query method, device, electronic device and storage medium

Country Status (1)

Country Link
CN (1) CN115203246A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116166844A (en) * 2022-12-09 2023-05-26 北京东土拓明科技有限公司 Data output method, device, electronic equipment and computer readable medium
CN117112626A (en) * 2023-08-25 2023-11-24 北京奥星贝斯科技有限公司 An optimization method and device for nested loop queries

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020078015A1 (en) * 2000-11-22 2002-06-20 Sybase, Inc. Database system with methodogy providing faster n-ary nested loop joins
CN101685449A (en) * 2008-09-26 2010-03-31 国际商业机器公司 Method and system for connecting tables in a plurality of heterogeneous distributed databases
CN110009514A (en) * 2019-03-07 2019-07-12 平安科技(深圳)有限公司 Extracting method, device, terminal and the computer readable storage medium of data
CN110597808A (en) * 2019-08-20 2019-12-20 阿里巴巴集团控股有限公司 Distributed database table connection method, device, system, server and medium
US10642840B1 (en) * 2018-03-07 2020-05-05 Amazon Technologies, Inc. Filtered hash table generation for performing hash joins

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020078015A1 (en) * 2000-11-22 2002-06-20 Sybase, Inc. Database system with methodogy providing faster n-ary nested loop joins
CN101685449A (en) * 2008-09-26 2010-03-31 国际商业机器公司 Method and system for connecting tables in a plurality of heterogeneous distributed databases
US10642840B1 (en) * 2018-03-07 2020-05-05 Amazon Technologies, Inc. Filtered hash table generation for performing hash joins
CN110009514A (en) * 2019-03-07 2019-07-12 平安科技(深圳)有限公司 Extracting method, device, terminal and the computer readable storage medium of data
CN110597808A (en) * 2019-08-20 2019-12-20 阿里巴巴集团控股有限公司 Distributed database table connection method, device, system, server and medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
MIHAELA A. BORNEA等: "Double index nested-loop reactive join for result rate optimization", 2009 IEEE 25TH INTERNATIONAL CONFERENCE ON DATA ENGINEERING, 10 April 2009 (2009-04-10), pages 481 - 492 *
王雷: "面向分布式数据库的连接查询优化", 中国优秀硕士学位论文全文数据库信息科技辑, no. 01, 15 January 2018 (2018-01-15), pages 138 - 927 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116166844A (en) * 2022-12-09 2023-05-26 北京东土拓明科技有限公司 Data output method, device, electronic equipment and computer readable medium
CN117112626A (en) * 2023-08-25 2023-11-24 北京奥星贝斯科技有限公司 An optimization method and device for nested loop queries

Similar Documents

Publication Publication Date Title
CN113220710B (en) Data query method, device, electronic device and storage medium
CN118643120A (en) Code retrieval method and device based on large language model
CN114281823A (en) Table processing method, device, equipment, storage medium and product
CN112528067A (en) Graph database storage method, graph database reading method, graph database storage device, graph database reading device and graph database reading equipment
CN115203246A (en) A joint table query method, device, electronic device and storage medium
CN113868254B (en) Method, device and storage medium for removing duplication of entity node in graph database
CN114817223A (en) Service data extraction method and device, electronic equipment and storage medium
CN115145924A (en) Data processing method, device, equipment and storage medium
CN114780022A (en) Method and device for realizing write-addition operation, electronic equipment and storage medium
CN117743688A (en) Service provision methods, devices, electronic equipment and media for large model scenes
CN114936246B (en) A Redis data management method, device, equipment, storage medium and product
CN113609100B (en) Data storage method, data query device and electronic equipment
CN115328956A (en) AI-based data query method, device and storage medium
CN114625761A (en) Optimization method, optimization device, electronic equipment and medium
CN114880357A (en) Source code information retrieval method and device, electronic equipment, storage medium and product
CN114443802A (en) Interface document processing method and device, electronic equipment and storage medium
CN115935027B (en) Data processing method of target object topological graph and training method of graph classification model
CN118467579A (en) A database structure processing method, device, equipment and storage medium
CN116450715B (en) Information integration data processing method, system, electronic equipment and storage medium
CN114328855B (en) Document retrieval methods, devices, electronic devices, and readable storage media
CN116340318A (en) Method, device, equipment and storage medium for processing secondary index record
CN115329150A (en) Method, apparatus, electronic device and storage medium for generating search condition tree
CN115328917A (en) Query method, device, equipment and storage medium
CN116955394A (en) Data query method, device, equipment and medium
CN115017145A (en) Data expansion method, device and storage medium

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