CN112445822A - Data query method and device, electronic equipment and computer readable storage medium - Google Patents

Data query method and device, electronic equipment and computer readable storage medium Download PDF

Info

Publication number
CN112445822A
CN112445822A CN201910818335.7A CN201910818335A CN112445822A CN 112445822 A CN112445822 A CN 112445822A CN 201910818335 A CN201910818335 A CN 201910818335A CN 112445822 A CN112445822 A CN 112445822A
Authority
CN
China
Prior art keywords
information
data
query
identification information
sub
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.)
Granted
Application number
CN201910818335.7A
Other languages
Chinese (zh)
Other versions
CN112445822B (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.)
Rajax Network Technology Co Ltd
Original Assignee
Rajax Network Technology Co Ltd
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 Rajax Network Technology Co Ltd filed Critical Rajax Network Technology Co Ltd
Priority to CN201910818335.7A priority Critical patent/CN112445822B/en
Publication of CN112445822A publication Critical patent/CN112445822A/en
Application granted granted Critical
Publication of CN112445822B publication Critical patent/CN112445822B/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
    • G06F16/2455Query execution

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the disclosure discloses a data query method, a data query device, electronic equipment and a computer readable storage medium, wherein the data query method comprises the following steps: responding to a received data query request, and acquiring global unique identification information of the data query, wherein the data query request carries the global unique identification information of the data query; determining target query data storage position information according to the data query global unique identification information, wherein the target query data storage position information comprises two or more target query data storage position sub-information; and acquiring target query data according to the target query data storage position information. According to the technical scheme, two or even a plurality of dimensions of sub-database and sub-table information can be embedded, so that the technical effect of inquiring data through two or more different dimensions is achieved, and the accuracy and the comprehensiveness of data inquiry are improved.

Description

