CN107729371B - Data indexing and querying method, device, equipment and storage medium of block chain - Google Patents

Data indexing and querying method, device, equipment and storage medium of block chain Download PDF

Info

Publication number
CN107729371B
CN107729371B CN201710816597.0A CN201710816597A CN107729371B CN 107729371 B CN107729371 B CN 107729371B CN 201710816597 A CN201710816597 A CN 201710816597A CN 107729371 B CN107729371 B CN 107729371B
Authority
CN
China
Prior art keywords
data
index
block chain
chain
view
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710816597.0A
Other languages
Chinese (zh)
Other versions
CN107729371A (en
Inventor
曲强
罗捷桓
张金波
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Institute of Advanced Technology of CAS
Original Assignee
Shenzhen Institute of Advanced Technology of CAS
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Institute of Advanced Technology of CAS filed Critical Shenzhen Institute of Advanced Technology of CAS
Priority to CN201710816597.0A priority Critical patent/CN107729371B/en
Publication of CN107729371A publication Critical patent/CN107729371A/en
Application granted granted Critical
Publication of CN107729371B publication Critical patent/CN107729371B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

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

Abstract

The invention is suitable for the technical field of computers, and provides a data indexing and querying method, a device, equipment and a storage medium of a block chain, wherein the method comprises the following steps: the method comprises the steps of traversing transaction data in a preset block chain, obtaining a data mode group which accords with a preset longest frequent common mode in the transaction data, wherein the data mode group comprises a plurality of data modes, establishing a corresponding index view chain for each data mode in the data mode group, establishing a corresponding index for the transaction data in the block chain, and storing the index into a corresponding index view of the index view chain corresponding to each data mode according to the corresponding relation between the transaction data and each data mode, so that the data index of the block chain is established, and the data query efficiency of the block chain is improved.

Description

Data indexing and querying method, device, equipment and storage medium of block chain
Technical Field
The invention belongs to the technical field of computers, and particularly relates to a data indexing and querying method, device, equipment and storage medium of a block chain.
Background
The block chain technology, also called as distributed account book technology, is an internet database technology, is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like, and has the characteristics of decentralization, openness, transparency, safety, reliability and the like. Each block in the block chain contains a block header, which is used to link to the previous block to provide integrity to the block chain, and a block body, which contains transaction data during the block creation process. When the transaction data in the block chain needs to be inquired, the transaction data of the current block can be inquired through the block body, and the previous block of the current block in the block chain can be found through the block head.
Because the blockchain contains a large amount of transaction data for recording transaction records, many applications of the blockchain involve analysis of data in the blockchain, for example, when an intelligent contract execution system determines whether to execute a term in a contract, the transaction data in the blockchain needs to be analyzed first, and then a determination is made according to the result of the analysis of the data in the blockchain. At present, when data in a certain data mode in a block chain is queried, it is necessary to query the transaction data in the block body of the block chain from the latest added block in the block chain, then backtrack to the previous block through the block head for querying, and so on, and traverse the transaction data of the whole block chain. This makes it difficult to efficiently query and analyze the data because, on the one hand, each query accesses the transaction data in each block once, which takes a lot of time. On the other hand, for several types of data which are often accessed simultaneously, the association between the data is difficult to find, indexes cannot be established according to the relationship between the data, and the query speed of the corresponding data is further reduced.
Disclosure of Invention
The invention aims to provide a data indexing and querying method, a device, equipment and a storage medium of a block chain, and aims to solve the problem that the data querying efficiency of the block chain is low because the prior art cannot provide a method for effectively querying data in the block chain.
In one aspect, the present invention provides a data indexing method for a block chain, including the following steps:
traversing transaction data in a preset block chain, and acquiring a data pattern group which accords with a preset longest frequent common pattern in the transaction data, wherein the data pattern group comprises a plurality of data patterns;
establishing a corresponding index view chain for each data mode in the data mode group;
and establishing corresponding indexes for the transaction data in the block chain, and storing the indexes into corresponding index views of the index view chains corresponding to the data modes according to the corresponding relation between the transaction data and the data modes.
In another aspect, the present invention provides a data query method for a blockchain, where the blockchain has an index view chain as in the data indexing method for a blockchain, and the method further includes:
receiving a block chain data query request input by a user, and acquiring query keywords contained in the block chain data query request;
searching indexes corresponding to the query keywords in each index view chain of the block chain according to the query keywords;
and when the index corresponding to the query keyword is queried, acquiring and outputting the transaction data corresponding to the queried index in the block chain.
In another aspect, the present invention provides an apparatus for indexing data of a block chain, including:
the system comprises a mode group acquisition unit, a mode group acquisition unit and a data mode group generation unit, wherein the mode group acquisition unit is used for traversing transaction data in a preset block chain and acquiring a data mode group which accords with a preset longest frequent common mode in the transaction data, and the data mode group comprises a plurality of data modes;
the view chain constructing unit is used for establishing a corresponding index view chain for each data mode in the data mode group; and
and the index storage unit is used for establishing a corresponding index for the transaction data in the block chain, and storing the index into a corresponding index view of the index view chain corresponding to each data mode according to the corresponding relation between the transaction data and each data mode.
In another aspect, the present invention also provides a computing device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the data indexing method as the blockchain when executing the computer program.
In another aspect, the present invention also provides a computer-readable storage medium storing a computer program, which when executed by a processor implements the steps of the data indexing method of the blockchain.
According to the data query method and device, the transaction data in the preset block chain are traversed, the data mode group which accords with the preset longest frequent common mode in the transaction data is obtained, the data mode group comprises a plurality of data modes, the corresponding index view chain is established for each data mode in the data mode group, the corresponding index is established for the transaction data in the block chain, and the index is stored in the corresponding index view of the index view chain corresponding to each data mode according to the corresponding relation between the transaction data and each data mode, so that the data index of the block chain is established, and the data query efficiency of the block chain is improved.
Drawings
Fig. 1 is a flowchart illustrating an implementation of a data indexing method for a block chain according to an embodiment of the present invention;
fig. 2 is a flowchart of an implementation of a data query method for a block chain according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of a data indexing apparatus for a block chain according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of a data indexing apparatus for a block chain according to a fourth embodiment of the present invention; and
fig. 5 is a schematic structural diagram of a computing device according to a fifth embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The following detailed description of specific implementations of the present invention is provided in conjunction with specific embodiments:
the first embodiment is as follows:
fig. 1 shows an implementation flow of a data indexing method for a block chain according to a first embodiment of the present invention, and for convenience of description, only a part related to the first embodiment of the present invention is shown, which is detailed as follows:
in step S101, transaction data in a preset block chain is traversed, and a data pattern group that conforms to a preset longest frequent common pattern in the transaction data is obtained, where the data pattern group includes a plurality of data patterns.
In the embodiment of the invention, the data pattern represents the structural form of data, the data pattern group comprises a plurality of data patterns, the longest frequent common pattern is a group of data patterns, the group of data patterns is composed of not less than m data patterns, and the group of data patterns occur not less than k times at the same time. When a block chain data index request is received, transaction data in a preset block chain is traversed, and a data mode group which accords with a preset longest frequent common mode in the transaction data is obtained, namely, each frequently-used data mode group in the block chain transaction data is obtained, so that the data modes in the data mode groups are ensured to be frequently appeared or frequently used.
Preferably, when a data pattern group conforming to the longest frequent common pattern in the transaction data is obtained, the data pattern of the transaction data is obtained first, an item set of the data pattern corresponding to the transaction data is constructed according to the obtained data pattern, then at least m data patterns appearing in at least k data pattern item sets simultaneously are obtained from the data pattern item sets corresponding to all the transaction data of the block chain, and finally the obtained at least m data patterns are combined into the data pattern group conforming to the longest frequent common pattern, so that the accuracy of obtaining the data pattern group is improved.
In step S102, a corresponding index view chain is established for each data pattern in the data pattern group.
In the embodiment of the present invention, the index view chain is formed by linking more than one index views, wherein the index views are used for storing indexes corresponding to the transaction data in the block chain, the index views comprise information of corresponding longest frequent common patterns (i.e. which data patterns the longest frequent common patterns are composed of), index information of the data corresponding to the longest frequent common patterns on the block chain, and a hash function of the index views, and the hash function is a function for mapping values from a large definition domain to a smaller value domain. In order to store the index of all the transaction data in the block chain in order, after acquiring the data pattern group which accords with the longest frequent common pattern in the transaction data, establishing a corresponding index view chain for each data pattern in the acquired data pattern group.
Illustratively, two data pattern groups, a data pattern group 1 and a data pattern group 2, are common in the blockchain, where the data pattern group 1 is { mode a, mode B, and mode C }, and the data pattern group 2 is { mode a, mode B, and mode D }, and when establishing a corresponding index view chain for each data pattern in the data pattern groups, first establishing an index view chain for the data pattern in the first data pattern group, that is, establishing index view chains for the data pattern a, the data pattern B, and the data pattern C, respectively, and then only needing to establish an index view chain for the data pattern D in the second data pattern group (because the data pattern a, the data pattern B, and the data pattern C already have corresponding index view chains), thereby avoiding repeatedly establishing the same index view chain and further improving the efficiency of data processing.
In step S103, a corresponding index is established for the transaction data in the block chain, and the index is stored in a corresponding index view of the index view chain corresponding to each data mode according to the corresponding relationship between the transaction data and each data mode.
In the embodiment of the invention, after the corresponding index view chain is established, the corresponding index is established for the transaction data in the block chain, and then the index is stored in the corresponding index view of the index view chain established for each data mode according to the corresponding relation between the transaction data and each data mode obtained when the transaction data in the block chain is traversed. Therefore, the data index of the block chain is established by adding the corresponding index to the transaction data in the block chain, and the data query efficiency of the block chain is further improved.
Preferably, before storing the index into the corresponding index view of the index view chain corresponding to each data mode, first detecting whether the corresponding index view capable of storing the index exists in the index view chain corresponding to each data mode, and when the corresponding index view capable of storing the index does not exist in the index view chain corresponding to each data mode, constructing the corresponding index view capable of storing the index in the index view chain corresponding to each data mode, so that by using the chain structure, the extension of the index view in the index view chain is realized.
Preferably, when the block chain is updated, it is not necessary to traverse all the transaction data in the block chain again, but only the updated transaction data in the block chain is traversed, a corresponding index is established for the updated transaction data, and the index corresponding to the updated transaction data is stored in the corresponding index view of the index view chain corresponding to each data mode according to the corresponding relationship between the updated transaction data and each data mode in the data mode group, so that the data indexing efficiency of the block chain is improved, and the practicability of the block chain data index is improved.
Example two:
fig. 2 shows an implementation flow of a data query method for a block chain according to a second embodiment of the present invention, and for convenience of description, only the relevant portions of the embodiment of the present invention are shown, which are detailed as follows:
in step S201, a block chain data query request input by a user is received, and a query keyword included in the block chain data query request is obtained.
The embodiment of the invention is suitable for the block chain, and particularly suitable for the block chain with the corresponding index view chain obtained by the first embodiment of the invention, so that a user can conveniently inquire the transaction data in the block chain. In the embodiment of the invention, before a block chain data query request input by a user is received, transaction data in a block chain is traversed, a data mode group which accords with a preset longest frequent common mode in the transaction data is obtained, then a corresponding index view chain is established for each data mode in the data mode group, a corresponding index is established for the transaction data in the block chain, and then the index is stored into a corresponding index view of the index view chain corresponding to each data mode according to the corresponding relation between the transaction data and each data mode, so that the data index of the block chain is established, and the data query efficiency of the block chain is improved. When a block chain data query request input by a user is received, query keywords contained in the received block chain data query request are obtained for a subsequent query process.
In step S202, an index corresponding to the query keyword is queried in each index view chain of the block chain according to the query keyword.
In the embodiment of the invention, index query is carried out in each index view chain constructed for the block chain in advance according to the query key words, indexes of the query key words corresponding to the block chain data query request in each index view chain are obtained, and a subsequent query process is carried out according to the obtained indexes.
In step S203, when the index corresponding to the query keyword is queried, the transaction data corresponding to the queried index in the blockchain is obtained and output.
In the embodiment of the invention, when the index corresponding to the query keyword is queried, the fact that the block chain contains the transaction data corresponding to the query keyword input by the user is described, at this time, the transaction data corresponding to the index in the block chain corresponding to the query keyword is obtained according to the corresponding relation between the index in the index view chain and the block chain transaction data, then the obtained transaction data is set as the query result, and finally the query result is output.
Example three:
fig. 3 shows a structure of a data indexing apparatus for a block chain according to a third embodiment of the present invention, and for convenience of description, only a part related to the third embodiment of the present invention is shown, where the structure includes:
the pattern group obtaining unit 31 is configured to traverse transaction data in a preset block chain, and obtain a data pattern group that conforms to a preset longest frequent common pattern in the transaction data, where the data pattern group includes a plurality of data patterns.
In the embodiment of the present invention, when receiving a block chain data index request, the pattern group obtaining unit 31 traverses transaction data in a preset block chain, and obtains a data pattern group that conforms to a preset longest frequent common pattern in the transaction data, that is, obtains each frequently used data pattern group in the block chain transaction data, thereby ensuring that data patterns in the data pattern groups frequently occur or are frequently used.
Preferably, when a data pattern group conforming to the longest frequent common pattern in the transaction data is obtained, the data pattern of the transaction data is obtained first, an item set of the data pattern corresponding to the transaction data is constructed according to the obtained data pattern, then at least m data patterns appearing in at least k data pattern item sets simultaneously are obtained from the data pattern item sets corresponding to all the transaction data of the block chain, and finally the obtained at least m data patterns are combined into the data pattern group conforming to the longest frequent common pattern, so that the accuracy of obtaining the data pattern group is improved.
The view chain constructing unit 32 is configured to establish a corresponding index view chain for each data pattern in the data pattern group.
In this embodiment of the present invention, in order to store indexes of all transaction data in the block chain in order, after acquiring a data pattern group that conforms to the longest frequent common pattern in the transaction data, the view chain constructing unit 32 establishes a corresponding index view chain for each data pattern in the acquired data pattern group.
And the index storage unit 33 is configured to establish a corresponding index for the transaction data in the block chain, and store the index into a corresponding index view of the index view chain corresponding to each data mode according to the corresponding relationship between the transaction data and each data mode.
In the embodiment of the present invention, after the corresponding index view chain is established, the index storage unit 33 first establishes a corresponding index for the transaction data of the block chain, and then stores the index into the corresponding index view of the index view chain established for each data mode according to the correspondence between the transaction data obtained when the transaction data in the block chain is traversed and each data mode. Therefore, the data index of the block chain is established by adding the corresponding index to the transaction data in the block chain, and the data query efficiency of the block chain is further improved.
In the embodiment of the present invention, each unit of the data indexing device of the block chain may be implemented by a corresponding hardware or software unit, and each unit may be an independent software or hardware unit, or may be integrated into a software or hardware unit, which is not limited herein.
Example four:
fig. 4 shows a structure of a data indexing apparatus for a block chain according to a fourth embodiment of the present invention, and for convenience of description, only a part related to the fourth embodiment of the present invention is shown, where the structure includes:
the pattern group obtaining unit 41 is configured to traverse transaction data in a preset block chain, and obtain a data pattern group that conforms to a preset longest frequent common pattern in the transaction data, where the data pattern group includes a plurality of data patterns.
In the embodiment of the present invention, when receiving a block chain data index request, the pattern group obtaining unit 41 traverses transaction data in a preset block chain, and obtains a data pattern group that conforms to a preset longest frequent common pattern in the transaction data, that is, obtains each frequently used data pattern group in the block chain transaction data, thereby ensuring that data patterns in the data pattern groups frequently occur or are frequently used.
Preferably, when a data pattern group conforming to the longest frequent common pattern in the transaction data is obtained, the data pattern of the transaction data is obtained first, an item set of the data pattern corresponding to the transaction data is constructed according to the obtained data pattern, then at least m data patterns appearing in at least k data pattern item sets simultaneously are obtained from the data pattern item sets corresponding to all the transaction data of the block chain, and finally the obtained at least m data patterns are combined into the data pattern group conforming to the longest frequent common pattern, so that the accuracy of obtaining the data pattern group is improved.
And the view chain constructing unit 42 is configured to establish a corresponding index view chain for each data pattern in the data pattern group.
In this embodiment of the present invention, in order to store indexes of all transaction data in the block chain in order, after acquiring a data pattern group that conforms to the longest frequent common pattern in the transaction data, the view chain constructing unit 42 establishes a corresponding index view chain for each data pattern in the acquired data pattern group.
And a view detection unit 43, configured to detect whether a corresponding index view capable of storing an index exists in the index view chain corresponding to the data mode.
And the view constructing unit 44 is configured to construct a corresponding index view capable of storing an index in the index view chain corresponding to the data mode when the corresponding index view capable of storing an index does not exist in the index view chain corresponding to each data mode.
In the embodiment of the present invention, before storing the index into the corresponding index view of the index view chain corresponding to each data mode, the view detecting unit 43 first detects whether there is a corresponding index view capable of storing the index in the index view chain corresponding to each data mode, and when there is no corresponding index view capable of storing the index in the index view chain corresponding to each data mode, the view constructing unit 44 constructs a corresponding index view capable of storing the index in the index view chain corresponding to each data mode, so that by using the chain structure, the extension of the index view in the index view chain is realized.
And the index storage unit 45 is configured to establish a corresponding index for the transaction data in the block chain, and store the index into a corresponding index view of the index view chain corresponding to each data mode according to the corresponding relationship between the transaction data and each data mode.
In the embodiment of the present invention, after the corresponding index view chain is established, the index storage unit 45 first establishes a corresponding index for the transaction data in the block chain, and then stores the index into the corresponding index view of the index view chain established for each data mode according to the correspondence between the transaction data obtained when the transaction data of the block chain is traversed and each data mode. Therefore, the data index of the block chain is established by adding the corresponding index to the transaction data in the block chain, and the data query efficiency of the block chain is further improved.
The index establishing unit 46 is configured to traverse the transaction data updated in the blockchain when the blockchain is updated, and establish a corresponding index for the updated transaction data.
And the view updating unit 47 is configured to store the index corresponding to the updated transaction data into the corresponding index view of the index view chain corresponding to each data mode according to the corresponding relationship between the updated transaction data and each data mode.
In the embodiment of the present invention, when the block chain is updated, it is not necessary to traverse all the transaction data in the block chain again, and it is only necessary to traverse the updated transaction data in the block chain through the view updating unit 46, establish a corresponding index for the updated transaction data, and store the index corresponding to the updated transaction data into the corresponding index view of the index view chain corresponding to each data mode according to the corresponding relationship between the updated transaction data and each data mode in the data mode group, thereby improving the data indexing efficiency of the block chain and improving the practicability of the block chain data index.
In the embodiment of the present invention, each unit of the data indexing device of the block chain may be implemented by a corresponding hardware or software unit, and each unit may be an independent software or hardware unit, or may be integrated into a software or hardware unit, which is not limited herein.
Example five:
fig. 5 shows a structure of a computing device provided in a fifth embodiment of the present invention, and for convenience of explanation, only a part related to the embodiment of the present invention is shown.
The computing device 5 of an embodiment of the invention comprises a processor 50, a memory 51 and a computer program 52 stored in the memory 51 and executable on the processor 50. The processor 50 executes the computer program 52 to implement the steps in the above-mentioned data indexing method embodiment of each block chain, for example, the steps S101 to S103 shown in fig. 1. Alternatively, the processor 50, when executing the computer program 52, implements the functions of the units in the above-described device embodiments, for example, the functions of the units 31 to 33 shown in fig. 3 and the units 41 to 47 shown in fig. 4.
In the embodiment of the present invention, when the processor 50 executes the computer program 52 to implement the steps in the above-described data indexing method embodiment of each block chain, the transaction data in the preset block chain is traversed, a data pattern group that conforms to the preset longest frequent common pattern in the transaction data is obtained, where the data pattern group includes a plurality of data patterns, a corresponding index view chain is established for each data pattern in the data pattern group, a corresponding index is established for the transaction data in the block chain, and the index is stored in the corresponding index view of the index view chain corresponding to each data pattern according to the corresponding relationship between the transaction data and each data pattern, so as to establish the data index of the block chain, and further improve the data query efficiency of the block chain. The steps implemented by the processor 50 in the computing device 5 when executing the computer program 52 may specifically refer to the description of the method in the first embodiment, and are not described herein again.
Example six:
in an embodiment of the present invention, a computer-readable storage medium is provided, which stores a computer program, and the computer program, when executed by a processor, implements the steps in the above-described data indexing method embodiments of each block chain, for example, steps S101 to S103 shown in fig. 1. Alternatively, the computer program, when executed by a processor, implements the functions of the units in the device embodiments described above, for example, the functions of the units 31 to 33 shown in fig. 3 and the units 41 to 47 shown in fig. 4.
In the embodiment of the invention, transaction data in a preset block chain is traversed, a data pattern group which accords with a preset longest frequent common pattern in the transaction data is obtained, the data pattern group comprises a plurality of data patterns, a corresponding index view chain is established for each data pattern in the data pattern group, a corresponding index is established for the transaction data in the block chain, and the index is stored in a corresponding index view of the index view chain corresponding to each data pattern according to the corresponding relation between the transaction data and each data pattern, so that the data index of the block chain is established, and the data query efficiency of the block chain is further improved. The method for indexing data of a block chain implemented when the computer program is executed by the processor may further refer to the description of the steps in the foregoing method embodiments, which are not repeated herein.
The computer readable storage medium of the embodiments of the present invention may include any entity or device capable of carrying computer program code, a recording medium, such as a ROM/RAM, a magnetic disk, an optical disk, a flash memory, or the like.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents and improvements made within the spirit and principle of the present invention are intended to be included within the scope of the present invention.

Claims (10)

1. A method for indexing data of a blockchain, the method comprising the steps of:
traversing transaction data in a preset block chain, and acquiring a data pattern group which accords with a preset longest frequent common pattern in the transaction data, wherein the data pattern group comprises a plurality of data patterns;
establishing a corresponding index view chain for each data mode in the data mode group;
and establishing corresponding indexes for the transaction data in the block chain, and storing the indexes into corresponding index views of the index view chains corresponding to the data modes according to the corresponding relation between the transaction data and the data modes.
2. The method of claim 1, wherein the method further comprises:
when the block chain is updated, traversing the updated transaction data in the block chain, and establishing a corresponding index for the updated transaction data;
and storing the index corresponding to the updated transaction data into the corresponding index view of the index view chain corresponding to each data mode according to the corresponding relation between the updated transaction data and each data mode.
3. The method of claim 1, wherein the step of obtaining a set of data patterns in the transactional data that conform to a predetermined longest frequent common pattern comprises:
acquiring a data mode of the transaction data, and constructing a data mode item set corresponding to the transaction data according to the acquired data mode;
acquiring at least m data modes which simultaneously appear in not less than k data mode item sets from the data mode item sets corresponding to all the transaction data of the block chain;
and combining the acquired at least m data modes into a data mode group, and setting the data mode group obtained by combination as a data mode group conforming to the longest frequent common mode.
4. The method of claim 1, wherein prior to the step of storing the index into a respective indexed view of the chain of indexed views corresponding to the respective data schema, the method further comprises:
detecting whether the corresponding index view capable of storing the index exists in the index view chain corresponding to each data mode;
when the corresponding index view capable of storing the index does not exist in the index view chain corresponding to each data mode, constructing the corresponding index view capable of storing the index in the index view chain corresponding to each data mode.
5. A method for querying data of a blockchain, wherein the blockchain has the chain of indexed views according to any one of claims 1 to 4, the method further comprising:
receiving a block chain data query request input by a user, and acquiring query keywords contained in the block chain data query request;
searching indexes corresponding to the query keywords in each index view chain of the block chain according to the query keywords;
and when the index corresponding to the query keyword is queried, acquiring and outputting the transaction data corresponding to the queried index in the block chain.
6. An apparatus for indexing data of a blockchain, the apparatus comprising:
the system comprises a mode group acquisition unit, a mode group acquisition unit and a data mode group generation unit, wherein the mode group acquisition unit is used for traversing transaction data in a preset block chain and acquiring a data mode group which accords with a preset longest frequent common mode in the transaction data, and the data mode group comprises a plurality of data modes;
the view chain constructing unit is used for establishing a corresponding index view chain for each data mode in the data mode group; and
and the index storage unit is used for establishing a corresponding index for the transaction data in the block chain, and storing the index into a corresponding index view of the index view chain corresponding to each data mode according to the corresponding relation between the transaction data and each data mode.
7. The apparatus of claim 6, wherein the apparatus further comprises:
the index establishing unit is used for traversing the updated transaction data in the block chain when the block chain is updated, and establishing a corresponding index for the updated transaction data; and
and the view updating unit is used for storing the indexes corresponding to the updated transaction data into the corresponding index views of the index view chains corresponding to the data modes according to the corresponding relation between the updated transaction data and the data modes.
8. The apparatus of claim 6, wherein the apparatus further comprises:
a view detection unit, configured to detect whether the corresponding index view capable of storing the index exists in an index view chain corresponding to each data mode; and
and a view construction unit, configured to construct the corresponding index view capable of storing the index in the index view chain corresponding to each data mode when the corresponding index view capable of storing the index does not exist in the index view chain corresponding to each data mode.
9. A computing device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any of claims 1 to 4 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 4.
CN201710816597.0A 2017-09-12 2017-09-12 Data indexing and querying method, device, equipment and storage medium of block chain Active CN107729371B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710816597.0A CN107729371B (en) 2017-09-12 2017-09-12 Data indexing and querying method, device, equipment and storage medium of block chain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710816597.0A CN107729371B (en) 2017-09-12 2017-09-12 Data indexing and querying method, device, equipment and storage medium of block chain

Publications (2)

Publication Number Publication Date
CN107729371A CN107729371A (en) 2018-02-23
CN107729371B true CN107729371B (en) 2020-04-21

Family

ID=61205986

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710816597.0A Active CN107729371B (en) 2017-09-12 2017-09-12 Data indexing and querying method, device, equipment and storage medium of block chain

Country Status (1)

Country Link
CN (1) CN107729371B (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108696514B (en) * 2018-04-27 2022-04-01 腾讯科技(深圳)有限公司 Resource collection task management method, device, storage medium and system
CN108595720B (en) * 2018-07-12 2020-05-19 中国科学院深圳先进技术研究院 Block chain space-time data query method, system and electronic equipment
CN108959228A (en) * 2018-07-13 2018-12-07 众安信息技术服务有限公司 Based on block chain creation, retrieval, the method and readable storage medium storing program for executing for editing data
CN109408551B (en) * 2018-08-06 2021-07-06 杭州复杂美科技有限公司 Data query method and system, consensus method and system, device and storage medium
CN109298835B (en) * 2018-08-16 2022-04-26 北京京东尚科信息技术有限公司 Data archiving processing method, device, equipment and storage medium of block chain
CN109165224B (en) * 2018-08-24 2021-02-19 东北大学 Indexing method for key words on block chain database
CN110969429A (en) * 2018-09-28 2020-04-07 中思博安科技(北京)有限公司 Data directory storage method and device based on block chain technology
CN109508411A (en) * 2018-10-29 2019-03-22 合肥学院 Block chain method for quickly retrieving
CN110162540B (en) * 2019-04-17 2023-06-06 平安科技(深圳)有限公司 Block chain account book data query method, electronic device and storage medium
CN112487027B (en) * 2020-12-02 2022-08-23 山东浪潮科学研究院有限公司 Efficient data query implementation method based on block chain electronic transaction

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105740440A (en) * 2016-02-01 2016-07-06 上海凭安网络科技有限公司 Indexing method for quickening block chain query

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9245003B2 (en) * 2012-09-28 2016-01-26 Emc Corporation Method and system for memory efficient, update optimized, transactional full-text index view maintenance

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105740440A (en) * 2016-02-01 2016-07-06 上海凭安网络科技有限公司 Indexing method for quickening block chain query

Also Published As

Publication number Publication date
CN107729371A (en) 2018-02-23

Similar Documents

Publication Publication Date Title
CN107729371B (en) Data indexing and querying method, device, equipment and storage medium of block chain
KR102407510B1 (en) Method, apparatus, device and medium for storing and querying data
AU2005239366B2 (en) Partial query caching
CN103282902B (en) Suffix array candidate selects and index data structure
JP6427592B2 (en) Manage data profiling operations related to data types
EP2674875A1 (en) Method, controller, program and data storage system for performing reconciliation processing
Song et al. Efficient discovery of similarity constraints for matching dependencies
US8924373B2 (en) Query plans with parameter markers in place of object identifiers
US9218394B2 (en) Reading rows from memory prior to reading rows from secondary storage
Khan et al. SQL Database with physical database tuning technique and NoSQL graph database comparisons
CN102541631B (en) Execution plans with different driver sources in multiple threads
US8812492B2 (en) Automatic and dynamic design of cache groups
WO2015074466A1 (en) Data search method and apparatus
US20140019454A1 (en) Systems and Methods for Caching Data Object Identifiers
Fegaras Incremental query processing on big data streams
CN109815240B (en) Method, apparatus, device and storage medium for managing index
CA2461871A1 (en) An efficient index structure to access hierarchical data in a relational database system
CN108710662B (en) Language conversion method and device, storage medium, data query system and method
Urbani et al. KOGNAC: efficient encoding of large knowledge graphs
CN114201505A (en) Data query method and device and database system
Mittal et al. Efficient random data accessing in MapReduce
Diao et al. Efficient exploration of interesting aggregates in RDF graphs
CN112486988A (en) Data processing method, device, equipment and storage medium
CN111797095A (en) Index construction method and JSON data query method
Zheng et al. Compact, tamper-resistant archival of fine-grained provenance

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant