Data query method and device, storage medium and electronic equipment

By transforming single-dimensional data queries into multi-dimensional queries and using the target inverted index to merge the data query results, the problem of index bloat in high-dimensional data queries is solved, thereby reducing retrieval complexity and improving speed.

CN116775689BActive Publication Date: 2025-11-21TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210220119.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-08
Publication Date
2025-11-21
Estimated Expiration
2042-03-08

AI Technical Summary

Technical Problem

Existing technologies suffer from index bloat in high-dimensional data queries, leading to increased retrieval complexity and decreased retrieval speed, thus affecting database query performance.

Method used

This transforms single-dimensional data queries into multi-dimensional data queries. By using mapping to split the first data into multiple second data, and by using the target inverted index to merge the query results, the complexity of retrieval is reduced.

Benefits of technology

By reducing the retrieval complexity to O(logn), the retrieval speed is significantly improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116775689B_ABST
    Figure CN116775689B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a data query method and device, a storage medium and an electronic device, which can be applied in the fields of databases, cloud technology, intelligent driving, etc. The method comprises: obtaining a query condition comprising first data; performing mapping processing on the first data based on a preset mapping mode to obtain at least two second data; determining, for each second data, a target inverted index corresponding to the second data; obtaining a query result for the second data based on the target inverted index, and fusing each query result based on the query condition to obtain a target query result corresponding to the first data. The present application reduces the retrieval complexity and greatly improves the retrieval speed.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present application relate to the technical field of computer, and in particular, to a data query method and device, a storage medium and an electronic device. BACKGROUND

[0002] Data query is a basic problem involved in database management. With the increase of information contained in data, the speed of data query will also decrease accordingly, especially for high-dimensional data, the query method used in the related technology will cause the problem of index expansion, thereby causing significant increase in retrieval complexity and significant decrease in retrieval speed. Thus, the performance of programs running based on database query is affected. SUMMARY

[0003] To solve at least one of the above technical problems, embodiments of the present application provide a data query method and device, a storage medium and an electronic device.

[0004] In one aspect, a data query method is provided, which includes:

[0005] obtaining a query condition including first data;

[0006] performing mapping processing on the first data based on a preset mapping manner to obtain at least two second data, each second data carrying part of information corresponding to the first data;

[0007] for each second data, determining a target inverted index corresponding to the second data, the target inverted index being an inverted index determined based on the query condition and the second data, the inverted index being used to record identification information of data records associated with the second data;

[0008] obtaining a query result for the second data based on the target inverted index, and fusing each query result based on the query condition to obtain a target query result corresponding to the first data, the target query result including identification information possessed by data records whose relationship with the first data meets the query condition.

[0009] In another aspect, a data query device is provided, which includes:

[0010] a query element obtaining module configured to obtain a query condition including first data;

[0011] a mapping processing module configured to perform mapping processing on the first data based on a preset mapping manner to obtain at least two second data, each second data carrying part of information corresponding to the first data;

[0012] determining, for each second data, a target inverted index corresponding to the second data, the target inverted index being an inverted index determined based on the query condition and the second data, the inverted index being used to record identification information of a data record associated with the second data;

[0013] determining, for each second data, a target inverted index corresponding to the second data, the target inverted index being an inverted index determined based on the query condition and the second data, the inverted index being used to record identification information of a data record associated with the second data;

[0014] In another aspect, an embodiment of the present application provides a computer readable storage medium, the computer readable storage medium storing at least one instruction or at least one program, the at least one instruction or the at least one program being loaded and executed by a processor to implement the data query method.

[0015] In another aspect, an embodiment of the present application provides an electronic device, including at least one processor, and a memory connected with the at least one processor in communication; wherein the memory stores instructions executable by the at least one processor, and the at least one processor implements the data query method by executing the instructions stored in the memory.

[0016] In another aspect, an embodiment of the present application provides a computer program product, including a computer program or instructions, the computer program or instructions being executed by a processor to implement the data query method.

[0017] The data query method provided by the present application can query each information of the first data in the query condition respectively, that is, convert the single-dimension retrieval for one first data into multi-dimension retrieval for multiple second data, thereby reducing the retrieval complexity and greatly improving the retrieval speed. This technical solution can reduce the retrieval complexity to o(logn). BRIEF DESCRIPTION OF DRAWINGS

[0018] In order to more clearly illustrate the technical solutions and advantages of the embodiments of the present application or related technologies, the drawings needed in the embodiment or related technology description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and those skilled in the art can obtain other drawings according to these drawings without creative labor.

[0019] Figure 1 is a flowchart of a data query method provided by an embodiment of the present specification;

[0020] Figure 2 is a schematic diagram of query result fusion based on query conditions provided by an embodiment of the specification;

[0021] Figure 3 is a flowchart of obtaining a query result for the second data based on the target inverted index provided by an embodiment of the specification;

[0022] Figure 4 is a schematic diagram of a determination method for associating a query result and a query result corresponding to the current second sub-data provided by an embodiment of the specification;

[0023] Figure 5 is a flowchart of a query method in a query example provided by an embodiment of the application;

[0024] Figure 6 is a block diagram of a data query device provided by an embodiment of the application;

[0025] Figure 7 is a hardware structure schematic diagram of a device for implementing the method provided by an embodiment of the application provided by an embodiment of the application;

[0026] Figure 8 is a hardware structure schematic diagram of another device for implementing the method provided by an embodiment of the application provided by an embodiment of the application. DETAILED DESCRIPTION

[0027] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present application.

[0028] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or server including a series of steps or units does not necessarily limit to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0029] In order to make the purposes, technical solutions and advantages of the embodiments of the present application clearer, the embodiments of the present application are further described in detail below with reference to the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the embodiments of the present application and not to limit the embodiments of the present application.

[0030] Hereinafter, the terms "first" and "second" are only used for description purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Therefore, the features defined with "first" and "second" can explicitly or implicitly include one or more features. In the description of the embodiments, unless otherwise specified, the meaning of "a plurality of" is two or more. In order to facilitate understanding of the above technical solutions and the technical effects generated by the embodiments of the present application, the embodiments of the present application first explain the related professional terms:

[0031] Intelligent Traffic System (ITS) is also called Intelligent Transportation System, which is an advanced scientific technology (information technology, computer technology, data communication technology, sensor technology, electronic control technology, automatic control theory, operations research, artificial intelligence, etc.) effectively integrated into transportation, service control and vehicle manufacturing, to strengthen the connection between vehicles, roads and users, thus forming a comprehensive transportation system that ensures safety, improves efficiency, improves the environment and saves energy.

[0032] Intelligent Vehicle Infrastructure Cooperative Systems (IVICS), simply referred to as vehicle-road cooperative system, is a development direction of Intelligent Traffic System (ITS). Vehicle-road cooperative system is to use advanced wireless communication and new generation Internet technology to implement dynamic real-time information interaction between vehicles and roads in all directions, and to develop vehicle active safety control and road cooperative management based on full-time and space dynamic traffic information collection and fusion, to fully realize the effective cooperation of man, vehicle and road, to ensure traffic safety and improve traffic efficiency, thus forming a safe, efficient and environmentally friendly road traffic system.