Data query method and device, electronic equipment and computer readable storage medium
Technical Field
The present disclosure relates to the field of data query technologies, and in particular, to a data query method and apparatus, an electronic device, and a computer-readable storage medium.
Background
With the rapid development of big data services, the data volume stored in the database shows an exponential growth trend, the data volume in the database and the data table will be more and more, and higher disk, IO and system overhead are brought along with the data volume, even the bottleneck on data storage and reading performance, in order to better provide data services, the database and the data table need to be split, that is, data originally stored in one database is stored in a plurality of databases in blocks according to a certain rule, and data originally stored in one data table is stored in a plurality of data tables in blocks. In the prior art, a long integer global unique ID with a length of 64 bits is usually generated by means of middleware, and specific generation methods include the following methods: 1, generating a global unique ID by embedding machine information, a timestamp or a process number as a unique identifier; 156030975800089, the long time stamp information is in the front, the 2-digit number 89 is the short branch database sub-table information, thus the data is in the 89 th sub-table by taking a modulus of 100 to the global unique ID. The global unique ID generation method is effective for short database partitioning information, but when the database partitioning information is long, information such as a timestamp and database self-increment ID is required to be added, so that the method cannot be effective.
Disclosure of Invention
The embodiment of the disclosure provides a data query method and device, electronic equipment and a computer-readable storage medium.
In a first aspect, a data query method is provided in the embodiments of the present disclosure.
Specifically, the data query method includes:
responding to a received data query request, and acquiring global unique identification information of the data query, wherein the data query request carries the global unique identification information of the data query;
determining target query data storage position information according to the data query global unique identification information, wherein the target query data storage position information comprises two or more target query data storage position sub-information;
and acquiring target query data according to the target query data storage position information.
With reference to the first aspect, in a first implementation manner of the first aspect, the data query globally unique identifier includes preset fixed information, database self-increment identifier information, first target query data storage location sub-information, and second target query data storage location sub-information, which are sequentially arranged, where the first target query data storage location sub-information has a first preset length, the second target query data storage location sub-information has a second preset length, the preset fixed information has a third preset length, and the database self-increment identifier information has a fourth preset length.
With reference to the first aspect and the first implementation manner of the first aspect, in a second implementation manner of the first aspect, the preset fixed information is preset symbol information.
With reference to the first aspect, the first implementation manner of the first aspect, and the second implementation manner of the first aspect, in a third implementation manner of the first aspect, when the data query global unique identification information is a decimal value, the determining, according to the data query global unique identification information, target query data storage location information includes:
converting the data query global unique identification information into a binary numerical value;
and determining the storage position information of the target query data according to the data query global unique identification information.
With reference to the first aspect, the first implementation manner of the first aspect, the second implementation manner of the first aspect, and the third implementation manner of the first aspect, in a fourth implementation manner of the first aspect, when the data query global unique identification information is a binary value, the determining, according to the data query global unique identification information, the target query data storage location information is implemented as:
and extracting the first target query data storage position sub-information and the second target query data storage position sub-information from the data query global unique identification information through movement and logical operation.
With reference to the first aspect, the first implementation manner of the first aspect, the second implementation manner of the first aspect, the third implementation manner of the first aspect, and the fourth implementation manner of the first aspect, in a fifth implementation manner of the first aspect, the extracting, by moving and logical operation, the first target query data storage location sub-information and the second target query data storage location sub-information from the data query global unique identification information is implemented as:
performing logic and calculation on the data query global unique identification information and a binary value corresponding to the second preset length to obtain sub-information of the storage position of the second target query data;
and after the binary value corresponding to the first preset length is shifted to the left by a second preset length, carrying out logic and calculation on the binary value and the data query global unique identification information, and then, shifting the calculation result to the right by the second preset length.
In a second aspect, a data query device is provided in the embodiments of the present disclosure.
Specifically, the data query apparatus includes:
the system comprises a first obtaining module, a second obtaining module and a third obtaining module, wherein the first obtaining module is configured to respond to a received data query request and obtain data query global unique identification information, and the data query request carries the data query global unique identification information;
a determining module configured to determine target query data storage location information according to the data query globally unique identification information, wherein the target query data storage location information includes two or more target query data storage location sub-information;
and the second acquisition module is configured to acquire the target query data according to the target query data storage position information.
With reference to the second aspect, in a first implementation manner of the second aspect, the data query globally unique identifier includes preset fixed information, database self-increment identifier information, first target query data storage location sub-information, and second target query data storage location sub-information, which are sequentially arranged, where the first target query data storage location sub-information has a first preset length, the second target query data storage location sub-information has a second preset length, the preset fixed information has a third preset length, and the database self-increment identifier information has a fourth preset length.
With reference to the second aspect and the first implementation manner of the second aspect, in a second implementation manner of the second aspect, the preset fixed information is preset symbol information.
With reference to the second aspect, the first implementation manner of the second aspect, and the second implementation manner of the second aspect, in a third implementation manner of the second aspect, when the data query globally unique identification information is a decimal value, the determining module includes:
a conversion sub-module configured to convert the data query globally unique identification information into a binary value;
and the determining sub-module is configured to determine target query data storage position information according to the data query global unique identification information.
With reference to the second aspect, the first implementation manner of the second aspect, the second implementation manner of the second aspect, and the third implementation manner of the second aspect, in a fourth implementation manner of the second aspect, in an embodiment of the present invention, when the data query global unique identification information is a binary value, the determining module or the determining sub-module is configured to:
and extracting the first target query data storage position sub-information and the second target query data storage position sub-information from the data query global unique identification information through movement and logical operation.
With reference to the second aspect, the first implementation manner of the second aspect, the second implementation manner of the second aspect, the third implementation manner of the second aspect, and the fourth implementation manner of the second aspect, in a fifth implementation manner of the second aspect, the determining module is configured to:
performing logic and calculation on the data query global unique identification information and a binary value corresponding to the second preset length to obtain sub-information of the storage position of the second target query data;
and after the binary value corresponding to the first preset length is shifted to the left by a second preset length, carrying out logic and calculation on the binary value and the data query global unique identification information, and then, shifting the calculation result to the right by the second preset length.
In a third aspect, the disclosed embodiments provide an electronic device, including a memory and a processor, where the memory is configured to store one or more computer instructions, where the one or more computer instructions are executed by the processor to implement the method steps of the data query method in the first aspect.
In a fourth aspect, the disclosed embodiments provide a computer-readable storage medium for storing computer instructions for a data query device, which contains computer instructions for executing the data query method in the first aspect as described above.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects:
according to the technical scheme, the database self-increment identification information is used for replacing information such as time stamps, machine information or process numbers in the prior art, so that the possibility that the global unique ID is embedded into the sub-database and sub-table information of two dimensions or even multiple dimensions is achieved. According to the technical scheme, two or even a plurality of dimensions of sub-database and sub-table information can be embedded, so that the technical effect of inquiring data through two or more different dimensions is achieved, and the accuracy and the comprehensiveness of data inquiry are improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
Other features, objects, and advantages of the present disclosure will become more apparent from the following detailed description of non-limiting embodiments when taken in conjunction with the accompanying drawings. In the drawings:
FIG. 1 illustrates a flow diagram of a data query method according to an embodiment of the present disclosure;
FIG. 2 is a diagram illustrating a structure of data query globally unique identification information according to an embodiment of the present disclosure;
FIG. 3 shows a flow chart of step S102 of the data query method according to the embodiment shown in FIG. 1;
FIG. 4 is a block diagram of a data query device according to an embodiment of the present disclosure;
FIG. 5 is a block diagram of the determining module 402 of the data query apparatus according to the embodiment shown in FIG. 4;
FIG. 6 shows a block diagram of an electronic device according to an embodiment of the present disclosure;
FIG. 7 is a schematic block diagram of a computer system suitable for implementing a data query method according to an embodiment of the present disclosure.
Detailed Description
Hereinafter, exemplary embodiments of the present disclosure will be described in detail with reference to the accompanying drawings so that those skilled in the art can easily implement them. Also, for the sake of clarity, parts not relevant to the description of the exemplary embodiments are omitted in the drawings.
In the present disclosure, it is to be understood that terms such as "including" or "having," etc., are intended to indicate the presence of the disclosed features, numbers, steps, behaviors, components, parts, or combinations thereof, and are not intended to preclude the possibility that one or more other features, numbers, steps, behaviors, components, parts, or combinations thereof may be present or added.
It should be further noted that the embodiments and features of the embodiments in the present disclosure may be combined with each other without conflict. The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
According to the technical scheme provided by the embodiment of the disclosure, the database self-increment identification information is used for replacing information such as time stamps, machine information or process numbers in the prior art, so that the embedding of the global unique ID into the two-dimensional or even multi-dimensional database sub-table information becomes possible. According to the technical scheme, two or even a plurality of dimensions of sub-database and sub-table information can be embedded, so that the technical effect of inquiring data through two or more different dimensions is achieved, and the accuracy and the comprehensiveness of data inquiry are improved.
Fig. 1 shows a flowchart of a data query method according to an embodiment of the present disclosure, as shown in fig. 1, the data query method includes the following steps S101-S103:
in step S101, in response to receiving a data query request, obtaining global unique identification information of the data query, where the data query request carries the global unique identification information of the data query;
in step S102, determining target query data storage location information according to the data query global unique identification information, where the target query data storage location information includes two or more target query data storage location sub-information;
in step S103, target query data is acquired according to the target query data storage location information.
As mentioned above, with the rapid development of big data services, the data volume stored in the database shows an exponential growth trend, the data volume in the database and the data table will be more and more, and then higher disk, IO, system overhead, and even bottleneck in data storage and reading performance are brought. In the prior art, a long integer global unique ID with a length of 64 bits is usually generated by means of middleware, and specific generation methods include the following methods: 1, generating a global unique ID by embedding machine information, a timestamp or a process number as a unique identifier; 156030975800089, the long time stamp information is in the front, the 2-digit number 89 is the short branch database sub-table information, thus the data is in the 89 th sub-table by taking a modulus of 100 to the global unique ID. The global unique ID generation method is effective for short database partitioning information, but when the database partitioning information is long, information such as a timestamp and database self-increment ID is required to be added, so that the method cannot be effective.
For example, some internet platforms need to record and store order data, where the order data includes merchant information and user information, that is, a certain order data is stored in both merchant data and user data, so that if it is desired to improve accuracy and comprehensiveness of data query, a storage location of the merchant data and a storage location of the user data can be represented in a global unique ID, and by using the global unique ID, it is necessary to embed both the sub-repository sub-table information of the merchant data and the sub-repository sub-table information of the user data into the global unique ID, so that it is possible to find out that a merchant in which a certain order is located is present in a few merchant sub-tables and that a user in which the order is located is present in a few user sub-tables. However, since usually 10 bits are needed for one sub-library and sub-table information, 20 bits are needed for two sub-library and sub-table information, and thus only 44 bits are left for allocating a timestamp, machine information or process number to a 64-bit long integer globally unique ID, it is obvious that the embedding of the two-dimensional sub-library and sub-table information is not possible based on the prior art scheme.
In view of the above drawbacks, in this embodiment, a data query method is proposed that makes it possible to embed a globally unique ID into two-dimensional or even multi-dimensional sub-library and sub-table information by using database self-increment identification information instead of information such as a time stamp, machine information, or process number in the related art. According to the technical scheme, two or even a plurality of dimensions of sub-database and sub-table information can be embedded, so that the technical effect of inquiring data through two or more different dimensions is achieved, and the accuracy and the comprehensiveness of data inquiry are improved.
In an optional implementation manner of this embodiment, the data query global unique identification information, that is, the global unique ID, refers to information that has global uniqueness in a network or a system having a plurality of nodes and a plurality of computers, is used to identify objects such as registry entries, classes and interface identifiers, databases, system directories, and can uniquely identify a certain operation or a certain data.
In an optional implementation manner of this embodiment, the data query request carries the data query global unique identification information. After a data query request carrying the data query global unique identification information is sent by a data query party, query operation can be executed on target query data according to the data query global unique identification information.
In an optional implementation manner of this embodiment, the target query data storage location information includes two or more pieces of target query data storage location sub information, or in other words, the target query data storage location information includes two or more dimensions of sub-library and sub-table information. Through the database and table dividing information of the two or more dimensions, the storage condition of the target query data can be determined, and the data can be queried through two or more different dimensions, so that the accuracy and comprehensiveness of data query are improved.
In an optional implementation manner of this embodiment, after the target query data storage location information is obtained, the target query data may be obtained according to the target query data storage location information by using a common data query statement.
As mentioned above, the currently commonly used globally unique ID is a long integer character string with a length of 64 bits, except that one bit is symbol information, and the remaining 63 bits of data are machine information, a time stamp or a process number, and at most, two bits of database and table information can be embedded by shortening the 63 bits of machine information, time stamp or process number to 61 bits. In order to accurately determine the storage condition of the target query data, the data can be queried through two or more different dimensions, and the purpose of improving the accuracy and comprehensiveness of data query is achieved. That is, the data query global unique identification information abandons the use of timestamp information, and only includes preset fixed information, database self-increment identification information and two or more target query data storage location sub-information which are sequentially arranged, wherein the preset fixed information refers to fixed information such as preset symbol information.
Taking two-dimensional database and table information as an example, in an optional implementation manner of this embodiment, the data query global unique identification information includes preset fixed information, database self-increment identification information, first target query data storage location sub-information, and second target query data storage location sub-information, which are sequentially arranged, where the preset fixed information is symbol information; the database self-increment identification information is change identification information generated when database data are changed and is used for ensuring the uniqueness of the global unique ID; and the storage position sub-information of the first target query data and the storage position sub-information of the second target query data are two-dimensional database sub-table information. The first target query data storage position sub-information has a first preset length, the second target query data storage position sub-information has a second preset length, the preset fixed information has a third preset length, and the database self-increment identification information has a fourth preset length.
In an optional implementation manner of this embodiment, as shown in fig. 2, the third preset length is 1 bit, the fourth preset length is 43 bits, both the first preset length and the second preset length are 10 bits, that is, the length of the preset fixed information is 1 bit, the length of the database self-increment identification information is 43 bits, the length of the first target query data storage location sub-information is 10 bits, and the length of the second target query data storage location sub-information is 10 bits, and the above information is sequentially arranged, so that the data query global unique identification information with the total length of 64 bits is formed.
The database self-adding identification information is used for replacing information such as time stamps, machine information or process numbers in the prior art, so that the information bit waste caused by adding of time stamp information is avoided, the sub-database sub-table information can be increased, and the service life of the global unique ID can be prolonged. Specifically, the timestamp used in the prior art is incremented by one every millisecond, that is, none of the acquired current millisecond is actually used, and the globally unique ID is already recorded, so that the use of the timestamp can cause waste of occupation, but the database self-increment identification information in the present disclosure is not increased when not used, so that waste of occupation is avoided, the calculated database self-increment identification information of 43 bits can be used for 27 years when 10000 database self-increment identification information are used per second, and the saved bits can also store two-dimensional or multidimensional database and branch table information.
In an optional implementation manner of this embodiment, when the data query globally unique identification information is a decimal value, as shown in fig. 3, the step S102, that is, the step of determining the target query data storage location information according to the data query globally unique identification information, includes the following steps S301 to S302:
in step S301, converting the data query global unique identification information into a binary value;
in step S302, target query data storage location information is determined according to the data query globally unique identification information.
In this implementation, when the data query global unique identification information is a decimal value, the data query global unique identification information is converted into a binary value, and then the target query data storage location information is determined.
In an optional implementation manner of this embodiment, when the data query globally unique identification information is a binary value, the step S102 or the step S302, that is, the step of determining the target query data storage location information according to the data query globally unique identification information, may be implemented as:
and extracting the first target query data storage position sub-information and the second target query data storage position sub-information from the data query global unique identification information through movement and logical operation.
As mentioned above, preset fixed information, database self-increment identification information, first target query data storage location sub-information and second target query data storage location sub-information are sequentially arranged in the data query global unique identification information, and the data query global unique identification information is in a binary representation mode, and at this time, the first target query data storage location sub-information and the second target query data storage location sub-information can be extracted from the data query global unique identification information through operations such as movement and logical operation.
In an optional implementation manner of this embodiment, the extracting, by moving and logical operation, the first target query data storage location sub-information and the second target query data storage location sub-information from the data query globally unique identification information may be implemented as:
performing logic and calculation on the data query global unique identification information and a binary value corresponding to the second preset length to obtain sub-information of the storage position of the second target query data;
and after the binary value corresponding to the first preset length is shifted to the left by a second preset length, carrying out logic and calculation on the binary value and the data query global unique identification information, and then, shifting the calculation result to the right by the second preset length.
For example, if the 64-bit data query global unique identification information sequentially includes 1-bit preset fixed information, 43-bit database incremental identification information, 10-bit first target query data storage location sub-information, and 10-bit second target query data storage location sub-information. The globally unique ID obtained from the data query request is 129453826323900 (for convenience, indicated by decimal), then the sub-information of the second target query data storage location is 444, that is, the information of the second-dimensional sublist where the data query globally unique identification information is located is 444, is obtained through 129453826323900&1023, where "&" represents logical and calculation, and 1023 is a binary value corresponding to a second preset length; through (129453826323900& (1023< <10)) > >10, the sub-information of the storage position of the first target query data is 333, that is, the sub-library and sub-table information of the first dimension where the global unique identification information of the data query is located is 333, wherein "< <" represents a left shift operation, and ">" represents a right shift operation. Thus, the target line data can be directly inquired in the correct sub-table through two different dimensions.
The following are embodiments of the disclosed apparatus that may be used to perform embodiments of the disclosed methods.
Fig. 4 shows a block diagram of a data query apparatus according to an embodiment of the present disclosure, which may be implemented as part of or all of an electronic device by software, hardware, or a combination of the two. As shown in fig. 4, the data querying device includes:
a first obtaining module 401, configured to, in response to receiving a data query request, obtain global unique identification information for data query, where the data query request carries the global unique identification information for data query;
a determining module 402 configured to determine target query data storage location information according to the data query globally unique identification information, wherein the target query data storage location information includes two or more target query data storage location sub-information;
a second obtaining module 403, configured to obtain the target query data according to the target query data storage location information.
As mentioned above, with the rapid development of big data services, the data volume stored in the database shows an exponential growth trend, the data volume in the database and the data table will be more and more, and then higher disk, IO, system overhead, and even bottleneck in data storage and reading performance are brought. In the prior art, a long integer global unique ID with a length of 64 bits is usually generated by means of middleware, and specific generation methods include the following methods: 1, generating a global unique ID by embedding machine information, a timestamp or a process number as a unique identifier; 156030975800089, the long time stamp information is in the front, the 2-digit number 89 is the short branch database sub-table information, thus the data is in the 89 th sub-table by taking a modulus of 100 to the global unique ID. The global unique ID generation method is effective for short database partitioning information, but when the database partitioning information is long, information such as a timestamp and database self-increment ID is required to be added, so that the method cannot be effective.
For example, some internet platforms need to record and store order data, where the order data includes merchant information and user information, that is, a certain order data is stored in both merchant data and user data, so that if it is desired to improve accuracy and comprehensiveness of data query, a storage location of the merchant data and a storage location of the user data can be represented in a global unique ID, and by using the global unique ID, it is necessary to embed both the sub-repository sub-table information of the merchant data and the sub-repository sub-table information of the user data into the global unique ID, so that it is possible to find out that a merchant in which a certain order is located is present in a few merchant sub-tables and that a user in which the order is located is present in a few user sub-tables. However, since usually 10 bits are needed for one sub-library and sub-table information, 20 bits are needed for two sub-library and sub-table information, and thus only 44 bits are left for allocating a timestamp, machine information or process number to a 64-bit long integer globally unique ID, it is obvious that the embedding of the two-dimensional sub-library and sub-table information is not possible based on the prior art scheme.
In view of the above-described drawbacks, in this embodiment, a data query apparatus is proposed that makes it possible to embed a globally unique ID into two-dimensional or even multi-dimensional sub-library and sub-table information by using database self-increment identification information instead of information such as a time stamp, machine information, or process number in the related art. According to the technical scheme, two or even a plurality of dimensions of sub-database and sub-table information can be embedded, so that the technical effect of inquiring data through two or more different dimensions is achieved, and the accuracy and the comprehensiveness of data inquiry are improved.
In an optional implementation manner of this embodiment, the data query global unique identification information, that is, the global unique ID, refers to information that has global uniqueness in a network or a system having a plurality of nodes and a plurality of computers, is used to identify objects such as registry entries, classes and interface identifiers, databases, system directories, and can uniquely identify a certain operation or a certain data.
In an optional implementation manner of this embodiment, the data query request carries the data query global unique identification information. After a data query request carrying the data query global unique identification information is sent by a data query party, query operation can be executed on target query data according to the data query global unique identification information.
In an optional implementation manner of this embodiment, the target query data storage location information includes two or more pieces of target query data storage location sub information, or in other words, the target query data storage location information includes two or more dimensions of sub-library and sub-table information. Through the database and table dividing information of the two or more dimensions, the storage condition of the target query data can be determined, and the data can be queried through two or more different dimensions, so that the accuracy and comprehensiveness of data query are improved.
In an optional implementation manner of this embodiment, after the target query data storage location information is obtained, the target query data may be obtained according to the target query data storage location information by using a common data query statement.
As mentioned above, the currently commonly used globally unique ID is a long integer character string with a length of 64 bits, except that one bit is symbol information, and the remaining 63 bits of data are machine information, a time stamp or a process number, and at most, two bits of database and table information can be embedded by shortening the 63 bits of machine information, time stamp or process number to 61 bits. In order to accurately determine the storage condition of the target query data, the data can be queried through two or more different dimensions, and the purpose of improving the accuracy and comprehensiveness of data query is achieved. That is, the data query global unique identification information abandons the use of timestamp information, and only includes preset fixed information, database self-increment identification information and two or more target query data storage location sub-information which are sequentially arranged, wherein the preset fixed information refers to fixed information such as preset symbol information.
Taking two-dimensional database and table information as an example, in an optional implementation manner of this embodiment, the data query global unique identification information includes preset fixed information, database self-increment identification information, first target query data storage location sub-information, and second target query data storage location sub-information, which are sequentially arranged, where the preset fixed information is symbol information; the database self-increment identification information is change identification information generated when database data are changed and is used for ensuring the uniqueness of the global unique ID; and the storage position sub-information of the first target query data and the storage position sub-information of the second target query data are two-dimensional database sub-table information. The first target query data storage position sub-information has a first preset length, the second target query data storage position sub-information has a second preset length, the preset fixed information has a third preset length, and the database self-increment identification information has a fourth preset length.
In an optional implementation manner of this embodiment, as shown in fig. 2, the third preset length is 1 bit, the fourth preset length is 43 bits, both the first preset length and the second preset length are 10 bits, that is, the length of the preset fixed information is 1 bit, the length of the database self-increment identification information is 43 bits, the length of the first target query data storage location sub-information is 10 bits, and the length of the second target query data storage location sub-information is 10 bits, and the above information is sequentially arranged, so that the data query global unique identification information with the total length of 64 bits is formed.
The database self-adding identification information is used for replacing information such as time stamps, machine information or process numbers in the prior art, so that the information bit waste caused by adding of time stamp information is avoided, the sub-database sub-table information can be increased, and the service life of the global unique ID can be prolonged. Specifically, the timestamp used in the prior art is incremented by one every millisecond, that is, none of the acquired current millisecond is actually used, and the globally unique ID is already recorded, so that the use of the timestamp can cause waste of occupation, but the database self-increment identification information in the present disclosure is not increased when not used, so that waste of occupation is avoided, the calculated database self-increment identification information of 43 bits can be used for 27 years when 10000 database self-increment identification information are used per second, and the saved bits can also store two-dimensional or multidimensional database and branch table information.
In an optional implementation manner of this embodiment, when the globally unique identification information of the data query is a decimal value, as shown in fig. 5, the determining module 402 includes:
a conversion sub-module 501 configured to convert the data query globally unique identification information into a binary value;
a determining sub-module 502 configured to determine target query data storage location information according to the data query globally unique identification information.
In this implementation, when the data query global unique identification information is a decimal value, the data query global unique identification information is converted into a binary value, and then the target query data storage location information is determined.
In an optional implementation manner of this embodiment, when the data query globally unique identification information is a binary value, the determining module 402 or the determining sub-module 502 may be configured to:
and extracting the first target query data storage position sub-information and the second target query data storage position sub-information from the data query global unique identification information through movement and logical operation.
As mentioned above, preset fixed information, database self-increment identification information, first target query data storage location sub-information and second target query data storage location sub-information are sequentially arranged in the data query global unique identification information, and the data query global unique identification information is in a binary representation mode, and at this time, the first target query data storage location sub-information and the second target query data storage location sub-information can be extracted from the data query global unique identification information through operations such as movement and logical operation.
In an optional implementation manner of this embodiment, the extracting, by moving and logical operation, the first target query data storage location sub-information and the second target query data storage location sub-information from the data query globally unique identification information may be implemented as:
performing logic and calculation on the data query global unique identification information and a binary value corresponding to the second preset length to obtain sub-information of the storage position of the second target query data;
and after the binary value corresponding to the first preset length is shifted to the left by a second preset length, carrying out logic and calculation on the binary value and the data query global unique identification information, and then, shifting the calculation result to the right by the second preset length.
For example, if the 64-bit data query global unique identification information sequentially includes 1-bit preset fixed information, 43-bit database incremental identification information, 10-bit first target query data storage location sub-information, and 10-bit second target query data storage location sub-information. The globally unique ID obtained from the data query request is 129453826323900 (for convenience, indicated by decimal), then the sub-information of the second target query data storage location is 444, that is, the information of the second-dimensional sublist where the data query globally unique identification information is located is 444, is obtained through 129453826323900&1023, where "&" represents logical and calculation, and 1023 is a binary value corresponding to a second preset length; through (129453826323900& (1023< <10)) > >10, the sub-information of the storage position of the first target query data is 333, that is, the sub-library and sub-table information of the first dimension where the global unique identification information of the data query is located is 333, wherein "< <" represents a left shift operation, and ">" represents a right shift operation. Thus, the target line data can be directly inquired in the correct sub-table through two different dimensions.
The present disclosure also discloses an electronic device, fig. 6 shows a block diagram of an electronic device according to an embodiment of the present disclosure, and as shown in fig. 6, the electronic device 600 includes a memory 601 and a processor 602; wherein the content of the first and second substances,
the memory 601 is used to store one or more computer instructions, which are executed by the processor 602 to implement the above-described method steps.
FIG. 7 is a schematic diagram of a computer system suitable for implementing a data query method according to an embodiment of the present disclosure.
As shown in fig. 7, the computer system 700 includes a Central Processing Unit (CPU)701, which can execute various processes in the above-described embodiments according to a program stored in a Read Only Memory (ROM)702 or a program loaded from a storage section 708 into a Random Access Memory (RAM) 703. In the RAM703, various programs and data necessary for the operation of the system 700 are also stored. The CPU701, the ROM702, and the RAM703 are connected to each other via a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
The following components are connected to the I/O interface 705: an input portion 706 including a keyboard, a mouse, and the like; an output section 707 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 708 including a hard disk and the like; and a communication section 709 including a network interface card such as a LAN card, a modem, or the like. The communication section 709 performs communication processing via a network such as the internet. A drive 710 is also connected to the I/O interface 705 as needed. A removable medium 711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 710 as necessary, so that a computer program read out therefrom is mounted into the storage section 708 as necessary.
In particular, the above described methods may be implemented as computer software programs, according to embodiments of the present disclosure. For example, embodiments of the present disclosure include a computer program product comprising a computer program tangibly embodied on a medium readable thereby, the computer program containing program code for performing the above-described data query method. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 709, and/or installed from the removable medium 711.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowcharts or block diagrams may represent a module, a program segment, or a portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units or modules described in the embodiments of the present disclosure may be implemented by software or hardware. The units or modules described may also be provided in a processor, and the names of the units or modules do not in some cases constitute a limitation of the units or modules themselves.
As another aspect, the present disclosure also provides a computer-readable storage medium, which may be the computer-readable storage medium included in the apparatus in the above-described embodiment; or it may be a separate computer readable storage medium not incorporated into the device. The computer readable storage medium stores one or more programs for use by one or more processors in performing the methods described in the present disclosure.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention in the present disclosure is not limited to the specific combination of the above-mentioned features, but also encompasses other embodiments in which any combination of the above-mentioned features or their equivalents is possible without departing from the inventive concept. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.

