CN114595241A - Database data processing method and device, storage medium and electronic equipment - Google Patents

Database data processing method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN114595241A
CN114595241A CN202210128815.2A CN202210128815A CN114595241A CN 114595241 A CN114595241 A CN 114595241A CN 202210128815 A CN202210128815 A CN 202210128815A CN 114595241 A CN114595241 A CN 114595241A
Authority
CN
China
Prior art keywords
target
statement
sql statement
sql
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210128815.2A
Other languages
Chinese (zh)
Inventor
邱海港
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Kingsoft Cloud Network Technology Co Ltd
Original Assignee
Beijing Kingsoft Cloud 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 Beijing Kingsoft Cloud Network Technology Co Ltd filed Critical Beijing Kingsoft Cloud Network Technology Co Ltd
Priority to CN202210128815.2A priority Critical patent/CN114595241A/en
Publication of CN114595241A publication Critical patent/CN114595241A/en
Pending legal-status Critical Current

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/242Query formulation
    • G06F16/2433Query languages
    • G06F16/2445Data retrieval commands; View definitions
    • 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/2453Query optimisation

Landscapes

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

Abstract

The invention discloses a data processing method and device of a database, a storage medium and electronic equipment. The method comprises the following steps: receiving a first SQL statement, wherein the first SQL statement is used for processing data in a target database; under the condition that the first SQL statement is a statement in a target configuration file, adding a limiting condition to the first SQL statement to obtain a plurality of target SQL statements, wherein the target configuration file comprises the plurality of SQL statements, and the limiting condition is used for limiting data in a database to be processed by each target SQL statement; the data in the target database is processed using a plurality of target SQL statements. The invention solves the technical problems of long-time locking of the table and system crash caused by large data volume processed by the SQL statement.

Description

Database data processing method and device, storage medium and electronic equipment
Technical Field
The present invention relates to the field of databases, and in particular, to a method and an apparatus for processing data of a database, a storage medium, and an electronic device.
Background
In the prior art, when data in a database needs to be managed, Structured Query Language (SQL) statements may be generally input to manage the data in the database, such as adding, deleting, checking, and modifying.
However, some SQL statements involve managing a full table in a database or managing a large amount of data for multiple tables, such as the update statement, may update every piece of data for the entire table. If the server processes the statement, the whole table is locked, and a large amount of time is consumed for updating data in the table, which may cause all other statements to fail to process the table, further causing application blocking and system crash.
Disclosure of Invention
The embodiment of the invention provides a data processing method, a data processing device, a storage medium and electronic equipment of a database, and aims to at least solve the technical problems of long-time locking of a table and system crash caused by large data volume processed by SQL statements.
According to an aspect of an embodiment of the present invention, there is provided a data processing method for a database, including: receiving a first SQL statement, wherein the first SQL statement is used for processing data in a target database; adding a limiting condition to the first SQL statement to obtain a plurality of target SQL statements when the first SQL statement is a statement in a target configuration file, wherein the target configuration file comprises a plurality of SQL statements, and the limiting condition is used for limiting data in the database to be processed by each target SQL statement; and processing the data in the target database by using a plurality of target SQL sentences.
According to another aspect of the embodiments of the present invention, there is provided a data processing apparatus of a database, including: the system comprises a receiving module, a processing module and a sending module, wherein the receiving module is used for receiving a first SQL statement, and the first SQL statement is used for processing data in a target database; an adding module, configured to add a restriction condition to the first SQL statement to obtain multiple target SQL statements when the first SQL statement is a statement in a target configuration file, where the target configuration file includes multiple SQL statements, and the restriction condition is used to restrict data in the database to be processed by each target SQL statement; and the processing module is used for processing the data in the target database by using a plurality of target SQL sentences.
As an optional example, the adding module includes: an adding unit, configured to add a target field to the first SQL statement, where the target field is used to limit data in the database to be processed by the target SQL statement; a first determining unit, configured to use the first SQL statement to which the target field is added as the target SQL statement.
As an optional example, the adding module further includes: the query unit is used for querying the total number of the data in the database to be traversed by the first SQL statement to obtain a first numerical value; and a second determining unit, configured to determine the target field according to the first value.
As an optional example, the apparatus further includes: a comparison module, configured to use each statement in the target configuration file as a current statement, and perform the following operations on the current statement: comparing the current statement with the first SQL statement starting from the first character of the current statement and the first SQL statement; and when the current statement is the same as the first SQL statement, determining the first SQL statement as the statement in the target configuration file.
As an optional example, the apparatus further includes: the device comprises an acquisition module, a storage module and a control module, wherein the acquisition module is used for acquiring a first array, and each bit in the first array is zero; a first determining module, configured to determine each statement in the target configuration file as a current statement, scatter the current statement as K integers using K hash functions, and adjust a bit corresponding to the K integers in the first array to 1 to obtain a target array, where each hash function is used to hash the current statement into an integer; a hashing module, configured to hash the first SQL statement into K integers using the K hash functions; and a second determining module, configured to determine, when bits corresponding to the K integers of the first SQL statement in the target array are all 1, that the first SQL statement is a statement in the target configuration file.
As an optional example, the processing module includes: and a sending unit, configured to send the plurality of target SQL statements to a server, and execute the plurality of target SQL statements by the server to process data in the target database.
According to still another aspect of the embodiments of the present invention, there is also provided a storage medium having a computer program stored therein, wherein the computer program, when executed by a processor, performs the data processing method of the database.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including a memory and a processor, where the memory stores therein a computer program, and the processor is configured to execute the data processing method of the database by using the computer program.
In the embodiment of the invention, a first SQL statement is received, wherein the first SQL statement is used for processing data in a target database; adding a limiting condition to the first SQL statement to obtain a plurality of target SQL statements when the first SQL statement is a statement in a target configuration file, wherein the target configuration file comprises a plurality of SQL statements, and the limiting condition is used for limiting data in the database to be processed by each target SQL statement; according to the method for processing the data in the target database by using the plurality of target SQL sentences, if the first SQL sentence is obtained and is a sentence in the target configuration file, and no limitation exists, the limitation is added to the first SQL sentence to limit the data processed by the first SQL sentence, so that the plurality of target SQL sentences are obtained, and then the data in the database is processed by the target SQL sentence, so that the data in the database does not need to be processed in a large batch at one time, and the technical problems of long-time locking of a table and system breakdown caused by large data volume processed by the SQL sentence are solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a flow chart of an alternative database data processing method according to an embodiment of the invention;
FIG. 2 is a schematic diagram of a first array and a target array of an alternative database data processing method according to an embodiment of the invention;
FIG. 3 is a schematic diagram of an alternative database data processing apparatus according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of an alternative electronic device according to an embodiment of the invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, 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 only a part of the embodiments of the present invention, and not all of the embodiments. 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.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
According to a first aspect of the embodiments of the present invention, there is provided a data processing method of a database, optionally, as shown in fig. 1, the method includes:
s102, receiving a first SQL statement, wherein the first SQL statement is used for processing data in a target database;
s104, under the condition that the first SQL statement is a statement in a target configuration file, adding a limiting condition to the first SQL statement to obtain a plurality of target SQL statements, wherein the target configuration file comprises a plurality of SQL statements, and the limiting condition is used for limiting data in a database to be processed by each target SQL statement;
and S106, processing the data in the target database by using a plurality of target SQL sentences.
Alternatively, the present embodiment may be applied to a client of the database, and the server database is accessed through the client. The client, upon receiving the first SQL statement input, may generate a target SQL statement using the method according to the present application, and then send the target SQL statement to the server, where the target SQL statement is executed by the server to process the data in the database.
Optionally, in this embodiment, a target configuration file may be set in advance, and the statements in the target configuration file may be statements with a large processed data amount. For example, if a statement is to update ten million pieces of data in the database, it means that the amount of data to be processed related to the statement is too large, and the statement is regarded as a statement in the target configuration file. In this embodiment, if the amount of data to be processed related to a statement exceeds a threshold, the statement may be used as a statement in the target configuration file. In this embodiment, for one query statement, since the query statement does not lock the table, the query statement may not be used as a statement in the target configuration file even if the amount of data involved is large.
After the target profile is determined, the target profile may be stored on the server. And if the user accesses the database through the terminal and inputs the first SQL statement, and the server judges that the first SQL statement is positioned in the target configuration file, the server prohibits the execution of the first SQL statement. If the user accesses the database through the client and inputs the first SQL statement, the client downloads the target configuration file from the server, if the first SQL statement is judged to be the statement in the target configuration file, a limiting condition is added to the first SQL statement to limit the first SQL statement, a plurality of target SQL statements are obtained, and the data in the target database is processed by using the plurality of target SQL statements.
According to the method, if the first SQL statement is obtained and is a statement in the target configuration file, no limitation is provided, the limitation is added to the first SQL statement to limit the data processed by the first SQL statement, a plurality of target SQL statements are obtained, and then the data in the database is processed by the target SQL statement, so that the data in the database does not need to be processed in a large batch at one time, and the problems of long-time locking of the table and service breakdown caused by large data processing amount are solved.
As an optional example, in the above case that the first SQL statement is a statement in the target configuration file, adding a constraint to the first SQL statement to obtain a plurality of target SQL statements includes:
adding a target field for the first SQL statement, wherein the target field is used for limiting data in a database to be processed by the target SQL statement;
and taking the first SQL statement added with a target field as a target SQL statement.
Optionally, in this embodiment, when a restriction condition is added to the first SQL statement to obtain multiple target SQL statements, a target field may be added to the first SQL statement. The destination field may be a "where" field. Before the 'where' field is added, the first SQL statement does not limit the range of the data to be processed, full-table processing is required, and the processed data volume is large. After the "where" field is added, the first SQL statement becomes the target SQL statement, and the "where" field is used to limit the range of the data to be processed by the target SQL statement, for example, if the "where" field is used to limit the statement to only process 1000 pieces of data in the table, the target SQL statement processes 1000 pieces of data in the table at most. Different target SQL statements may define different data to be processed. For example, the data to be processed by a first SQL statement is divided into 1000 shares, each target SQL statement processes one share, and the share to be processed by the target SQL statement is limited by the "where" field.
As an optional example, the method further includes:
inquiring the total number of data in a database to be traversed by the first SQL statement to obtain a first numerical value;
the target field is determined according to the first value.
Optionally, in this embodiment, the numerical size of each target field may be determined according to the total number of pieces of data in the database to be traversed by the first SQL statement. For example, if the first value corresponding to the total number is 1000000, the data of 1/100 in the first value can be used as the maximum number of statements that can be processed by one target SQL statement, and each target SQL statement processes 10000 data.
As an optional example, the method further includes:
taking each statement in the target configuration file as a current statement, and executing the following operations on the current statement:
comparing the current statement with the first SQL statement from the first character of the current statement and the first SQL statement;
and under the condition that the current statement is the same as the first SQL statement, determining the first SQL statement as the statement in the target configuration file.
Optionally, in this embodiment, when comparing whether the first SQL statement is located in the target configuration file, the first SQL statement may be compared with each statement in the target configuration file, and in the comparison process, each character of the current statement in the first SQL statement and the target configuration file is compared, and if the characters are completely the same, the first SQL statement is considered as the statement in the target configuration file.
As an optional example, the method further includes:
acquiring a first array, wherein each bit in the first array is zero;
determining each statement in the target configuration file as a current statement, dispersing the current statement into K integers by using K hash functions, and adjusting the bit corresponding to the K integers in the first array to be 1 to obtain a target array, wherein each hash function is used for dispersing the current statement into an integer;
hashing the first SQL statement into K integers by using K hash functions;
and when the bit positions corresponding to the K integers of the first SQL statement in the target array are all 1, determining that the first SQL statement is the statement in the target configuration file.
Optionally, in this embodiment, when comparing whether the first SQL statement is a statement in the target configuration file, each statement in the target configuration file may be used as a current statement, the current statement is scattered as K integers by using K hash functions, and then, a value of a bit in the first array corresponding to each integer is adjusted from 0 to 1, so as to obtain the target array.
And if the first SQL statement is scattered into K integers by using K hash functions, and bit values of the K integers corresponding to the K integers of the first SQL statement in the target array are all 1, the first SQL statement is regarded as the statement in the target configuration file.
For example, taking a current statement and 3 hash functions as an example, three hash functions hash a current statement to obtain three integers, which are 125, 157, and 221, respectively, the value of each bit in the first array is 0, and the value of the 125 th bit, 157 th bit, and 221 th bit in the first array is adjusted to 1. If the operation is performed on each statement in the target configuration file, the partial ratio feature in the first array is adjusted to 1, and the target array is obtained. For example, FIG. 2 is an example of a segment of bits. Adjusted from the first array in fig. 2 to the target array.
When the 3 hash functions hash the first SQL statement to obtain three integers, for example, 5, 7, and 10, it is determined whether the values of the 5 th bit, 7 th bit, and 10 th bit of the target array are 1, and if all the values are 1, the first SQL statement is located in the target configuration file. If one is not 1, then the first SQL statement is not located in the target configuration file.
As an alternative example, the processing data in the target database by using multiple target SQL statements includes:
and sending the plurality of target SQL sentences to a server, and executing the plurality of target SQL sentences by the server so as to process the data in the target database.
Optionally, in this embodiment, the client may send the obtained multiple SQL statements to the server, and the server performs batch processing or time-sharing processing.
As an optional example, the method further includes:
and under the condition that the server receives the first SQL statement, and under the condition that the server determines that the first SQL statement is the statement in the target configuration file, the execution of the first SQL statement is forbidden.
Optionally, in this embodiment, when the user directly accesses the database through the terminal, the client is not used, and the target SQL statement is obtained without processing the first SQL statement. And after receiving the first SQL statement, the server determines that the first SQL statement is the statement in the target configuration file, and then prohibits the first SQL statement from being executed in a straight line.
This is illustrated in connection with an example.
In this embodiment, a table may be established at the server. As shown in Table 1 below
TABLE 1
Figure BDA0003501748330000081
Figure BDA0003501748330000091
In this embodiment, an SQL statement blacklist (target configuration file) may be added at the server, and through the SQL statement blacklist, if the database is accessed through the terminal, the SQL statement blacklist needs to be scanned first, to determine whether the current statement is in the SQL statement blacklist, and if the current statement is in the SQL statement blacklist, the execution of the current statement is prohibited.
After the client logs in, the configuration information of the SQL statement is downloaded from the server, if the client tool logs in, the configuration information is downloaded, and if the client tool logs in, the configuration information does not need to be downloaded if the client tool logs in is an Application Programming Interface (API) Interface accessed by an Application program. After the configuration information is downloaded, the configuration information, namely the SQL statement blacklist, is added in the configuration file of the client, and some SQL statements which should not be executed are filtered. In this embodiment, bloom filters or regular expression filters may be used.
For SQL statements input on the client and not to be executed, (such as delete statements and update statements), if there is no where statement or full-table update SQL statement, the user is prompted whether to execute, if the user chooses to execute, the execution mode is as follows:
1 first execute select query, total number of queries to execute
2 automatically setting the conditions behind where according to the total number, such as executing only 1000 pieces of data at a time
3 Per 1000 pieces of data indicate the total number of pieces that have been executed
4 until the SQL statement is executed.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the invention. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required by the invention.
According to another aspect of the embodiments of the present application, there is also provided a data processing apparatus of a database, as shown in fig. 3, including:
a receiving module 302, configured to receive a first SQL statement, where the first SQL statement is used to process data in a target database;
an adding module 304, configured to add a limiting condition to the first SQL statement to obtain multiple target SQL statements when the first SQL statement is a statement in the target configuration file, where the target configuration file includes the multiple SQL statements, and the limiting condition is used to limit data in a database to be processed by each target SQL statement;
a processing module 306, configured to process data in the target database using the plurality of target SQL statements.
Alternatively, the present embodiment may be applied to a client of the database, and the server database is accessed through the client. The client, upon receiving the first SQL statement input, may generate a target SQL statement using the method according to the present application, and then send the target SQL statement to the server, where the target SQL statement is executed by the server to process the data in the database.
Optionally, in this embodiment, a target configuration file may be set in advance, and the statements in the target configuration file may be statements with a large processed data amount. For example, if a statement is to update ten million pieces of data in the database, it means that the amount of data to be processed related to the statement is too large, and the statement is regarded as a statement in the target configuration file. In this embodiment, if the amount of data to be processed related to a statement exceeds a threshold, the statement may be used as a statement in the target configuration file. In this embodiment, for one query statement, since the query statement does not lock the table, the query statement may not be used as a statement in the target configuration file even if the amount of data involved is large.
After the target profile is determined, the target profile may be stored on the server. And if the user accesses the database through the terminal and inputs the first SQL statement, and the server judges that the first SQL statement is positioned in the target configuration file, the server prohibits the execution of the first SQL statement. If the user accesses the database through the client and inputs the first SQL statement, the client downloads the target configuration file from the server, if the first SQL statement is judged to be the statement in the target configuration file, a limiting condition is added to the first SQL statement to limit the first SQL statement, a plurality of target SQL statements are obtained, and the data in the target database is processed by using the plurality of target SQL statements.
According to the method, if the first SQL statement is obtained and is a statement in the target configuration file, and no limitation exists, the limitation is added to the first SQL statement to limit the data processed by the first SQL statement, so that a plurality of target SQL statements are obtained, and then the target SQL statement processes the data in the database, so that the data in the database does not need to be processed in a large batch at one time, and the problems of long-time locking of the table and service breakdown caused by large data processing amount are solved.
As an optional example, the adding module includes:
the adding unit is used for adding a target field for the first SQL statement, wherein the target field is used for limiting data in a database to be processed by the target SQL statement;
and the first determination unit is used for taking the first SQL statement added with the target field as a target SQL statement.
Optionally, in this embodiment, when a restriction condition is added to the first SQL statement to obtain multiple target SQL statements, a target field may be added to the first SQL statement. The destination field may be a "where" field. Before the 'where' field is added, the first SQL statement does not limit the range of the data to be processed, full-table processing is required, and the processed data volume is large. After the "where" field is added, the first SQL statement becomes the target SQL statement, and the "where" field is used to limit the range of the data to be processed by the target SQL statement, for example, the "where" field is used to limit the statement to only process 1000 pieces of data in the table, the target SQL statement processes 1000 pieces of data in the table at most. Different target SQL statements may define different data to be processed. For example, the data to be processed by a first SQL statement is divided into 1000 shares, each target SQL statement processes one share, and the share to be processed by the target SQL statement is limited by the "where" field.
As an optional example, the adding module further includes:
the query unit is used for querying the total number of data in the database to be traversed by the first SQL statement to obtain a first numerical value;
and the second determining unit is used for determining the target field according to the first value.
Optionally, in this embodiment, the numerical size of each target field may be determined according to the total number of pieces of data in the database to be traversed by the first SQL statement. For example, if the first value corresponding to the total number is 1000000, the data of 1/100 in the first value can be used as the maximum number of statements that can be processed by one target SQL statement, and each target SQL statement processes 10000 data.
As an optional example, the apparatus further includes:
and the comparison module is used for taking each statement in the target configuration file as a current statement and executing the following operations on the current statement:
starting from the current statement and a first character of a first SQL statement, comparing the current statement with the first SQL statement;
and under the condition that the current statement is the same as the first SQL statement, determining the first SQL statement as the statement in the target configuration file.
Optionally, in this embodiment, when comparing whether the first SQL statement is located in the target configuration file, the first SQL statement may be compared with each statement in the target configuration file, and in the comparison process, each character of the current statement in the first SQL statement and the target configuration file is compared, and if the characters are completely the same, the first SQL statement is considered as the statement in the target configuration file.
As an optional example, the apparatus further includes:
the device comprises an acquisition module, a storage module and a control module, wherein the acquisition module is used for acquiring a first array, and each bit in the first array is zero;
the first determining module is used for determining each statement in the target configuration file as a current statement, dispersing the current statement into K integers by using K hash functions, and adjusting the bit corresponding to the K integers in the first array to be 1 to obtain a target array, wherein each hash function is used for dispersing the current statement into one integer;
the hash module is used for hashing the first SQL statement into K integers by using K hash functions;
and the second determining module is used for determining the first SQL statement as the statement in the target configuration file when the bit positions corresponding to the K integers of the first SQL statement in the target array are all 1.
Optionally, in this embodiment, when comparing whether the first SQL statement is a statement in the target configuration file, each statement in the target configuration file may be used as a current statement, the current statement is scattered as K integers by using K hash functions, and then, a value of a bit in the first array corresponding to each integer is adjusted from 0 to 1, so as to obtain the target array.
And if the first SQL statement is scattered into K integers by using K hash functions, and bit values of the K integers corresponding to the K integers of the first SQL statement in the target array are all 1, the first SQL statement is regarded as the statement in the target configuration file.
For example, taking a current statement and 3 hash functions as an example, three hash functions hash a current statement to obtain three integers, which are 125, 157, and 221, respectively, the value of each bit in the first array is 0, and the value of the 125 th bit, 157 th bit, and 221 th bit in the first array is adjusted to 1. If the operation is performed on each statement in the target configuration file, some of the feature numbers in the first array are adjusted to 1, and the target array is obtained. For example, FIG. 2 is an example of a segment of bits. Adjusted from the first array in fig. 2 to the target array.
When the 3 hash functions hash the first SQL statement to obtain three integers, for example, 5, 7, and 10, it is determined whether the values of the 5 th bit, 7 th bit, and 10 th bit of the target array are 1, and if all the values are 1, the first SQL statement is located in the target configuration file. If one is not 1, then the first SQL statement is not located in the target configuration file.
As an optional example, the processing module includes:
and the sending unit is used for sending the plurality of target SQL sentences to the server, and executing the plurality of target SQL sentences by the server so as to process the data in the target database.
For other examples of this embodiment, please refer to the above examples, which are not described herein.
Optionally, in this embodiment, the client may send the obtained multiple SQL statements to the server, and the server performs batch processing or time-sharing processing.
Fig. 4 is a block diagram of an alternative electronic device according to an embodiment of the present application, as shown in fig. 4, including a processor 402, a communication interface 404, a memory 406, and a communication bus 408, where the processor 402, the communication interface 404, and the memory 406 communicate with each other via the communication bus 408, where,
a memory 406 for storing a computer program;
the processor 402, when executing the computer program stored in the memory 406, performs the following steps:
receiving a first SQL statement, wherein the first SQL statement is used for processing data in a target database;
under the condition that the first SQL statement is a statement in a target configuration file, adding a limiting condition to the first SQL statement to obtain a plurality of target SQL statements, wherein the target configuration file comprises the plurality of SQL statements, and the limiting condition is used for limiting data in a database to be processed by each target SQL statement;
the data in the target database is processed using a plurality of target SQL statements.
Alternatively, in this embodiment, the communication bus may be a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in FIG. 4, but this does not indicate only one bus or one type of bus. The communication interface is used for communication between the electronic equipment and other equipment.
The memory may include RAM, and may also include non-volatile memory (non-volatile memory), such as at least one disk memory. Alternatively, the memory may be at least one memory device located remotely from the aforementioned processor.
As an example, the memory 406 may include, but is not limited to, the receiving module 302, the adding module 304, and the processing module 306 in the processing device of the request. In addition, the module may further include, but is not limited to, other module units in the processing apparatus of the request, which is not described in this example again.
The processor may be a general-purpose processor, and may include but is not limited to: a CPU (Central Processing Unit), NP (Network Processor), and the like; but also a DSP (Digital Signal Processing), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component.
Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments, and this embodiment is not described herein again.
It can be understood by those skilled in the art that the structure shown in fig. 4 is only an illustration, and the device implementing the processing method of the request may be a terminal device, and the terminal device may be a terminal device such as a smart phone (e.g., an Android phone, an iOS phone, etc.), a tablet computer, a palm computer, a Mobile Internet Device (MID), a PAD, and the like. Fig. 4 is a diagram illustrating a structure of the electronic device. For example, the electronic device may also include more or fewer components (e.g., network interfaces, display devices, etc.) than shown in FIG. 4, or have a different configuration than shown in FIG. 4.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by a program instructing hardware associated with the terminal device, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disk, ROM, RAM, magnetic or optical disk, and the like.
According to still another aspect of embodiments of the present invention, there is also provided a computer-readable storage medium in which a computer program is stored, wherein the computer program, when executed by a processor, performs the steps in the data processing method of the database.
Alternatively, in this embodiment, a person skilled in the art may understand that all or part of the steps in the methods of the foregoing embodiments may be implemented by a program instructing hardware associated with the terminal device, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
The integrated unit in the above embodiments, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in the above computer-readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing one or more computer devices (which may be personal computers, servers, network devices, etc.) to execute all or part of the steps of the method according to the embodiments of the present invention.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed client may be implemented in other manners. The above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one type of logical functional division, and other divisions may be implemented in practice, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (10)

1. A data processing method of a database is characterized by comprising the following steps:
receiving a first SQL statement, wherein the first SQL statement is used for managing data in a target database;
adding a limiting condition to the first SQL statement to obtain a target SQL statement under the condition that the first SQL statement is a statement in a target configuration file, wherein the target configuration file comprises a plurality of SQL statements, and the limiting condition is used for limiting the number of data in the database traversed by the target SQL statement;
and managing the data in the target database by using the target SQL statement.
2. The method according to claim 1, wherein, in the case that the first SQL statement is a statement in a target configuration file, adding a constraint to the first SQL statement comprises:
adding a target field to the first SQL statement;
setting a target value in the target field, wherein the target value is used for limiting the number of pieces of data in the database traversed by the target SQL statement.
3. The method of claim 2, further comprising:
querying the total number of data in the database to be traversed by the first SQL statement to obtain a first numerical value, and determining 1/N of the first numerical value as the target numerical value; or
And presetting the target numerical value.
4. The method of claim 1, further comprising:
taking each statement in the target configuration file as a current statement, and executing the following operations on the current statement:
comparing the current statement with the first SQL statement from the first character of the current statement and the first SQL statement;
and under the condition that the current statement is the same as the first SQL statement, determining the first SQL statement as the statement in the target configuration file.
5. The method of claim 1, further comprising:
acquiring a first array, wherein each bit in the first array is zero;
determining each statement in the target configuration file as a current statement, dispersing the current statement into K integers by using K hash functions, and adjusting the bit corresponding to the K integers in the first array to be 1 to obtain a target array, wherein each hash function is used for hashing the current statement into an integer;
hashing the first SQL statement into K integers by using the K hash functions;
and when the bit positions corresponding to the K integers of the first SQL statement in the target array are all 1, determining that the first SQL statement is the statement in the target configuration file.
6. The method of claim 1, wherein managing data in the target database using the target SQL statement comprises:
and sending the target SQL statement to a server, and executing the target SQL statement by the server so as to manage the data in the target database.
7. The method of claim 6, further comprising:
and under the condition that the server receives the first SQL statement, and under the condition that the server determines that the first SQL statement is the statement in the target configuration file, prohibiting the execution of the first SQL statement.
8. A data processing apparatus of a database, comprising:
the system comprises a receiving module, a processing module and a sending module, wherein the receiving module is used for receiving a first SQL statement, and the first SQL statement is used for managing data in a target database;
the processing module is used for adding a limiting condition to the first SQL statement to obtain a target SQL statement under the condition that the first SQL statement is a statement in a target configuration file, wherein the target configuration file comprises a plurality of SQL statements, and the limiting condition is used for limiting the number of data in the database traversed by the target SQL statement;
and the management module is used for managing the data in the target database by using the target SQL statement.
9. A computer-readable storage medium, in which a computer program is stored, which, when being executed by a processor, carries out the method of any one of claims 1 to 7.
10. An electronic device comprising a memory and a processor, characterized in that the memory has stored therein a computer program, the processor being arranged to execute the method of any of claims 1 to 7 by means of the computer program.
CN202210128815.2A 2022-02-11 2022-02-11 Database data processing method and device, storage medium and electronic equipment Pending CN114595241A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210128815.2A CN114595241A (en) 2022-02-11 2022-02-11 Database data processing method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210128815.2A CN114595241A (en) 2022-02-11 2022-02-11 Database data processing method and device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN114595241A true CN114595241A (en) 2022-06-07

Family

ID=81806992

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210128815.2A Pending CN114595241A (en) 2022-02-11 2022-02-11 Database data processing method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN114595241A (en)

Similar Documents

Publication Publication Date Title
CN107832062B (en) Program updating method and terminal equipment
CN111277635B (en) Method, equipment, device and computer medium for accessing external node to block chain
CN110532799B (en) Data desensitization control method, electronic device and computer readable storage medium
CN112527433A (en) Page popup control method and device, computer equipment and storage medium
CN109213774B (en) Data storage method and device, storage medium and terminal
US20190147443A1 (en) Payment method based on mobile terminal and mobile terminal
CN112685709A (en) Authorization token management method and device, storage medium and electronic equipment
CN111026765A (en) Dynamic processing method, equipment, storage medium and device for strictly balanced binary tree
CN111464487A (en) Access control method, device and system
CN111369354A (en) Data monitoring method and device for block chain application and storage medium
CN112733510A (en) Financial certificate generation method, device, equipment and computer readable storage medium
CN114595241A (en) Database data processing method and device, storage medium and electronic equipment
CN113297266A (en) Data processing method, device, equipment and computer storage medium
CN110727895A (en) Sensitive word sending method and device, electronic equipment and storage medium
CN110806979A (en) Interface return value checking method, device, equipment and storage medium
CN113342275B (en) Method, apparatus and computer readable storage medium for accessing data at block link points
CN113285933A (en) User access control method and device, electronic equipment and storage medium
CN114490719A (en) Data query method and device, electronic equipment and storage medium
CN116069802A (en) Method, device, electronic equipment and storage medium for accessing database
CN114386087A (en) Data query processing method and device, electronic equipment and storage medium
CN114157662A (en) Cloud platform parameter adaptation method and device, terminal equipment and storage medium
CN113271312A (en) Private data protection method and system in mobile internet
CN111459911A (en) Service data processing method and device
CN110874246A (en) Module loading method, system and equipment
CN110209690B (en) Data acquisition method and device and electronic equipment

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