[0033] High-dimensional data: data with more information of values, such as data with more types or ranges of values, is called high-dimensional data. For example, in a log retrieval system, the time stamp is in milliseconds, and the time range within a day calculated in milliseconds is [0-24*60*60*100], which contains 24*60*60*1000 different values. Such data is called high-dimensional data.

[0034] Range search: specify the data range interval, and find out which data contains the specified range of values.

[0035] BKD tree: a dynamic index data structure that can efficiently and scalable index large multidimensional point data sets. It has very high space utilization and excellent query and update performance, and these three performances still hold under high intensity update.

[0036] Inverted index: derived from the need to find records according to the value of the attribute in practical applications. Each item in this index table includes an attribute value and the address of each record with the attribute value. Since the attribute value is not determined by the record, but the position of the record is determined by the attribute value, it is called inverted index. The file with inverted index is called inverted index file, abbreviated as inverted file.

[0037] In the related art, for many data, especially high-dimensional data, traditional inverted index or BKD tree can be used for query. These methods are applied to high-dimensional data, and in range search, the former involves a large number of index items, and the latter involves a large number of unordered data record identification information, which will bring a large search overhead. Specifically, the scheme of using inverted index for query in the related art applied to high-dimensional data scenarios will have the problem of index expansion, on the one hand, it occupies a large amount of space, on the other hand, it also brings a great cost to the search, especially in range search, a large number of index contents need to be processed.

[0038] Therefore, the embodiment of the present application provides a data query method, which can query each information of the first data in the query condition respectively, that is, convert the single-dimensional search for one first data into multi-dimensional search for multiple second data, thereby reducing the search complexity and greatly improving the search speed. This technical scheme can reduce the search complexity to o(logn). For example, in an actual search case, multi-dimensional search can simplify the large range search involving 100,000 index items under inverted index into several small range searches involving only dozens of index items. o(logn) represents that when the data increases n times, the time consumption increases logn times, where log is the base 2, for example, when the data increases 256 times, the time consumption only increases 8 times.

[0039] The embodiments of the present application can relate to cloud technology. Cloud technology refers to a series of resources such as hardware, software, network, etc. unified in a wide area network or a local area network to realize the calculation, storage, processing and sharing of data. Cloud technology can be used to build specific scenarios of multiple servers. Cloud technology is a general term for network technology, information technology, integration technology, management platform technology, application technology, etc. based on cloud computing business model application, which can form a resource pool, and can be used on demand, flexibly and conveniently. Cloud computing technology will become an important support. The background service of the technical network system needs a large amount of calculation and storage resources, such as video websites, image websites and more portals. With the high development and application of the Internet industry, every item in the future may have its own identification mark and needs to be transmitted to the background system for logical processing. Different levels of data will be processed separately, and various industry data need strong system support, which can only be realized through cloud computing.

[0040] The embodiments of the present application can be applied to various cloud applications provided based on cloud technology. For example, private cloud, public cloud or hybrid cloud. Private cloud (Private Cloud) is to create cloud infrastructure and hardware and software resources within a firewall for sharing resources in a data center by departments in an organization or enterprise. In addition to hardware resources, cloud devices (IaaS, Infrastructure as a Service) software are generally created for private clouds. Public cloud (Public Cloud) generally refers to a cloud that a third party provider provides for users to use. Public cloud can be used through the Internet, which can be free or low cost. The core attribute of public cloud is shared resource service. Such a cloud has many instances and can provide services in today's entire open public network. Hybrid cloud (Hybrid Cloud) combines public cloud (Public Cloud) and private cloud (Private Cloud), which is the main mode and development direction of cloud computing in recent years.

[0041] The method provided by the embodiments of the present application can also relate to blockchain, that is, the method provided by the embodiments of the present application can be implemented based on blockchain, or the data involved in the method provided by the embodiments of the present application can be stored based on blockchain, or the execution subject of the method provided in the embodiments of the present application can be located in the blockchain. Blockchain is a new application mode of distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm and other computer technologies. Blockchain (Blockchain) is essentially a decentralized database, which is a series of data blocks associated using cryptographic methods. Each data block contains information about a batch of network transactions, which is used to verify the validity (anti-fake) of the information and generate the next block. Blockchain can include blockchain underlying platform, platform product service layer and application service layer.

[0042] The blockchain underlying platform can include user management, basic service, smart contract and other processing modules. Among them, the user management module is responsible for the identity information management of all blockchain participants, including maintaining the generation of public and private keys (account management), key management, and the maintenance of the correspondence between the real identity of the user and the blockchain address (permission management), etc., and under authorization, supervising and auditing the transaction of certain real identities, providing risk control rule configuration (risk audit); the basic service module is deployed on all blockchain node devices to verify the validity of business requests, and after consensus on valid requests, it is recorded on the storage. For a new business request, the basic service first performs interface adaptation analysis and authentication processing (interface adaptation), then encrypts the business information through a consensus algorithm (consensus management), and after encryption, it is transmitted to the shared ledger (network communication) in a complete and consistent manner, and is recorded and stored; the smart contract module is responsible for contract registration and issuance, contract triggering and contract execution. Developers can define contract logic through a certain programming language, publish it to the blockchain (contract registration), trigger execution according to the logic of the contract terms, complete the contract logic, and also provide contract upgrade and cancellation functions.

[0043] The platform product service layer provides basic capabilities and implementation frameworks for typical applications. Developers can add business features based on these basic capabilities to complete the blockchain implementation of business logic. The application service layer provides application services based on the blockchain solution for business participants to use.

[0044] The following introduces a data query method of an embodiment of the application. The information involved in the disclosure can be information authorized by the user or authorized by all parties.

[0045] Figure 1 A flowchart of a data query method provided by an embodiment of the application is shown. The embodiment provides the method operation steps as described above in the embodiment or flowchart, but more or fewer operation steps can be included based on conventional or non-creative labor. The order of the steps listed in the embodiment is only one of the many execution orders, and does not represent the only execution order. In actual system, terminal device or server product execution, the method order shown in the embodiment or the drawing can be executed in sequence or in parallel (for example, in a parallel processor or multi-threaded processing environment). The above method can include:

[0046] S101. Obtain a query condition including first data.

[0047] The embodiment of the present application does not limit the first data, which is the data required by the query. The data in the data processing system can be queried according to the first data and the query condition. The data processing system refers to a system that can perform basic operations such as querying and storing data. Of course, the data involved in the embodiment of the present application can be high-dimensional data, and the advantage of the embodiment of the present application is more obvious in the high-dimensional data scenario. The present application does not limit the query condition, which can include equal, greater than, less than, contain, exclude, etc.

[0048] For example, the first data is 10000, and the query condition can be used to query which data records the data greater than 10000 exist in, and the identification information of the data records is taken as the query result. Alternatively, the first data is 10000 and 20000, and the query condition can be used to query which data records the data greater than 10000 and less than 20000 exist in, and the identification information of the data records is taken as the query result.

[0049] S102. Based on the preset mapping mode, the first data is mapped to obtain at least two second data, each of which carries part of the information corresponding to the first data.

[0050] The embodiment of the present application does not limit the specific way of mapping processing, and in fact, as long as the first data can be reasonably split into multiple second data, and there is no information intersection between each second data, such as using bit segmentation, multiple bits as a group of segmentation, or bit hashing, or multiple bits as a group of hashing, etc. For example, assuming that the first data is 16897898889000, the information contained therein is divided into 8 groups, and 8 second data [00, 00, 0f, 5e, 59, 42, bf, 28] can be obtained.

[0051] S103. For each second data, determine the target inverted index corresponding to the second data, the target inverted index being an inverted index determined based on the query condition and the second data, and the inverted index being used to record the identification information of the data record associated with the second data.

[0052] The inverted index in the embodiment of the present application has three kinds, which are respectively a first inverted index, a second inverted index and a third inverted index. The target inverted index in step S103 can be at least one of the first inverted index, the second inverted index or the third inverted index corresponding to the second data. Of course, the above three kinds of inverted indexes corresponding to the obtained data can be established before the data query execution in the embodiment of the present application. Taking data A as an example, the data corresponding to the first inverted index of data A can also be mapped to data A by the data stored in the identification information pointed by the data record. The data corresponding to the second inverted index of data A can be mapped to data smaller than data A by the data stored in the identification information pointed by the data record. The data corresponding to the third inverted index of data A can be mapped to data greater than data A by the data stored in the identification information pointed by the data record.

[0053] Taking data B as an example, it is mapped to a plurality of data based on the above mapping mode, wherein data A is taken as an example, and the above three kinds of inverted indexes corresponding to each of the plurality of data are established. In the embodiment of the present application, the identification information can also be represented by a doc ID, and the content corresponding to the inverted index is represented by a posting list.

[0054] Taking data A as an example, the establishment mode of the first inverted index corresponding to data A is that the doc ID corresponding to the data with the following characteristics is stored in the posting list corresponding to the first inverted index: the data corresponding to the field where data A is located is the same as data A after the data is processed by the above mapping. Because the data pointed by the doc ID in the posting list corresponding to the first inverted index has the above characteristics, the first inverted index is also called an equal inverted index.

[0055] The establishment mode of the second inverted index corresponding to data A is that the doc ID corresponding to the data with the following characteristics is stored in the posting list corresponding to the second inverted index: the data corresponding to the field where data A is located is smaller than data A after the data is processed by the above mapping. Because the data pointed by the doc ID in the posting list corresponding to the second inverted index has the above characteristics, the second inverted index is also called a less inverted index.

[0056] The establishment mode of the third inverted index corresponding to data A is that the doc ID corresponding to the data with the following characteristics is stored in the posting list corresponding to the third inverted index: the data corresponding to the field where data A is located is greater than data A after the data is processed by the above mapping. Because the data pointed by the doc ID in the posting list corresponding to the third inverted index has the above characteristics, the third inverted index is also called a greater inverted index.

[0057] In one embodiment, an equivalent inverted index can be constructed for each data mapped by data B, and based on the equivalent inverted index, a less inverted index and a greater inverted index can be established for each equivalent inverted index.

[0058] S104. Based on the target inverted index, a query result for the second data is obtained, and each query result is fused based on the query condition to obtain a target query result corresponding to the first data, wherein the target query result includes identification information possessed by a data record whose relationship with the first data meets the query condition.

[0059] In one embodiment, the query condition includes an equivalent query condition, and for each second data, the target inverted index corresponding to the second data is determined by determining the first inverted index corresponding to the second data as the target inverted index, wherein the first data record corresponding to the identification information stored in the first inverted index meets the first mapping rule with the second data, and the first mapping rule is that the first mapping data is equal to the second data, and the first mapping data is data corresponding to the second data obtained by performing the mapping processing on the first data record based on the mapping mode; correspondingly, the fusion of each query result based on the query condition to obtain the target query result corresponding to the first data includes obtaining the target query result corresponding to the first data based on the intersection of each query result.

[0060] For example, if the first data is data W, which is mapped into multiple second data, i.e. W1, W2 and W3. If the query condition requires to query the identification information of the data record containing data W, the intersection of the equivalent inverted index corresponding to W1, W2 and W3 can be determined as the target query result corresponding to data W.

[0061] In one embodiment, the query condition is a range query condition, and for each second data, the target inverted index corresponding to the second data is determined by:

[0062] The at least one of the first inverted index (equivalent inverted index), the second inverted index (less inverted index) and the third inverted index (greater inverted index) corresponding to the second data is determined as the target inverted index, the second data record corresponding to the identification information stored in the second inverted index satisfies a second mapping rule with the second data, and the third data record corresponding to the identification information stored in the third inverted index satisfies a third mapping rule with the second data. The second mapping rule is that the second mapping data is less than the second data, and the second mapping data is data corresponding to the second data obtained by performing the mapping processing on the second data record based on the mapping manner. The third mapping rule is that the third mapping data is greater than the second data, and the third mapping data is data corresponding to the second data obtained by performing the mapping processing on the third data record based on the mapping manner. The fusing of the query results based on the query condition to obtain the target query result corresponding to the first data includes: obtaining the target query result corresponding to the first data based on the union set of the query results.

[0063] Please refer to Figure 2 , which shows a schematic diagram of fusing query results based on query conditions. In response to the case that the query condition is an equal query, the target query result is determined according to the intersection of each query result, in response to the case that the query condition is a range query, the target query result is determined according to the union set of each query result, and in the fusing process of the query results, the boundary information of the range query also needs to be considered, and the target query result is further obtained by correcting the union set of each query result based on the boundary information.

[0064] In the case of a range query, the first data includes a first target (min_value) and a second target (max_value), and if the query condition is used to represent the data record that is greater than the first target and less than the second target, that is, the case that the query condition corresponds to the meaning of the retrieval expression (min_value, max_value), the second data also includes the second sub-data corresponding to the first target and the second sub-data corresponding to the second target. The second sub-data (the first target corresponding second sub-data) obtained based on min_value can include min_value_a, min_value_b, min_value_c, and the second sub-data (the second target corresponding second sub-data) obtained based on max_value can include max_value_a, max_value_b, max_value_c.

[0065] As Figure 3As shown, the query result for the second data based on the target inverted index includes:

[0066] S201. Determine the current second sub-data, the current second sub-data including the current first associated data and the current second associated data, the current first associated data being the current second sub-data corresponding to the first target, and the current second associated data being the current second sub-data corresponding to the second target.

[0067] In the embodiments of the present application, the query result corresponding to each current second sub-data can be obtained by cyclically executing the steps S201-S203. Taking the sequence 1 formed by the second data including the second sub-data corresponding to the first target and the sequence 2 formed by the second data including the second sub-data corresponding to the second target as an example, the corresponding data can be sequentially selected as the current second sub-data from the front to the back of the sequence 1 and the sequence 2 synchronously.

[0068] For example, the sequence 1 includes min_value_a, min_value_b, min_value_c, and the sequence 2 includes max_value_a, max_value_b, max_value_c. In the first cycle, min_value_a and max_value_a are taken as the current second sub-data, in the next cycle, min_value_b and max_value_b are taken as the current second sub-data, and so on.

[0069] S202. Determine the associated query result according to the current first associated data and the current second associated data.

[0070] S203. Obtain the query result corresponding to the current second sub-data by using the associated query result.

[0071] Please refer to Figure 4 which shows the determination method of the associated query result and the query result corresponding to the current second sub-data. In response to the first occurrence of the current first associated data being equal to the current second associated data in the query process, the associated query result can be determined according to the first inverted index corresponding to the current first associated data or the first inverted index corresponding to the current second associated data. The query result corresponding to the current second sub-data is obtained by using the associated query result, including: determining a temporary query result, obtaining the intersection of the associated query result and the temporary query result, obtaining the query result corresponding to the current second sub-data, and updating the temporary query result based on the query result corresponding to the current second sub-data.

[0072] The temporary query result equal_base, in response to the first occurrence of the current first associated data and the current second associated data being equal in the query process, can represent the universal set formed by all stored data. That is, the intersection of the equal value posting list using the current first associated data or the equal value posting list using the current second associated data and the equal_base is the equal_base of the next query.

[0073] In response to the current first associated data and the current second associated data not being equal for the first time, the associated query result is determined according to the first inverted index corresponding to the current first associated data or the first inverted index corresponding to the current second associated data. The query result corresponding to the current second sub-data is obtained by using the intersection of the associated query result and the last obtained query result.

[0074] In response to the first occurrence of the current first associated data and the current second associated data being not equal in the query process, the associated query result is determined according to the intersection of the third inverted index corresponding to the current first associated data and the second inverted index corresponding to the current second associated data. The query result corresponding to the current second sub-data is obtained by using the intersection of the associated query result and the temporary query result. Before the query result corresponding to the current second sub-data is obtained by using the associated query result, the method further includes: obtaining a first associated result (lower_base) based on the intersection of the first inverted index corresponding to the current first associated data and the temporary query result; obtaining a second associated result (upper_base) based on the intersection of the first inverted index corresponding to the current second associated data and the temporary query result.

[0075] That is, if the above-mentioned current first associated data and the above-mentioned current second associated data are not equal for the first time, the intersection of the posting list in the greator inverted index of the current first associated data and the posting list in the less inverted index of the current second associated data, and the intersection with equal_base, are taken as the query result corresponding to the current second sub-data. The intersection of the posting list in the equal inverted index of the current first associated data and equal_base is taken as the first associated result (lower_base); the intersection of the posting list in the equal inverted index of the current second associated data and equal_base is taken as the second associated result (upper_base).

[0076] In the case where the above-mentioned current first associated data and the above-mentioned current second associated data are not equal, and this situation is not the first time, the first query sub-result is determined according to the second inverted index corresponding to the above-mentioned current second associated data and the above-mentioned second associated result; the second query sub-result is determined according to the third inverted index corresponding to the above-mentioned current first associated data and the above-mentioned first associated result; the above-mentioned associated query result is determined based on the union set of the above-mentioned first query sub-result and the above-mentioned second query sub-result, and the above-mentioned associated query result is determined as the query result corresponding to the above-mentioned current second sub-data. Moreover, the intersection of the above-mentioned first inverted index corresponding to the above-mentioned current second associated data and the above-mentioned second associated result is used to update the above-mentioned second associated result; the intersection of the above-mentioned first inverted index corresponding to the above-mentioned current first associated data and the above-mentioned first associated result is used to update the above-mentioned first associated result.

[0077] That is, if the above-mentioned current first associated data and the above-mentioned current second associated data are not equal, and this situation is not the first time, the intersection of the posting_list in the less inverted index of the current second associated data and up_bound_base, and the intersection of the posting_list in the greater inverted index of the current first associated data and low_bound_base, are taken as the query result corresponding to the current second sub-data. The intersection of the posting_list in the equal inverted index of the current second associated data and up_bound_base is taken as the up_bound_base in the next cycle; the intersection of the posting_list in the equal inverted index of the current first associated data and low_bound_base is taken as the low_bound_base in the next cycle.

[0078] In the above query condition is to query greater than or equal to the first target and less than the second target data record, the above based on the union of each query result, the first data corresponding to the target query result, including: based on each of the query results and the first associated results of the union, the first data corresponding to the target query result. The query condition is to query greater than the first target and less than or equal to the second target data record, the above based on the union of each query result, the first data corresponding to the target query result, including: based on each of the query results and the second associated results of the union, the first data corresponding to the target query result. The query condition is to query greater than or equal to the first target and less than or equal to the second target data record, the above based on the union of each query result, the first data corresponding to the target query result, including: based on each of the query results, the first associated results and the second associated results of the union, the first data corresponding to the target query result.

[0079] As shown in the following with a specific example to illustrate the above query process: Figure 5

[0080] In this example, the query condition of the range query is: timestamp>16897898889000AND timestamp<=16897899000000, timestamp represents the timestamp, which is a high-dimensional data, that is, the query in (16897898889000, 16897899000000] data record, that is, the first target min_value is 16897898889000, the second target max_value is 16897899000000.

[0081] First step: mapping min_value and max_value respectively. Map min_value to 8 second sub-data = [00,00,0f,5e,59,42,bf,28], and map max_value to 8 second sub-data [00,00,0f,5e,59,44,70,c0]. [00,00,0f,5e,59,42,bf,28] is the sequence 10 formed by the second sub-data corresponding to the first target, and [00,00,0f,5e,59,44,70,c0] is the sequence 20 formed by the second sub-data corresponding to the second target.

[0082] Second step: based on the query process of loop traversal, specifically:

[0083] ​The first data from the left of sequence 10 and sequence 20 is obviously equal to 0, so equal_base is equal to the equal posting list in the case that the value at the position corresponding to the first data is 0.

[0084] The second data from the left of sequence 10 and sequence 20 is obviously equal to 0, so equal_base = equal_base intersected with the equal posting list in the case that the value at the second data is 0. In this application, "=" means that the expression corresponding to the symbol is executed in the order from the right to the left.

[0085] The third data from the left of sequence 10 and sequence 20 is obviously equal to 0f, so equal_base = equal_base intersected with the equal posting list in the case that the value at the third data is 0f.

[0086] The fourth data from the left of sequence 10 and sequence 20 is obviously equal to 5e, so equal_base = equal_base intersected with the equal posting list in the case that the value at the fourth data is 5e.

[0087] The fifth data from the left of sequence 10 and sequence 20 is obviously equal to 59, so equal_base = equal_base intersected with the posting list in the case that the value at the fifth data is 59.

[0088] The sixth data from the left of sequence 10 and sequence 20: the current first associated data (min_current) is 42, the current second associated data (max_current) is 44, and the first occurrence of inequality occurs, in which case the following operations are performed:

[0089] i. The query result corresponding to the sixth data = min_current 42 corresponding greater inverted index posting list intersected with max_current 44 corresponding less inverted index posting list, and then intersected with equal_base.

[0090] ii. The first associated result low_base is the intersection of the equal posting list of min_current 42 and equal_base.

[0091] iii. The second associated result upper_base is the intersection of the equal posting list of max_current 44 and equal_base.

[0092] Read the seventh data from left of sequence 10 and sequence 20: min_currente = bf, max_current = 70, which is not the first time, then perform the following operation in this case:

[0093] i. The query result corresponding to the seventh data = (the intersection of the posting list of the less inverted index of max_current 70 and the second associated result upper_base) + (the intersection of the posting list of the greater inverted index of min_currente bf and lower_base)