Claims (10)

1. A method for querying data, comprising:
responding to a received data query request, and acquiring global unique identification information of the data query, wherein the data query request carries the global unique identification information of the data query;
determining target query data storage position information according to the data query global unique identification information, wherein the target query data storage position information comprises two or more target query data storage position sub-information;
and acquiring target query data according to the target query data storage position information.
2. The method of claim 1, wherein the data query globally unique identification information comprises a preset fixed information, a database self-increment identification information, a first target query data storage location sub-information and a second target query data storage location sub-information which are sequentially arranged, wherein the first target query data storage location sub-information has a first preset length, the second target query data storage location sub-information has a second preset length, the preset fixed information has a third preset length, and the database self-increment identification information has a fourth preset length.
3. The method of claim 2, wherein the predetermined fixed information is predetermined symbol information.
4. The method according to claim 2 or 3, wherein when the data query globally unique identification information is a decimal value, the determining target query data storage location information according to the data query globally unique identification information includes:
converting the data query global unique identification information into a binary numerical value;
and determining the storage position information of the target query data according to the data query global unique identification information.
5. A data query apparatus, comprising:
the system comprises a first obtaining module, a second obtaining module and a third obtaining module, wherein the first obtaining module is configured to respond to a received data query request and obtain data query global unique identification information, and the data query request carries the data query global unique identification information;
a determining module configured to determine target query data storage location information according to the data query globally unique identification information, wherein the target query data storage location information includes two or more target query data storage location sub-information;
and the second acquisition module is configured to acquire the target query data according to the target query data storage position information.
6. The apparatus of claim 5, wherein the data query globally unique identification information comprises a first preset length of the first target query data storage location sub-information, a second preset length of the second target query data storage location sub-information, a first target query data storage location sub-information, and a second target query data storage location sub-information, which are sequentially arranged, wherein the preset fixed information has a third preset length, and the database self-increment identification information has a fourth preset length.
7. The apparatus of claim 6, wherein the predetermined fixed information is predetermined symbol information.
8. The apparatus of claim 6 or 7, wherein when the data query globally unique identification information is a decimal value, the determining module comprises:
a conversion sub-module configured to convert the data query globally unique identification information into a binary value;
and the determining sub-module is configured to determine target query data storage position information according to the data query global unique identification information.
9. An electronic device comprising a memory and a processor; wherein the memory is configured to store one or more computer instructions, wherein the one or more computer instructions are executed by the processor to implement the method steps of any of claims 1-4.
10. A computer-readable storage medium having stored thereon computer instructions, characterized in that the computer instructions, when executed by a processor, carry out the method steps of any of claims 1-4.
CN201910818335.7A 2019-08-30 2019-08-30 Data query method and device, electronic equipment and computer readable storage medium Active CN112445822B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910818335.7A CN112445822B (en) 2019-08-30 2019-08-30 Data query method and device, electronic equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910818335.7A CN112445822B (en) 2019-08-30 2019-08-30 Data query method and device, electronic equipment and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN112445822A true CN112445822A (en) 2021-03-05
CN112445822B CN112445822B (en) 2022-09-16

