CN114185890A - Database retrieval method and device, storage medium and electronic equipment - Google Patents
Database retrieval method and device, storage medium and electronic equipment Download PDFInfo
- Publication number
- CN114185890A CN114185890A CN202111502898.9A CN202111502898A CN114185890A CN 114185890 A CN114185890 A CN 114185890A CN 202111502898 A CN202111502898 A CN 202111502898A CN 114185890 A CN114185890 A CN 114185890A
- Authority
- CN
- China
- Prior art keywords
- condition
- values
- database
- retrieval
- retrieved
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2455—Query execution
- G06F16/24553—Query execution of query operations
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/903—Querying
- G06F16/90335—Query processing
- G06F16/90348—Query processing by searching ordered data, e.g. alpha-numerically ordered data
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computational Linguistics (AREA)
- Software Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention discloses a database retrieval method, a database retrieval device, a storage medium and electronic equipment, wherein the database to-be-retrieved condition values are enumerated and stored in an ordered set; extracting a position corresponding to a condition value to be retrieved in the ordered set; forming unique target position integer values corresponding to the condition values to be retrieved at different positions according to the position sequence and the preset data type, and writing the unique target position integer values into a mark field of a preset database; when data contained in a current database is retrieved, comparing a plurality of retrieval condition values in a received current database retrieval condition with retrieval condition values in an ordered set, determining a plurality of target positions of the plurality of retrieval condition values in the current database retrieval condition in the ordered set according to a comparison result, and performing operation on unique condition values corresponding to the plurality of retrieval condition values obtained by processing information of the plurality of target positions; and the retrieval is carried out in the database according to the operation result, so that the retrieval efficiency is improved.
Description
Technical Field
The invention relates to the technical field of databases, in particular to a database retrieval method, a database retrieval device, a storage medium and electronic equipment.
Background
A database is a "warehouse that organizes, stores, and manages data according to a data structure," which is an organized, sharable, uniformly managed collection of large amounts of data that is stored in a computer for a long period of time. With the advent of the big data era and the artificial intelligence era, more and more database applications are applied, the amount of processed data is gradually increased, the difficulty of compiling SQL statements is improved along with the complexity of requirements when SQL is used for searching the database, the searching efficiency is reduced, and resources consumed by a computer for analyzing and executing the complex SQL are correspondingly increased.
Disclosure of Invention
In view of this, embodiments of the present invention provide a database retrieval method, an apparatus, a storage medium, and an electronic device, so as to solve the technical problem in the prior art that the database retrieval efficiency is low.
The technical scheme provided by the invention is as follows:
a first aspect of an embodiment of the present invention provides a database retrieval method, where the database retrieval method includes: enumerating the condition values to be retrieved of the database and storing the condition values in an ordered set; extracting a position corresponding to the condition value to be retrieved in the ordered set; forming unique target position integer values corresponding to the condition values to be retrieved at different positions according to the position sequence and the preset data type, and writing the target position integer values into a mark field of a preset database; when data contained in a current database is retrieved, comparing a plurality of retrieval condition values in a received current database retrieval condition with the retrieval condition values in the ordered set, determining a plurality of target positions of the plurality of retrieval condition values in the current database retrieval condition in the ordered set according to a comparison result, and performing operation on unique condition values corresponding to the plurality of retrieval condition values obtained by processing information of the plurality of target positions; and searching in the database according to the operation result.
Optionally, forming unique target position integer values corresponding to condition values to be retrieved at different positions according to the position order and the preset data type, and writing the unique target position integer values into a flag field of a preset database, including: assigning the value of the condition to be retrieved according to the position sequence and the preset data type to obtain a corresponding bit numerical value; and converting the bit numerical value to obtain a unique target position integer value corresponding to the condition value to be retrieved.
Optionally, before forming unique target location integer values corresponding to condition values to be retrieved at different locations by bits according to the location order and the preset data type and writing the unique target location integer values into a flag field of a preset database, the method further includes: and determining the preset data type according to the number of the condition values to be retrieved contained in the ordered set obtained by enumeration.
Optionally, the performing operation on the unique condition values corresponding to the plurality of search condition values obtained by processing the information of the plurality of target positions includes: calculating the information of the target positions according to bits to obtain a plurality of different target position integer values; and carrying out OR operation on the plurality of target position integer values to obtain the unique condition numerical value.
Optionally, comparing a plurality of search condition values in the received current database search condition with the search condition values in the ordered set, includes: taking and operation on the unique condition value and the mark field; and when the operation result is not zero, the retrieval condition value corresponding to the mark field corresponds to the retrieval condition value in the current database retrieval condition.
A second aspect of the embodiments of the present invention provides a database search device, including: the storage module is used for enumerating and storing the condition values to be retrieved of the database in the ordered set; the extraction module is used for extracting the position corresponding to the condition value to be retrieved in the ordered set; the determining module is used for forming unique target position integer values corresponding to the condition values to be retrieved at different positions according to the position sequence and the preset data type and writing the unique target position integer values into a mark field of a preset database; the operation processing module is used for comparing a plurality of received retrieval condition values in the retrieval condition of the current database with the retrieval condition values in the ordered set when retrieving data contained in the current database, determining a plurality of target positions of the plurality of retrieval condition values in the retrieval condition of the current database in the ordered set according to a comparison result, and performing operation on unique condition values corresponding to the plurality of retrieval condition values obtained by processing information of the plurality of target positions; and the retrieval module is used for retrieving in the database according to the operation result.
Optionally, the determining module includes: the first determining module is used for assigning the value of the condition to be retrieved according to the position sequence and the preset data type to obtain a corresponding bit numerical value; and the second determining module is used for converting the bit numerical value to obtain a unique target position integer value corresponding to the condition value to be retrieved.
Optionally, the apparatus further comprises: and a third determining module, configured to determine the preset data type according to the number of to-be-retrieved condition values included in the ordered set obtained by enumeration.
A third aspect of the embodiments of the present invention provides a computer-readable storage medium, where computer instructions are stored, and the computer instructions are configured to cause a computer to execute the database retrieval method according to any one of the first aspect and the first aspect of the embodiments of the present invention.
A fourth aspect of an embodiment of the present invention provides an electronic device, including: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the computer instructions to perform the database retrieval method according to any one of the first aspect and the first aspect of the embodiments of the present invention.
The technical scheme provided by the invention has the following effects:
the database retrieval method provided by the embodiment of the invention enumerates and stores the condition values to be retrieved of the database in the ordered set; extracting a position corresponding to the condition value to be retrieved in the ordered set; forming unique target position integer values corresponding to the condition values to be retrieved at different positions according to the position sequence and the preset data type, and writing the unique target position integer values into a mark field of a preset database; when data contained in a current database is retrieved, comparing a plurality of retrieval condition values in a received current database retrieval condition with the retrieval condition values in the ordered set, determining a plurality of target positions of the plurality of retrieval condition values in the current database retrieval condition in the ordered set according to a comparison result, and performing operation on unique condition values corresponding to the plurality of retrieval condition values obtained by processing information of the plurality of target positions; and searching in the database according to the operation result. Forming unique target position integer values corresponding to condition values to be retrieved at different positions according to position sequence and preset data types, and converting non-numerical values into numerical values; and carrying out operation by using the unique condition numerical value corresponding to the target position in the ordered set, and converting the multiple conditions into single-condition numerical operation. Therefore, by implementing the invention, the operation complexity is simplified, and the retrieval efficiency is improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a flow chart of a database retrieval method according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a database retrieval method according to an embodiment of the present invention;
fig. 3 is a block diagram of the structure of a database retrieval apparatus according to an embodiment of the present invention;
FIG. 4 is a schematic structural diagram of a computer-readable storage medium provided according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
An embodiment of the present invention provides a database retrieval method, as shown in fig. 1, the method includes the following steps:
step S101: enumerating the condition values to be retrieved of the database and storing the condition values in the ordered set. Specifically, when data in a database is retrieved, first, a condition value to be retrieved corresponding to the database during retrieval is enumerated to specify the condition value to be retrieved, and then the enumerated condition value to be retrieved is stored in an ordered set. The ordered set can provide a mode of access by indexes, including access according to keys or indexes, and has better performance in addition, deletion and modification of attributes (retrieval condition values); a set enumeration is a procedure that lists all members of some finite sequence set, and is a set of named integer constants, such as SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, which represent weeks, is an enumeration.
In one embodiment, data in the SQLite relational database is retrieved, and corresponding retrieval condition values are enumerated and stored in an independent dictionary table, wherein the independent dictionary table is an ordered set.
Step S102: and extracting the position corresponding to the condition value to be retrieved in the ordered set. Specifically, after the condition values to be retrieved of the database are enumerated and stored in the ordered set, the condition values to be retrieved in the ordered set all have corresponding fixed positions, and the positions are extracted.
Step S103: and forming unique target position integer values corresponding to the condition values to be retrieved at different positions according to the position sequence and the preset data type, and writing the unique target position integer values into a mark field of a preset database. Specifically, a marking field is added to the retrieval condition value in the ordered set according to the data type supported by the computer, wherein the data type can be a short data type, an int data type, a long data type and the like. Each data type contains a different BYTE (BYTE), each of which contains 8 BITs (BIT). Therefore, after the positions corresponding to the condition values to be retrieved in the ordered set are extracted, the unique target position integer values corresponding to the condition values to be retrieved can be determined according to the bit positions according to the preset data types, and the unique target position integer values corresponding to the condition values to be retrieved at different positions can be determined according to the position sequence. The unique target location integer value is then written into a flag field of a preset database.
Step S104: when data contained in a current database is searched, a plurality of received search condition values in the search condition of the current database are compared with search condition values in an ordered set, a plurality of target positions of the search condition values in the search condition of the current database in the ordered set are determined according to a comparison result, and unique condition values corresponding to the search condition values obtained by processing information of the target positions are operated. Specifically, after the unique condition value corresponding to the condition value to be retrieved is written in the preset database, the unique condition value corresponding to the condition value to be retrieved stored in the preset database may be used for retrieval.
Specifically, when data contained in the current database is retrieved, firstly, a plurality of retrieval condition values in the received current database retrieval condition are compared with retrieval condition values in the ordered set, a plurality of positions corresponding to the plurality of retrieval condition values in the current database retrieval condition in the ordered set can be determined after comparison, information of a plurality of target positions is processed to obtain unique condition values corresponding to the plurality of retrieval condition values, then, the obtained unique condition values are operated, non-numerical values and a plurality of conditions are converted into numerical values and single-condition operation, the complexity of calculation is simplified, and the retrieval efficiency is greatly improved.
Step S105: and searching in the database according to the operation result. Specifically, after the unique condition numerical values corresponding to the plurality of search condition values obtained by processing the information of the plurality of target positions are operated, the plurality of search condition values may be converted into a single numerical value, and then the obtained final search condition expression value may be input in SQL and searched.
In an embodiment, the final expression value of the search condition obtained through the operation is 0x8880000000000000, and then the search is performed by inputting in SQL and adopting any one of the following methods:
(1)select*from user_info where mcode&0x8880000000000000!=0;
(2)select*from user_info where mcode&0x8880000000000000<>0;
the database retrieval method provided by the embodiment of the invention enumerates and stores the condition values to be retrieved of the database in the ordered set; extracting a position corresponding to a condition value to be retrieved in the ordered set; forming unique target position integer values corresponding to the condition values to be retrieved at different positions according to the position sequence and the preset data type, and writing the unique target position integer values into a mark field of a preset database; when data contained in a current database is retrieved, comparing a plurality of retrieval condition values in a received current database retrieval condition with retrieval condition values in an ordered set, determining a plurality of target positions of the plurality of retrieval condition values in the current database retrieval condition in the ordered set according to a comparison result, and performing operation on unique condition values corresponding to the plurality of retrieval condition values obtained by processing information of the plurality of target positions; and searching in the database according to the operation result. Forming unique target position integer values corresponding to condition values to be retrieved at different positions according to position sequence and preset data types, and converting non-numerical values into numerical values; and carrying out operation by using the unique condition numerical value corresponding to the target position in the ordered set, and converting the multiple conditions into single-condition numerical operation. Therefore, by implementing the invention, the operation complexity is simplified, and the retrieval efficiency is improved.
As an optional implementation manner of the embodiment of the present invention, when forming unique target position integer values corresponding to condition values to be retrieved at different positions according to a position order and a preset data type and writing the unique target position integer values into a flag field of a preset database, first, assigning the condition values to be retrieved according to the position order and the preset data type to obtain corresponding bit numerical values.
In an embodiment, the data type is set to be a LONG data type, specifically, the LONG data type includes 8 BYTEs (BYTE), so that the LONG value includes 8 × 8 ═ 64 ordered bits, and the value of the condition to be retrieved is assigned according to the ordered bits to obtain a corresponding bit value. As shown in table 1 below, the bit values corresponding to the condition values to be retrieved may be 10000 … … 0 (total 63-bit value 0), 01000 … … 0 (total 63-bit value 0), … …, 0000 … … 01 (total 63-bit value 0), and so on.
TABLE 1
And then carrying out numerical value conversion processing on the corresponding bit numerical value to obtain a unique target position integer value corresponding to the condition value to be retrieved. Specifically, the corresponding bit value is subjected to a binary conversion process.
In one embodiment, as shown in table 2 below, the bit values 10000 … … 0 (total 63-bit value 0), 01000 … … 0 (total 63-bit value 0), and 0000 … … 01 (total 63-bit value 0) corresponding to the search condition values are subjected to a numerical conversion process to obtain corresponding unique target position integer values, respectively: 0x800000000000, Ox4000000000000000, 0x 0000000000000001. The flag bits RA and RB are used to record flag fields in the preset database, respectively.
TABLE 2
Bit position | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | … | 64 | Hexadecimal number |
RA | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | … | 0 | 0x8000000000000000 |
RB | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | … | 0 | 0x40000000000000000 |
RC | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | … | 0 | 0x2000000000000000 |
RD | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | … | 0 | 0x1000000000000000 |
RE | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | … | 0 | 0x08000000000000000 |
RF | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | … | 0 | 0x04000000000000000 |
RG | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | … | 0 | 0x02000000000000000 |
RH | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | … | 0 | 0x01000000000000000 |
R1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | … | 0 | 0x0080000000000000 |
… | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | … | 0 | … |
RXX | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0x0000000000000001 |
And finally, after determining the unique target position integer values corresponding to the condition values to be retrieved at different positions, writing the corresponding unique condition values into the mark fields of the preset database.
As an optional implementation manner of the embodiment of the present invention, before forming unique target position integer values corresponding to condition values to be retrieved at different positions according to a position sequence and a preset data type and writing the unique target position integer values into a flag field of a preset database, the preset data type may be determined according to the number of condition values to be retrieved included in an ordered set obtained by enumeration. Specifically, when the number of search condition values in the ordered set is less than 32, the unique target position INTEGER value corresponding to the condition value to be searched may be determined by using the type of inter (4-byte, 32-bit) data; when the retrieval condition values in the ordered set are more than 32 and less than 64, determining a unique target position integer value corresponding to the condition value to be retrieved by using a LONG (8 byte, 64 bit) data type; when the number of the retrieval condition values in the ordered set is more than 64, a newly added mark field can be allocated for operation; when there are more search condition values in the ordered set, the implementation can be iterated on the basis of the current tag field.
As an optional implementation manner of the embodiment of the present invention, the performing operation on the unique condition numerical values corresponding to the plurality of search condition values obtained by processing the information of the plurality of target positions includes: carrying out bitwise operation on the information of the plurality of target positions to obtain a plurality of different target position integer values; and carrying out OR operation on the integer values of the plurality of target positions to obtain a unique condition numerical value. Specifically, after determining a plurality of target positions of a plurality of search condition values in the current database search condition in the ordered set, a corresponding bit value, that is, information corresponding to the target position may be obtained according to the target position, the information may be subjected to bitwise calculation to obtain a corresponding target position integer value, and then the obtained target position integer value is subjected to or operation to obtain a unique condition value.
In an embodiment, the 3 target location information of the 3 search condition values in the ordered set in the current database are 10000 … … 0 (total 63-bit value 0), 00001 … … 0 (total 63-bit value 0), 000000001 … … 0 (total 63-bit value 0), respectively, and the target location integer values corresponding to the information of the target location obtained by bitwise operation of the 3 location information are 0x8000000000000000, 0x080000000000, and 0x0080000000000000, respectively. Then, taking or operation is carried out on the obtained 3 target position integer values to obtain a unique conditional numerical value:
0x8000000000000000|0x0800000000000000|0x0080000000000000
=0x8880000000000000
then 0x8880000000000000 is the only condition value used for the final search.
As an optional implementation manner of the embodiment of the present invention, when comparing a plurality of search condition values in a received current database search condition with search condition values in an ordered set, a unique condition value and a flag field need to be and-operated first, and when an operation result is not zero, a search condition value corresponding to the flag field corresponds to a search condition value in the current database search condition.
Specifically, the target position corresponding to the retrieval condition in the ordered set is stored in the flag field, and is set according to the data type, so that the unique condition value and the flag field are subjected to an and operation, and if the operation result is not zero, the retrieval condition value corresponding to the flag field corresponds to the retrieval condition value in the retrieval condition of the current database.
In one embodiment, the unique condition value is 0x8880000000000000, and the and operation is performed on the value and the flag field, when the operation result is not zero, 3 target locations corresponding to the search condition value can be obtained, which are: 0x8000000000000000, 0x0800000000000000, and 0x0080000000000000, that is, the search condition values corresponding to the three target locations correspond to the search condition values in the current database search condition.
Taking a relational database as an example, the retrieval principle of the database retrieval method provided by the invention is shown in fig. 2.
In an embodiment, the database retrieval method provided in the present invention may greatly utilize existing resources to achieve a better user experience under the condition that hardware resources are limited (difficult to be expanded).
Specifically, an SQLite relational database is implanted into the mobile terminal, 10W records exist in a data table, the distribution condition of a certain gate class in the APP is rapidly counted, the user query statistics can be rapidly responded by using the method provided by the invention in combination with the APP, and the query time can be reduced to 1/10 in a traditional mode. And through test verification, the larger the data volume is, the more excellent the time consumption proportion is.
Under the same hardware environment, the efficiency of retrieving data in the relational database by using a conventional mode is basically fixed, if the efficiency is improved, besides the improvement of hardware configuration, almost no other method exists, if the method is used for retrieving, on the premise of not purchasing high-configuration hardware, the user experience which is the same as the high-configuration hardware or even higher in efficiency can be realized, meanwhile, the service cycle of hardware resources is prolonged, the purchase cost of related hardware resources is saved, and the like.
In addition, the database retrieval method provided by the invention is applied to PCs and servers, the effect is very ideal, and the commercial effect is obvious.
An embodiment of the present invention further provides a database retrieval apparatus, as shown in fig. 3, the apparatus includes:
the storage module 401 is configured to enumerate and store the condition values to be retrieved of the database in an ordered set; for details, refer to the related description of step S101 in the above method embodiment.
An extracting module 402, configured to extract a position corresponding to a condition value to be retrieved in the ordered set; for details, refer to the related description of step S102 in the above method embodiment.
A determining module 403, configured to form unique target location integer values corresponding to condition values to be retrieved at different locations according to the location sequence and the preset data type, and write the unique target location integer values into a flag field of a preset database; for details, refer to the related description of step S103 in the above method embodiment.
An operation processing module 404, configured to, when retrieving data included in the current database, compare a plurality of retrieval condition values in the received current database retrieval condition with retrieval condition values in the ordered set, determine, according to a comparison result, a plurality of target positions of the plurality of retrieval condition values in the current database retrieval condition in the ordered set, and perform operation on unique condition values corresponding to the plurality of retrieval condition values obtained by processing information of the plurality of target positions; for details, refer to the related description of step S104 in the above method embodiment.
A retrieval module 405, configured to perform retrieval in a database according to an operation result; for details, refer to the related description of step S105 in the above method embodiment.
The database retrieval device provided by the embodiment of the invention enumerates and stores the condition values to be retrieved of the database in the ordered set; extracting a position corresponding to a condition value to be retrieved in the ordered set; forming unique target position integer values corresponding to the condition values to be retrieved at different positions according to the position sequence and the preset data type, and writing the unique target position integer values into a mark field of a preset database; when data contained in a current database is retrieved, comparing a plurality of retrieval condition values in a received current database retrieval condition with retrieval condition values in an ordered set, determining a plurality of target positions of the plurality of retrieval condition values in the current database retrieval condition in the ordered set according to a comparison result, and performing operation on unique condition values corresponding to the plurality of retrieval condition values obtained by processing information of the plurality of target positions; and searching in the database according to the operation result. Forming unique target position integer values corresponding to the condition values to be retrieved at different positions according to the position sequence and the preset data type, and converting the non-numerical values into numerical values; and carrying out operation by using the unique condition numerical value corresponding to the target position in the ordered set, and converting the multiple conditions into single-condition numerical operation. Therefore, the operation complexity is simplified, and the retrieval efficiency is improved.
As an optional implementation manner of the embodiment of the present invention, the determining module includes: the first determining module is used for assigning the value of the condition to be retrieved according to the position sequence and the preset data type to obtain a corresponding bit numerical value; and the second determining module is used for converting the bit numerical value to obtain a unique target position integer value corresponding to the condition value to be retrieved.
As an optional implementation manner of the embodiment of the present invention, the apparatus further includes: and the third determining module is used for determining the preset data type according to the number of the condition values to be retrieved contained in the ordered set obtained by enumeration.
As an optional implementation manner of the embodiment of the present invention, the apparatus further includes: the first operation module is used for operating the information of the plurality of target positions according to bits to obtain a plurality of different target position integer values; and the second operation module is used for performing OR operation on the integer values of the plurality of target positions to obtain a unique conditional numerical value.
As an optional implementation manner of the embodiment of the present invention, the apparatus further includes: the third operation module is used for taking and operation on the unique condition numerical value and the mark field; and the judging module is used for judging that the retrieval condition value corresponding to the mark field corresponds to the retrieval condition value in the current database retrieval condition when the operation result is not zero.
The function description of the database retrieval device provided by the embodiment of the invention refers to the description of the database retrieval method in the above embodiment in detail.
An embodiment of the present invention further provides a storage medium, as shown in fig. 4, on which a computer program 601 is stored, where the instructions, when executed by a processor, implement the steps of the database retrieval method in the foregoing embodiments. The storage medium is also stored with audio and video stream data, characteristic frame data, an interactive request signaling, encrypted data, preset data size and the like. The storage medium may be a magnetic Disk, an optical Disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a Flash Memory (Flash Memory), a Hard Disk (Hard Disk Drive, abbreviated as HDD) or a Solid State Drive (SSD), etc.; the storage medium may also comprise a combination of memories of the kind described above.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic Disk, an optical Disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a Flash Memory (Flash Memory), a Hard Disk (Hard Disk Drive, abbreviated as HDD) or a Solid State Drive (SSD), etc.; the storage medium may also comprise a combination of memories of the kind described above.
An embodiment of the present invention further provides an electronic device, as shown in fig. 5, the electronic device may include a processor 51 and a memory 52, where the processor 51 and the memory 52 may be connected by a bus or in another manner, and fig. 5 takes the connection by the bus as an example.
The processor 51 may be a Central Processing Unit (CPU). The Processor 51 may also be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, or combinations thereof.
The memory 52, which is a non-transitory computer readable storage medium, may be used to store non-transitory software programs, non-transitory computer executable programs, and modules, such as the corresponding program instructions/modules in the embodiments of the present invention. The processor 51 executes various functional applications and data processing of the processor by executing non-transitory software programs, instructions and modules stored in the memory 52, that is, implements the database retrieval method in the above-described method embodiments.
The memory 52 may include a storage program area and a storage data area, wherein the storage program area may store an operating device, an application program required for at least one function; the storage data area may store data created by the processor 51, and the like. Further, the memory 52 may include high speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, the memory 52 may optionally include memory located remotely from the processor 51, and these remote memories may be connected to the processor 51 via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The one or more modules are stored in the memory 52 and, when executed by the processor 51, perform a database retrieval method as in the embodiment of fig. 1-2.
The details of the electronic device may be understood by referring to the corresponding descriptions and effects in the embodiments shown in fig. 1 to fig. 2, and are not described herein again.
Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the invention, and such modifications and variations fall within the scope defined by the appended claims.
Claims (10)
1. A database retrieval method is characterized by comprising the following steps:
enumerating the condition values to be retrieved of the database and storing the condition values in an ordered set;
extracting a position corresponding to the condition value to be retrieved in the ordered set;
forming unique target position integer values corresponding to the condition values to be retrieved at different positions according to the position sequence and the preset data type, and writing the unique target position integer values into a mark field of a preset database;
when data contained in a current database is retrieved, comparing a plurality of retrieval condition values in a received current database retrieval condition with the retrieval condition values in the ordered set, determining a plurality of target positions of the plurality of retrieval condition values in the current database retrieval condition in the ordered set according to a comparison result, and performing operation on unique condition values corresponding to the plurality of retrieval condition values obtained by processing information of the plurality of target positions;
and searching in the database according to the operation result.
2. The method according to claim 1, wherein forming unique target location integer values corresponding to condition values to be retrieved at different locations by bits according to a location order and a preset data type, and writing the unique target location integer values into a flag field of a preset database includes:
assigning the value of the condition to be retrieved according to the position sequence and the preset data type to obtain a corresponding bit numerical value;
and converting the bit numerical value to obtain a unique target position integer value corresponding to the condition value to be retrieved.
3. The method according to claim 1, wherein before forming unique target location integer values corresponding to condition values to be retrieved at different locations by bits according to a location order and a preset data type and writing the unique target location integer values into a flag field of a preset database, the method further comprises:
and determining the preset data type according to the number of the condition values to be retrieved contained in the ordered set obtained by enumeration.
4. The method according to claim 1, wherein the operation of the unique condition value corresponding to the search condition values obtained by processing the information of the target positions includes:
calculating the information of the target positions according to bits to obtain a plurality of different target position integer values;
and carrying out OR operation on the plurality of target position integer values to obtain the unique condition numerical value.
5. The method of claim 4, wherein comparing a plurality of search condition values in the received current database search condition with the search condition values in the ordered set comprises:
taking and operation on the unique condition value and the mark field;
and when the operation result is not zero, the retrieval condition value corresponding to the mark field corresponds to the retrieval condition value in the current database retrieval condition.
6. A database retrieval apparatus, comprising:
the storage module is used for enumerating and storing the condition values to be retrieved of the database in the ordered set;
the extraction module is used for extracting the position corresponding to the condition value to be retrieved in the ordered set;
the determining module is used for forming unique target position integer values corresponding to the condition values to be retrieved at different positions according to the position sequence and the preset data type and writing the unique target position integer values into a mark field of a preset database;
the operation processing module is used for comparing a plurality of received retrieval condition values in the retrieval condition of the current database with the retrieval condition values in the ordered set when retrieving data contained in the current database, determining a plurality of target positions of the plurality of retrieval condition values in the retrieval condition of the current database in the ordered set according to a comparison result, and performing operation on unique condition values corresponding to the plurality of retrieval condition values obtained by processing information of the plurality of target positions;
and the retrieval module is used for retrieving in the database according to the operation result.
7. The apparatus of claim 6, wherein the determining module comprises:
the first determining module is used for assigning the value of the condition to be retrieved according to the position sequence and the preset data type to obtain a corresponding bit numerical value;
and the second determining module is used for converting the bit numerical value to obtain a unique target position integer value corresponding to the condition value to be retrieved.
8. The apparatus of claim 6, further comprising:
and a third determining module, configured to determine the preset data type according to the number of to-be-retrieved condition values included in the ordered set obtained by enumeration.
9. A computer-readable storage medium storing computer instructions for causing a computer to perform the database retrieval method according to any one of claims 1 to 5.
10. An electronic device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, the processor executing the computer instructions to perform the database retrieval method according to any one of claims 1 to 5.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111502898.9A CN114185890B (en) | 2021-12-09 | 2021-12-09 | Database retrieval method and device, storage medium and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111502898.9A CN114185890B (en) | 2021-12-09 | 2021-12-09 | Database retrieval method and device, storage medium and electronic equipment |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114185890A true CN114185890A (en) | 2022-03-15 |
CN114185890B CN114185890B (en) | 2022-11-01 |
Family
ID=80604188
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111502898.9A Active CN114185890B (en) | 2021-12-09 | 2021-12-09 | Database retrieval method and device, storage medium and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114185890B (en) |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2001101189A (en) * | 1999-09-30 | 2001-04-13 | Fujitsu Ltd | Information retrieving device, method for displaying information retrieval result and computer readable recording medium with information retrieval program recorded thereon |
US20010013028A1 (en) * | 1997-12-12 | 2001-08-09 | Kazufumi Arai | Database retrieval system and computer-readable storage medium storing a program for database retrieval |
JP2004213347A (en) * | 2002-12-27 | 2004-07-29 | Canon Sales Co Inc | Database retrieval query generating method, database retrieval method, database retrieval device, program and recording medium |
CN105589894A (en) * | 2014-11-13 | 2016-05-18 | 腾讯数码(深圳)有限公司 | Document index establishing method and device as well as document retrieving method and device |
CN106255962A (en) * | 2014-05-01 | 2016-12-21 | 斯凯孚公司 | For improving the system and method for data structure storage |
CN110032562A (en) * | 2019-01-30 | 2019-07-19 | 阿里巴巴集团控股有限公司 | A kind of method and device of storage service record |
CN110334094A (en) * | 2019-06-20 | 2019-10-15 | 阿里巴巴集团控股有限公司 | A kind of data query method, system, device and equipment based on inverted index |
CN110825737A (en) * | 2019-10-18 | 2020-02-21 | 支付宝(杭州)信息技术有限公司 | Index creation and data query method, device and equipment |
CN111459982A (en) * | 2020-03-27 | 2020-07-28 | 中国平安人寿保险股份有限公司 | Data query method and device, terminal device and storage medium |
-
2021
- 2021-12-09 CN CN202111502898.9A patent/CN114185890B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20010013028A1 (en) * | 1997-12-12 | 2001-08-09 | Kazufumi Arai | Database retrieval system and computer-readable storage medium storing a program for database retrieval |
JP2001101189A (en) * | 1999-09-30 | 2001-04-13 | Fujitsu Ltd | Information retrieving device, method for displaying information retrieval result and computer readable recording medium with information retrieval program recorded thereon |
JP2004213347A (en) * | 2002-12-27 | 2004-07-29 | Canon Sales Co Inc | Database retrieval query generating method, database retrieval method, database retrieval device, program and recording medium |
CN106255962A (en) * | 2014-05-01 | 2016-12-21 | 斯凯孚公司 | For improving the system and method for data structure storage |
CN105589894A (en) * | 2014-11-13 | 2016-05-18 | 腾讯数码(深圳)有限公司 | Document index establishing method and device as well as document retrieving method and device |
CN110032562A (en) * | 2019-01-30 | 2019-07-19 | 阿里巴巴集团控股有限公司 | A kind of method and device of storage service record |
CN110334094A (en) * | 2019-06-20 | 2019-10-15 | 阿里巴巴集团控股有限公司 | A kind of data query method, system, device and equipment based on inverted index |
CN110825737A (en) * | 2019-10-18 | 2020-02-21 | 支付宝(杭州)信息技术有限公司 | Index creation and data query method, device and equipment |
CN111459982A (en) * | 2020-03-27 | 2020-07-28 | 中国平安人寿保险股份有限公司 | Data query method and device, terminal device and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN114185890B (en) | 2022-11-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8924373B2 (en) | Query plans with parameter markers in place of object identifiers | |
US20130013597A1 (en) | Processing Repetitive Data | |
CN107729399B (en) | Data processing method and device | |
CN111061758B (en) | Data storage method, device and storage medium | |
US20240126817A1 (en) | Graph data query | |
US9218394B2 (en) | Reading rows from memory prior to reading rows from secondary storage | |
CN109902126B (en) | Loading system supporting HIVE automatic partition and implementation method thereof | |
WO2019161645A1 (en) | Shell-based data table extraction method, terminal, device, and storage medium | |
CN114139040A (en) | Data storage and query method, device, equipment and readable storage medium | |
CN112328592A (en) | Data storage method, electronic device and computer readable storage medium | |
CN110222046B (en) | List data processing method, device, server and storage medium | |
US9213759B2 (en) | System, apparatus, and method for executing a query including boolean and conditional expressions | |
CN112883088B (en) | Data processing method, device, equipment and storage medium | |
CN112052248A (en) | Audit big data processing method and system | |
CN112506490A (en) | Interface generation method and device, electronic equipment and storage medium | |
CN114185890B (en) | Database retrieval method and device, storage medium and electronic equipment | |
CN109101595B (en) | Information query method, device, equipment and computer readable storage medium | |
CN116010345A (en) | Method, device and equipment for realizing table service scheme of flow batch integrated data lake | |
CN112835905B (en) | Array type column indexing method, device, equipment and storage medium | |
CN115687392A (en) | SQL statement optimized execution method and device, electronic equipment and medium | |
CN111723089A (en) | Method and device for processing data based on columnar storage format | |
CN115858471A (en) | Service data change recording method, device, computer equipment and medium | |
CN110569243B (en) | Data query method, data query plug-in and data query server | |
CN114297236A (en) | Data blood relationship analysis method, terminal equipment and storage medium | |
CN114169318A (en) | Process identification method, apparatus, device, medium, and program |
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 |