[0094] ii. upper_base = the intersection of the equivalent posting list of max_current 70 and upper_base;

[0095] iii. lower_base = the intersection of the equivalent posting list of min_currente bf and lower_base;

[0096] Read the eighth data from left of sequence 10 and sequence 20: min_currente = 28, max_current = c0, which is not the first time, then perform the following operation in this case:

[0097] i. The query result corresponding to the eighth data = (the intersection of the posting list of the less inverted index of max_current c0 and upper_base) + (the intersection of the posting list of the greater inverted index of min_currente 28 and lower_base)

[0098] ii. upper_base = the intersection of the equivalent posting list of max_current c0 and upper_base;

[0099] iii. lower_base = the intersection of the equivalent posting list of min_currente 28 and lower_base;

[0100] The third step: based on the union of the query results in each loop section to obtain the final target query result, of course, since the right side is a closed interval, the union of the query results in each loop section also needs to add the union of upper_base to obtain the above target query result.

[0101] From the above process, it can be seen that each cycle needs to do at most 4 intersection and 1 union operation; 8 cycles at most 32 intersection operations and 8 union operations; and each cycle at most involves 3 inverted indexes, theoretically, a total of at most only 24 inverted indexes are involved in the query process. Especially for relatively ordered data, such as timestamps, the corresponding posting list has strong aggregation, and in the bitmap calculation mode, the operation cost will be greatly reduced, and the specific performance can be determined by further testing.

[0102] For example, because of the same data, multiple sub-data can be mapped out, and each sub-data corresponds to a dimension. Each mapped sub-data has 8 bits, a value range of 256, and can be divided into 256 parts. This structure can make each dimension pass to the next dimension be 1 / 256 of the remaining data. Because at most only one value of the posting list is passed to the downstream, the convergence speed of each dimension pruning is very fast. For example, there are 100 million data, and the pruning starts from the 4th dimension. The 4th dimension only passes 390,000 data to the third dimension; to the second dimension, there are only 1500 data left, and the first dimension is left with only 6 data. In principle, in an ideal case (data is not out of order), the data of each dimension is continuously distributed in large blocks (divided into 256 blocks), so there are only 256 operations for each dimension, and if there are 4 dimensions, there are only about 1000 operations. In the actual implementation process, the lazy calculation mode can be used to further reduce the calculation cost. In actual implementation, the input and output operations of each dimension can be fully parallel.

[0103] Specific to real application scenarios, if it is a second / millisecond timestamp, the number of dimensions corresponding to each time range is as follows. Based on the following data, the embodiments of the application can significantly improve the query speed.

[0104]

[0105] Please refer to Figure 6 which shows a block diagram of a data query device in the embodiment. The device includes:

[0106] The query element acquisition module 101 is configured to acquire a query condition including first data.

[0107] The mapping processing module 102 is configured to perform mapping processing on the first data based on a preset mapping manner to obtain at least two second data, each of which carries part of information corresponding to the first data.

[0108] The inverted index determination module 103 is configured to determine, for each second data, a target inverted index corresponding to the second data, the target inverted index being an inverted index determined based on the query condition and the second data, and the inverted index being used to record identification information of a data record associated with the second data.

[0109] The query result determination module 104 is configured to obtain a query result for the second data based on the target inverted index, and fuse each query result based on the query condition to obtain a target query result corresponding to the first data, the target query result including identification information possessed by a data record whose relationship with the first data meets the query condition.

[0110] In one embodiment, the inverted index determination module 103 is configured to perform the following operations:

[0111] The query condition includes an equal value query condition, the first inverted index corresponding to the second data is determined as the target inverted index, and the relationship between the first data record corresponding to the identification information stored in the first inverted index and the second data meets a first mapping rule,

[0112] The first mapping rule is that a first mapping data is equal to the second data, and the first mapping data is data corresponding to the second data and obtained by performing the mapping processing on the first data record based on the mapping manner;

[0113] The fusion of each query result based on the query condition to obtain the target query result corresponding to the first data includes obtaining the target query result corresponding to the first data based on an intersection of each query result.

[0114] In one embodiment, the inverted index determination module 103 is configured to perform the following operations:

[0115] The query condition is a range query condition, at least one of a first inverted index corresponding to the second data, a second inverted index, and a third inverted index is determined as the target inverted index, the relationship between a second data record corresponding to the identification information stored in the second inverted index and the second data meets a second mapping rule, and the relationship between a third data record corresponding to the identification information stored in the third inverted index and the second data meets a third mapping rule,

[0116] The second mapping rule is that a second mapping data is less than the second data, and the second mapping data is data corresponding to the second data and obtained by performing the mapping processing on the second data record based on the mapping manner;

[0117] The third mapping rule is that the third mapping data is greater than the second data, and the third mapping data is data corresponding to the second data obtained by performing the mapping on the third data record based on the mapping manner;

[0118] The merging of the query results based on the query condition comprises: obtaining the target query result corresponding to the first data based on a union set of the query results.

[0119] In one embodiment, the first data comprises a first target and a second target, the query condition is used to represent data records greater than the first target and less than the second target, the second data comprises second sub-data corresponding to the first target and second sub-data corresponding to the second target, and the query result determination module 104 is configured to perform the following operations:

[0120] determine current second sub-data, wherein the current second sub-data comprises current first associated data and current second associated data, the current first associated data is current second sub-data corresponding to the first target, and the current second associated data is current second sub-data corresponding to the second target;

[0121] determine an associated query result based on the current first associated data and the current second associated data;

[0122] obtain the query result corresponding to the current second sub-data by using the associated query result.

[0123] In one embodiment, the query result determination module 104 is configured to perform the following operations:

[0124] in response to a situation where the current first associated data and the current second associated data are equal for the first time in a query process, determine the associated query result based on a first inverted index corresponding to the current first associated data or a first inverted index corresponding to the current second associated data;

[0125] determine a temporary query result, obtain the query result corresponding to the current second sub-data by using an intersection of the associated query result and the temporary query result, and update the temporary query result based on the query result corresponding to the current second sub-data.

[0126] In one embodiment, the query result determination module 104 is configured to perform the following operations:

[0127] In response to the current first association data and the current second association data not being equal for the first time, the association query result is determined according to the first inverted index corresponding to the current first association data or the first inverted index corresponding to the current second association data.

[0128] The query result corresponding to the current second sub-data is obtained by using the intersection of the association query result and the last obtained query result.

[0129] In an embodiment, the query result determination module 104 is configured to perform the following operations:

[0130] In response to the current first association data and the current second association data not being equal for the first time in the query process, the association query result is determined according to the intersection of the third inverted index corresponding to the current first association data and the second inverted index corresponding to the current second association data.

[0131] The query result corresponding to the current second sub-data is obtained by using the intersection of the association query result and the temporary query result.

[0132] The first association result is obtained based on the intersection of the first inverted index corresponding to the current first association data and the temporary query result.

[0133] The second association result is obtained based on the intersection of the first inverted index corresponding to the current second association data and the temporary query result.

[0134] In an embodiment, the query result determination module 104 is configured to perform the following operations:

[0135] In the case where the current first association data and the current second association data are not equal, and this case is not the first time, the first query sub-result is determined according to the second inverted index corresponding to the current second association data and the second association result; the second query sub-result is determined according to the third inverted index corresponding to the current first association data and the first association result; and the association query result is determined based on the union of the first query sub-result and the second query sub-result.

[0136] The second association result is updated based on the intersection of the first inverted index corresponding to the current second association data and the second association result.

[0137] The first association result is updated based on the intersection of the first inverted index corresponding to the current first association data and the first association result.

[0138] In an embodiment, the query result determination module 104 is configured to perform the following operations:

[0139] The query condition is to query data records greater than or equal to the first target and less than the second target, and the target query result corresponding to the first data is obtained based on a union set of each query result and the first association result;

[0140] The query condition is to query data records greater than the first target and less than or equal to the second target, and the target query result corresponding to the first data is obtained based on a union set of each query result and the second association result;

[0141] The query condition is to query data records greater than or equal to the first target and less than or equal to the second target, and the target query result corresponding to the first data is obtained based on a union set of each query result, the first association result and the second association result.

[0142] The device embodiment of the present application is based on the same inventive concept as the above-mentioned method embodiment, and will not be repeated here.

[0143] The present application also provides a computer program product or computer program, which includes computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to make the computer device execute the above-mentioned data query method.

[0144] The present application also provides a computer readable storage medium, which can store a plurality of instructions. The instructions can be adapted to be loaded and executed by the processor to execute the above-mentioned data query method of the present application.

[0145] In one embodiment, a data query method is provided, comprising:

[0146] Obtaining a query condition including first data;

[0147] Based on a preset mapping mode, the first data is mapped to obtain at least two second data, each second data carrying part of the information corresponding to the first data;

[0148] For each second data, a target inverted index corresponding to the second data is determined, the target inverted index being an inverted index determined based on the query condition and the second data, and the inverted index being used to record identification information of data records associated with the second data;

[0149] The target inverted index is obtained based on the above target inverted index, and the query results are fused based on the query condition to obtain the target query result corresponding to the first data, and the target query result includes the identification information of the data record corresponding to the first data.

[0150] In one embodiment, the query condition includes an equal value query condition, and the target inverted index corresponding to each second data is determined, including:

[0151] The first inverted index corresponding to the second data is determined as the target inverted index, and the relationship between the first data record corresponding to the identification information stored in the first inverted index and the second data conforms to the first mapping rule,

[0152] The first mapping rule is that the first mapping data is equal to the second data, and the first mapping data is the data corresponding to the second data obtained by performing the mapping processing on the first data record based on the mapping mode;

[0153] The query results are fused based on the query condition to obtain the target query result corresponding to the first data, including obtaining the target query result corresponding to the first data based on the intersection of the query results.

[0154] In one embodiment, the query condition is a range query condition, and the target inverted index corresponding to each second data is determined, including:

[0155] At least one of the first inverted index corresponding to the second data, the second inverted index, and the third inverted index is determined as the target inverted index, the relationship between the second data record corresponding to the identification information stored in the second inverted index and the second data conforms to the second mapping rule, and the relationship between the third data record corresponding to the identification information stored in the third inverted index and the second data conforms to the third mapping rule,

[0156] The second mapping rule is that the second mapping data is less than the second data, and the second mapping data is the data corresponding to the second data obtained by performing the mapping processing on the second data record based on the mapping mode;

[0157] The third mapping rule is that the third mapping data is greater than the second data, and the third mapping data is the data corresponding to the second data obtained by performing the mapping processing on the third data record based on the mapping mode;

[0158] The merging of each of the query results based on the query condition to obtain the target query result corresponding to the first data comprises: obtaining the target query result corresponding to the first data based on a union set of each of the query results.

[0159] In one embodiment, the first data includes a first target and a second target, the query condition is used to represent a data record greater than the first target and less than the second target, the second data includes a second sub-data corresponding to the first target and a second sub-data corresponding to the second target, and the query result for the second data based on the target inverted index comprises:

[0160] determining a current second sub-data, the current second sub-data including a current first associated data and a current second associated data, the current first associated data being a current second sub-data corresponding to the first target, and the current second associated data being a current second sub-data corresponding to the second target;

[0161] determining an associated query result according to the current first associated data and the current second associated data;

[0162] obtaining a query result corresponding to the current second sub-data by using the associated query result.

[0163] In one embodiment, the determining of the associated query result according to the current first associated data and the current second associated data comprises:

[0164] in response to a situation that the current first associated data and the current second associated data are equal for the first time in a query process, determining the associated query result according to a first inverted index corresponding to the current first associated data or a first inverted index corresponding to the current second associated data;

[0165] The obtaining of the query result corresponding to the current second sub-data by using the associated query result comprises: determining a temporary query result, obtaining the query result corresponding to the current second sub-data by using an intersection of the associated query result and the temporary query result, and updating the temporary query result based on the query result corresponding to the current second sub-data.

[0166] In one embodiment, the determining of the associated query result according to the current first associated data and the current second associated data comprises:

[0167] in response to a situation that the current first associated data and the current second associated data are not equal for the first time, determining the associated query result according to a first inverted index corresponding to the current first associated data or a first inverted index corresponding to the current second associated data;

[0168] The method further includes: determining the query result corresponding to the current second sub-data based on the intersection of the temporary query result and the first association result.

[0169] In one embodiment, the determining the association query result based on the current first association data and the current second association data further includes:

[0170] In response to a first occurrence of a situation that the current first association data and the current second association data are not equal, determining the association query result based on the intersection of the third inverted index corresponding to the current first association data and the second inverted index corresponding to the current second association data.

[0171] The determining the query result corresponding to the current second sub-data based on the association query result includes: determining the query result corresponding to the current second sub-data based on the intersection of the association query result and the temporary query result.

[0172] Before the determining the query result corresponding to the current second sub-data based on the association query result, the method further includes:

[0173] determining a first association result based on the intersection of the first inverted index corresponding to the current first association data and the temporary query result.

[0174] determining a second association result based on the intersection of the first inverted index corresponding to the current second association data and the temporary query result.

[0175] In one embodiment, the determining the association query result based on the current first association data and the current second association data further includes:

[0176] In a situation that the current first association data and the current second association data are not equal and this situation is not the first occurrence, determining a first query sub-result based on the second inverted index corresponding to the current second association data and the second association result; determining a second query sub-result based on the third inverted index corresponding to the current first association data and the first association result; and determining the association query result based on the union of the first query sub-result and the second query sub-result.

[0177] The method further includes:

[0178] updating the second association result based on the intersection of the first inverted index corresponding to the current second association data and the second association result.

[0179] Update the first association result based on the intersection of the first inverted index corresponding to the current first association data and the first association result.

[0180] In one embodiment, the query condition is to query data records greater than or equal to the first target and less than the second target, and the target query result corresponding to the first data based on the union of each query result includes: obtaining the target query result corresponding to the first data based on the union of each query result and the first association result.

[0181] The query condition is to query data records greater than the first target and less than or equal to the second target, and the target query result corresponding to the first data based on the union of each query result includes: obtaining the target query result corresponding to the first data based on the union of each query result and the second association result.

[0182] The query condition is to query data records greater than or equal to the first target and less than or equal to the second target, and the target query result corresponding to the first data based on the union of each query result includes: obtaining the target query result corresponding to the first data based on the union of each query result, the first association result and the second association result.