Family

ID=74735283

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910818335.7A Active CN112445822B (en) 2019-08-30 2019-08-30 Data query method and device, electronic equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN112445822B (en)

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103761251A (en) * 2013-12-26 2014-04-30 无锡冠云信息科技有限公司 Storing and finding method for large-data-volume client information
CN105447023A (en) * 2014-08-25 2016-03-30 阿里巴巴集团控股有限公司 Service identifier generation method and apparatus
CN107153653A (en) * 2016-03-03 2017-09-12 阿里巴巴集团控股有限公司 The poll access method and device of table are divided in a kind of point of storehouse
CN107622079A (en) * 2017-07-28 2018-01-23 阿里巴巴集团控股有限公司 Data storage, querying method and device
CN107729402A (en) * 2017-09-22 2018-02-23 努比亚技术有限公司 One kind divides table method, apparatus and computer-readable recording medium
CN107818115A (en) * 2016-09-14 2018-03-20 苏宁云商集团股份有限公司 A kind of method and device of processing data table
CN109104490A (en) * 2018-08-29 2018-12-28 北京达佳互联信息技术有限公司 Service identification management method, device, electronic equipment and storage medium
WO2019055282A1 (en) * 2017-09-14 2019-03-21 Savizar, Inc. Database engine
CN109710618A (en) * 2018-12-29 2019-05-03 北京航天云路有限公司 The mixing storage method and system of knowledge mapping data relationship separation
CN109740120A (en) * 2018-12-14 2019-05-10 深圳壹账通智能科技有限公司 The generation method of unique identification, device, computer equipment under distributed environment

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103761251A (en) * 2013-12-26 2014-04-30 无锡冠云信息科技有限公司 Storing and finding method for large-data-volume client information
CN105447023A (en) * 2014-08-25 2016-03-30 阿里巴巴集团控股有限公司 Service identifier generation method and apparatus
CN107153653A (en) * 2016-03-03 2017-09-12 阿里巴巴集团控股有限公司 The poll access method and device of table are divided in a kind of point of storehouse
CN107818115A (en) * 2016-09-14 2018-03-20 苏宁云商集团股份有限公司 A kind of method and device of processing data table
CN107622079A (en) * 2017-07-28 2018-01-23 阿里巴巴集团控股有限公司 Data storage, querying method and device
WO2019055282A1 (en) * 2017-09-14 2019-03-21 Savizar, Inc. Database engine
CN107729402A (en) * 2017-09-22 2018-02-23 努比亚技术有限公司 One kind divides table method, apparatus and computer-readable recording medium
CN109104490A (en) * 2018-08-29 2018-12-28 北京达佳互联信息技术有限公司 Service identification management method, device, electronic equipment and storage medium
CN109740120A (en) * 2018-12-14 2019-05-10 深圳壹账通智能科技有限公司 The generation method of unique identification, device, computer equipment under distributed environment
CN109710618A (en) * 2018-12-29 2019-05-03 北京航天云路有限公司 The mixing storage method and system of knowledge mapping data relationship separation

Also Published As

Publication number Publication date
CN112445822B (en) 2022-09-16

Similar Documents

Publication Publication Date Title
US20150161207A1 (en) Assisting query and querying
CN110851209B (en) Data processing method and device, electronic equipment and storage medium
CN108647357B (en) Data query method and device
US8838550B1 (en) Readable text-based compression of resource identifiers
CN106407360B (en) Data processing method and device
CN108733317B (en) Data storage method and device
CN110442642B (en) Data processing method and device for distributed database and storage medium
US9323798B2 (en) Storing a key value to a deleted row based on key range density
CN112182036A (en) Data sending and writing method and device, electronic equipment and readable storage medium
CN113157731A (en) Symbol analysis method, device, equipment and storage medium
CN112925757A (en) Method, equipment and storage medium for tracking operation log of intelligent equipment
CN112445822B (en) Data query method and device, electronic equipment and computer readable storage medium
CN110069489B (en) Information processing method, device and equipment and computer readable storage medium
CN103051480B (en) The storage means of a kind of DN and DN storage device
CN110598068A (en) Global identification generation method and device
US9619443B2 (en) Enhanced messaging transaction performance with auto-selected dual-tag fields
CN114579580A (en) Data storage method and data query method and device
CN112162951A (en) Information retrieval method, server and storage medium
CN111506756A (en) Similar picture searching method and system, electronic device and storage medium
CN111475742A (en) Address extraction method and device
CN111159199A (en) Index data acquisition method and device
CN113486627B (en) Single number generation method and device and electronic equipment
CN110851456B (en) Information processing method, electronic equipment and storage medium
CN114153830B (en) Data verification method and device, computer storage medium and electronic equipment
CN113840020B (en) Positioning method and device based on IP address information, electronic equipment and storage medium

Legal Events

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