[0183] Further, Figure 7 A hardware structure diagram of a device for implementing the method provided by the embodiments of the application is shown, and the device can participate in constituting or containing the apparatus or system provided by the embodiments of the application. As shown in the figure, Figure 7 The device 10 can include one or more (in the figure, 102a, 102b, …, 102n are used to show) processors 102 (the processor 102 can include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission device 106 for communication function. In addition, it can also include a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which can be included as one of the ports of the I / O interface), a network interface, a power supply and / or a camera. Those skilled in the art can understand that Figure 7 The structure shown is only a schematic, which does not limit the structure of the above-mentioned electronic device. For example, the device 10 can also include more or less components than those shown in Figure 7 or have a different configuration from Figure 7 the structure shown.

[0184] It should be noted that the one or more processors 102 and / or other data processing circuitry described above can be referred to herein generally as "data processing circuitry." The data processing circuitry can be embodied in whole or in part as software, hardware, firmware, or any combination thereof. In addition, the data processing circuitry can be a single standalone processing module, or incorporated in whole or in part within any one of the other elements of the device 10 (or mobile device). As referred to in the embodiments of the present application, the data processing circuitry functions as a processor to control, for example, the selection of the variable resistance terminal path connected to the interface.

[0185] The memory 104 can be used to store software programs of application software and modules, such as the program instructions / data storage means corresponding to the method described above in the embodiments of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, i.e., implements the above-described data query method. The memory 104 can include a high-speed random access memory, and can further include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some examples, the memory 104 can further include a memory disposed remotely with respect to the processor 102, which can be connected to the device 10 through a network. Examples of the network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0186] The transmission device 106 is configured to receive or send data via a network. Examples of the network include, but are not limited to, a wireless network provided by a communication provider of the device 10. In one example, the transmission device 106 includes a network interface controller (NIC) that can be connected to other network devices through a base station to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module configured to communicate with the Internet in a wireless manner.

[0187] The display can be, for example, a touch screen type liquid crystal display (LCD) that enables a user to interact with the user interface of the device 10 (or mobile device).

[0188] Figure 8 A block diagram of another electronic device according to embodiments of the present disclosure is shown. For example, the electronic device 1900 can be provided as a server. Referring to FIG. 19, the electronic device 1900 includes one or more processors 1910, memory 1920, and a bus 1930. Figure 8The electronic device 1900 includes a processing component 1922, which further includes one or more processors, and a memory resource represented by the memory 1932 for storing instructions, such as an application program, executable by the processing component 1922. The application program stored in the memory 1932 can include one or more than one module each corresponding to a set of instructions. In addition, the processing component 1922 is configured to execute the instructions to perform the above method.

[0189] The electronic device 1900 can further include a power supply component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input / output (I / O) interface 1958. The electronic device 1900 can operate based on an operating system stored in the memory 1932, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, or the like.

[0190] In an exemplary embodiment, a non-transitory computer readable storage medium, such as the memory 1932 including computer program instructions executable by the processing component 1922 of the electronic device 1900 to perform the above method is also provided.

[0191] It should be noted that the above-mentioned sequence of the embodiments of the present application is only for description, not representing the advantages and disadvantages of the embodiments. And the above-mentioned embodiments of the present application are described for specific embodiments. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in an order different than the order in which they are recited, and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order to achieve the desired results. In certain implementations, multitasking and parallel processing can be advantageous.

[0192] Each of the embodiments in the embodiments of the present application is described in a progressive manner, and the same or similar parts between each of the embodiments can be referred to each other. Each of the embodiments focuses on the difference from other embodiments. In particular, for the device and server embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the part of the method embodiments.

[0193] Those of ordinary skill in the art can understand that all or part of the steps of the above-mentioned embodiments can be completed by hardware, or by program instructing relevant hardware to complete, and the above-mentioned program can be stored in a computer readable storage medium, and the above-mentioned storage medium can be a read-only memory, a disk or an optical disk, etc.

[0194] The above merely describes preferred embodiments of the present application, and is not intended to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A data query method, characterized by, The method comprises: obtaining a query condition comprising first data; based on a preset mapping mode, mapping processing the first data to obtain at least two second data, each second data carrying part of the information corresponding to the first data; in the case where the query condition is a range query condition, at least one of the first inverted index, the second inverted index and the third inverted index corresponding to the second data is determined as a target inverted index, the first inverted index stores the relationship between the first data record corresponding to the identification information and the second data, the relationship between the second data record corresponding to the identification information stored in the second inverted index and the second data conforms to the second mapping rule, and the relationship between the third data record corresponding to the identification information stored in the third inverted index and the second data conforms to the third mapping rule, the first mapping rule is that the first mapping data is equal to the second data, the first mapping data is the data obtained by mapping processing the first data record based on the mapping mode and corresponding to the second data; the second mapping rule is that the second mapping data is less than the second data, the second mapping data is the data obtained by mapping processing the second data record based on the mapping mode and corresponding to the second data; the third mapping rule is that the third mapping data is greater than the second data, the third mapping data is the data obtained by mapping processing the third data record based on the mapping mode and corresponding to the second data; based on the target inverted index, the query result for the second data is obtained, and based on the union set of each query result, the target query result corresponding to the first data is obtained.

2. The method of claim 1, wherein, The first data comprises a first target and a second target, the query condition is used to represent the data record greater than the first target and less than the second target, the second data comprises a second sub-data corresponding to the first target and a second sub-data corresponding to the second target, and the query result for the second data based on the target inverted index comprises: determining the current second sub-data, the current second sub-data comprising current first associated data and current second associated data, the current first associated data being the current second sub-data corresponding to the first target, and the current second associated data being the current second sub-data corresponding to the second target; determining an associated query result according to the current first associated data and the current second associated data; obtaining the query result corresponding to the current second sub-data by using the associated query result.

3. The method of claim 2, wherein, The determination of the associated query result according to the current first associated data and the current second associated data comprises: in response to the first time occurrence of the current first associated data and the current second associated data being equal in the query process, determining the associated query result according to the first inverted index corresponding to the current first associated data or the first inverted index corresponding to the current second associated data; The utilizing the association query result to obtain the query result corresponding to the current second sub-data comprises: determining a temporary query result, utilizing an intersection of the association query result and the temporary query result to obtain the query result corresponding to the current second sub-data, and updating the temporary query result based on the query result corresponding to the current second sub-data.

4. The method of claim 3, wherein, The determining the association query result according to the current first association data and the current second association data comprises: In response to a case that the current first association data and the current second association data are not equal for the first time, determining the association query result according to the first inverted index corresponding to the current first association data or the first inverted index corresponding to the current second association data; The utilizing the association query result to obtain the query result corresponding to the current second sub-data comprises: utilizing an intersection of the association query result and a query result obtained last time to obtain the query result corresponding to the current second sub-data.

5. The method of claim 3, wherein, The determining the association query result according to the current first association data and the current second association data further comprises: In response to a case that the current first association data and the current second association data are not equal for the first time in a query process, determining the association query result according to an intersection of the third inverted index corresponding to the current first association data and the second inverted index corresponding to the current second association data; The utilizing the association query result to obtain the query result corresponding to the current second sub-data comprises: utilizing an intersection of the association query result and the temporary query result to obtain the query result corresponding to the current second sub-data. Before the utilizing the association query result to obtain the query result corresponding to the current second sub-data, the method further comprises: Obtaining a first association result based on an intersection of the first inverted index corresponding to the current first association data and the temporary query result; Obtaining a second association result based on an intersection of the first inverted index corresponding to the current second association data and the temporary query result.

6. The method of claim 5, wherein, The determining the association query result according to the current first association data and the current second association data further comprises: In a case that the current first association data and the current second association data are not equal and this case does not occur for the first time, determining a first query sub-result according to the second inverted index corresponding to the current second association data and the second association result, determining a second query sub-result according to the third inverted index corresponding to the current first association data and the first association result, and determining the association query result based on a union set of the first query sub-result and the second query sub-result; The method further comprises: Updating the second association result based on an intersection of the first inverted index corresponding to the current second association data and the second association result; Updating the first association result based on an intersection of the first inverted index corresponding to the current first association data and the first association result.

7. The method of claim 5, wherein: The query condition is to query data records greater than or equal to a first target and less than a second target, and the target query result corresponding to the first data is obtained based on a union of each query result, including: the target query result corresponding to the first data is obtained based on a union of each query result and the first association result; The query condition is to query data records greater than a first target and less than or equal to a second target, and the target query result corresponding to the first data is obtained based on a union of each query result, including: the target query result corresponding to the first data is obtained based on a union of each query result and the second association result; The query condition is to query data records greater than or equal to a first target and less than or equal to a second target, and the target query result corresponding to the first data is obtained based on a union of each query result, including: the target query result corresponding to the first data is obtained based on a union of each query result, the first association result and the second association result.

8. A data query apparatus, characterized by comprising: The device comprises: A query element acquisition module configured to acquire a query condition including first data; A mapping processing module configured to perform mapping processing on the first data based on a preset mapping manner to obtain at least two second data, each second data carrying part of information corresponding to the first data; An inverted index determination module configured to, in a case where the query condition is a range query condition, determine at least one of a first inverted index, a second inverted index and a third inverted index corresponding to the second data as a target inverted index, the first inverted index storing identification information corresponding to a first data record and the second data, a relationship between the second data record and the second data stored by the second inverted index, and a relationship between the third data record and the second data stored by the third inverted index, the first mapping rule being that first mapping data is equal to the second data, the first mapping data being data obtained by performing the mapping processing on the first data record based on the mapping manner and corresponding to the second data, the second mapping rule being that second mapping data is less than the second data, the second mapping data being data obtained by performing the mapping processing on the second data record based on the mapping manner and corresponding to the second data, and the third mapping rule being that third mapping data is greater than the second data, the third mapping data being data obtained by performing the mapping processing on the third data record based on the mapping manner and corresponding to the second data; A query result determination module configured to obtain a query result for the second data based on the target inverted index, and obtain a target query result corresponding to the first data based on a union of each query result.

9. The apparatus of claim 8, wherein, The first data includes a first target and a second target, the query condition is used for representing a data record greater than the first target and less than the second target, the second data includes second sub-data corresponding to the first target and second sub-data corresponding to the second target, and the query result determination module is used for: determining current second sub-data, the current second sub-data including current first associated data and current second associated data, the current first associated data being current second sub-data corresponding to the first target, and the current second associated data being current second sub-data corresponding to the second target; determining an associated query result according to the current first associated data and the current second associated data; obtaining a query result corresponding to the current second sub-data by using the associated query result.

10. The apparatus of claim 9, wherein, The query result determination module is used for: in response to a case that the current first associated data and the current second associated data are equal for the first time in a query process, determining the associated query result according to a first inverted index corresponding to the current first associated data or a first inverted index corresponding to the current second associated data; the obtaining of the query result corresponding to the current second sub-data by using the associated query result includes: determining a temporary query result, obtaining the query result corresponding to the current second sub-data by using an intersection of the associated query result and the temporary query result, and updating the temporary query result based on the query result corresponding to the current second sub-data.

11. The apparatus of claim 10, wherein, The query result determination module is used for: in response to a case that the current first associated data and the current second associated data are not equal for the first time, determining the associated query result according to the first inverted index corresponding to the current first associated data or the first inverted index corresponding to the current second associated data; the obtaining of the query result corresponding to the current second sub-data by using the associated query result includes: obtaining the query result corresponding to the current second sub-data by using an intersection of the associated query result and a last obtained query result.

12. The apparatus of claim 10, wherein, The query result determination module is used for: in response to a case that the current first associated data and the current second associated data are not equal for the first time in a query process, determining the associated query result according to an intersection of a third inverted index corresponding to the current first associated data and a second inverted index corresponding to the current second associated data; the obtaining of the query result corresponding to the current second sub-data by using the associated query result includes: obtaining the query result corresponding to the current second sub-data by using an intersection of the associated query result and the temporary query result; before the obtaining of the query result corresponding to the current second sub-data by using the associated query result, the apparatus further includes: obtaining a first associated result based on an intersection of the first inverted index corresponding to the current first associated data and the temporary query result; obtaining a second associated result based on an intersection of the first inverted index corresponding to the current second associated data and the temporary query result.

13. The apparatus of claim 12, wherein, The query result determination module is used for: In a case where the current first correlation data and the current second correlation data are not equal and this case does not occur for the first time, determining a first query sub-result according to a second inverted index corresponding to the current second correlation data and the second correlation result; determining a second query sub-result according to a third inverted index corresponding to the current first correlation data and the first correlation result; determining the correlation query result based on a union set of the first query sub-result and the second query sub-result; The device further comprises: updating the second correlation result based on an intersection of a first inverted index corresponding to the current second correlation data and the second correlation result; updating the first correlation result based on an intersection of a first inverted index corresponding to the current first correlation data and the first correlation result.

14. The apparatus of claim 12, wherein: in a case where the query condition is to query data records greater than or equal to a first target and less than a second target, the obtaining of the target query result corresponding to the first data based on the union set of the query results comprises obtaining the target query result corresponding to the first data based on the union set of the query results and the first correlation result; in a case where the query condition is to query data records greater than a first target and less than or equal to a second target, the obtaining of the target query result corresponding to the first data based on the union set of the query results comprises obtaining the target query result corresponding to the first data based on the union set of the query results and the second correlation result; in a case where the query condition is to query data records greater than or equal to a first target and less than or equal to a second target, the obtaining of the target query result corresponding to the first data based on the union set of the query results comprises obtaining the target query result corresponding to the first data based on the union set of the query results, the first correlation result and the second correlation result.

15. A computer-readable storage medium, characterized in that, The computer readable storage medium stores at least one instruction or at least one program, which is loaded and executed by the processor to implement the data query method according to any one of claims 1 to 7.

16. An electronic device, comprising: The computer readable storage medium stores at least one instruction or at least one program, which is loaded and executed by the processor to implement the data query method according to any one of claims 1 to 7.

17. A computer program product comprising computer programs or instructions, characterized in that, The computer program or instruction is executed by the processor to implement the data query method according to any one of claims 1 to 7.

Citation Information

Patent Citations

  • Retrieval method and device based on separate character indexing system

    CN102810096A