Insertion statement short circuit method and system based on time sequence database

By skipping the parser stage in the time series database and directly performing type conversion and length verification, the problem of slow execution speed in the time series database insertion operation is solved, and faster data insertion speed and detailed error location are achieved.

CN118535593APending Publication Date: 2024-08-23上海沄熹科技有限公司
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202410357174.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-27
Publication Date
2024-08-23

AI Technical Summary

Technical Problem

In time-series databases, the syntax analysis and lexical analysis of the parser stage during the insertion operation take a long time, resulting in slower execution of the insertion statement and unnecessary time overhead.

Method used

Provides a short-circuiting method for insert statements based on time-series databases. By judging the short-circuiting switch, the parser stage is skipped, type conversion and length verification are directly performed based on metadata information, and the converted results are directly spliced ​​into a payload and sent to the storage engine. , to implement the insertion operation.

Benefits of technology

While ensuring length verification and type verification, it greatly reduces the execution process of insert statements, speeds up data insertion, and provides a detailed error reporting mechanism to facilitate users to locate problems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118535593A
    Figure CN118535593A
Patent Text Reader

Abstract

The invention discloses an insert statement short-circuit method and system based on a time sequence database, belongs to the technical field of databases, and aims to solve the technical problems of shortening an execution process and accelerating the execution speed of an insert statement while ensuring length verification and type verification. Comprising the following steps: analyzing an SQL statement input by a user, and obtaining a database name, an inserted table name, an inserted column name and a corresponding column value by inserting a statement fixed format; performing authentication; judging whether the table is a time sequence table according to the database name and the table name, and obtaining metadata information of the column; skipping a parser stage, performing type conversion and length verification according to the metadata information of the column, splicing converted results into payload, and sending the payload to a storage engine; and the storage engine performs insertion operation and returns to the user according to the number of inserted lines or error information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of databases, and in particular to an insert statement short-circuiting method and system based on a time series database. Background Art

[0002] KaiwuDB is an open architecture, multi-dimensional collaborative, distributed, and multi-mode database. KaiwuDB uses its flexible and scalable open architecture to be used in both embedded devices with limited resources and cloud platforms with rich resources. Its main usage environment is time series scenarios, that is, the saved data often carries time information, and under normal circumstances, the data is incremental in time. In actual production environments, the amount of time series data is often very large, and most of the time is spent inserting data into the table to save information at the current time point, so for time series databases, data insertion performance is particularly important.

[0003] The general structure of the database is as follows Figure 1 As shown in the figure, the whole can be roughly divided into two parts, the execution engine and the storage engine. The execution engine includes the parser stage and the execution stage. The parser stage is responsible for parsing the sql (string type) input by the user, judging the type of sql through keywords such as insert and select, and then forming an AST (abstract syntax tree). Then the database system will generate a logical plan with the lowest cost (i.e. the most efficient) according to the AST through methods such as cost estimation, and generate a physical plan that can be specifically executed. The operator in the physical plan then calls the execution engine to read and insert the actual data. For the insert statement, the inserted data is spliced ​​into a long string stream (payload) and sent to the execution engine. The execution engine locates the specific database and table according to the agreed rules to complete the insert operation.

[0004] Unlike complex query operations, insert operations are relatively simple and direct, and the execution method is also fixed, so the logical plan and physical plan are relatively fixed. The time spent on building protection is actually unnecessary time. In the parser stage, syntax analysis and lexical analysis take up a long time. In this stage, the column value entered by the user will be converted to the corresponding Tree.Expr, and then type conversion and verification will be performed. The conversion to Tree.Expr involves a lot of memory overhead. Then the logical plan and physical plan are built, which is also time-consuming.

[0005] How to shorten the execution process and speed up the execution of insert statements while ensuring length verification and type verification is a technical problem that needs to be solved. Summary of the invention

[0006] The technical task of the present invention is to address the above shortcomings and provide an insert statement short-circuiting method and system based on a time series database to solve the technical problem of shortening the execution process and speeding up the execution speed of the insert statement while ensuring length verification and type verification.

[0007] In a first aspect, the present invention provides an insert statement short-circuiting method based on a time series database, comprising the following steps:

[0008] S100, determine whether the short-circuit switch is turned on, if it is turned on, execute the next step, otherwise execute the execution process of the original insert statement;

[0009] S200, parsing the SQL statement input by the user, and obtaining the database name, the inserted table name, the inserted column name and the corresponding column value by inserting the fixed format of the statement;

[0010] S300, perform authentication, and determine whether the table can be inserted through the user information saved in the current link. If yes, execute the next step. If not, return to the user according to the number of inserted rows or error information;

[0011] S400, judging whether it is a time series table according to the database name and the table name, and obtaining metadata information of the column; if it is, executing the next step; if not, executing the execution process of the original insert statement;

[0012] S500: Skip the parser stage, perform type conversion and length verification according to the metadata information of the column, and concatenate the converted results into a payload and send it to the storage engine;

[0013] S600: The storage engine performs an insert operation and returns information to the user based on the number of inserted rows or error information.

[0014] Preferably, parsing the SQL statement input by the user includes the following steps:

[0015] For the input SQL statement, determine whether it starts with the keyword insert. If so, it means that the SQL statement is an insert statement, and execute the next step for subsequent parsing. If not, return to the original parsing process;

[0016] Continue to execute the scan process until the value keyword is parsed. During parsing, parse according to different types of insert statements;

[0017] The types of inserting into the table include direct insert, specifying columns, and whether or not to include a database name.

[0018] Parsing according to different types of insert statements includes the following operations:

[0019] Based on the database name and table name, determine whether the table to be inserted is a time series table, and based on the symbol after the keyword value, determine whether the user has specified the column to be inserted;

[0020] If the user specifies the inserted column, the column name and inserted value parsed by the scan process are recorded in Columnsname and InsertValues ​​respectively, and the NewNumValue process is skipped;

[0021] If the user does not specify the columns to be inserted, the default is to insert all columns and only extract the InsertValues ​​value.

[0022] Preferably, the metadata information of the column includes the column type and the column ID;

[0023] When performing type conversion and length verification based on the metadata information of the column, match the column name with the inserted column, and perform type verification, null value verification, type conversion, and length verification on the column value according to the column type. If failure occurs, an error is reported directly and recorded through the audit log. If all conversions are successful, the original payload splicing process is called to splice the inserted data into a long string payload according to specific rules, and the payload is sent to the corresponding storage engine.

[0024] Preferably, before performing type conversion and length verification according to the metadata information of the column, perform the following operations to verify the number of inserts:

[0025] When the format of the inserted value cannot divide the inserted column, return to the original process and perform the sacan and parser processes again.

[0026] In a second aspect, the present invention provides an insert statement short-circuiting system based on a time series database, which is used to implement data insertion in a time series database through an insert statement short-circuiting method based on a time series database as described in any one of the first aspects, and the system includes a switch judgment module, a parsing module, an authentication module, a time series table judgment module, a verification module, and an insertion module;

[0027] The switch judgment module is used to judge whether the short-circuit switch is turned on, and if it is turned on, it is used to call the parsing module, otherwise it is used to execute the execution process of the original insert statement;

[0028] The parsing module is used to parse the SQL statement input by the user, and obtain the database name, the inserted table name, the inserted column name and the corresponding column value by inserting the fixed format of the statement;

[0029] The authentication module is used to perform authentication, and judge whether the table can be inserted through the user information saved in the current link. If yes, the timing table judgment module is called, and if not, it is used to return to the user according to the number of inserted rows or error information;

[0030] The time series table judgment module is used to judge whether it is a time series table according to the database name and the table name, and obtain the metadata information of the column. If it is, it is used to call the verification module; if not, it is used to execute the execution process of the original insert statement;

[0031] The verification module is used to skip the parser stage, perform type conversion and length verification according to the metadata information of the column, and splice the converted results into a payload and send it to the storage engine;

[0032] The insert module is used to call the storage engine to perform an insert operation and return the result to the user according to the number of inserted rows or error information.

[0033] Preferably, the parsing module is used to parse the SQL statement input by the user as follows:

[0034] For the input SQL statement, determine whether it starts with the keyword insert. If so, it means that the SQL statement is an insert statement, and execute the next step for subsequent parsing. If not, return to the original parsing process;

[0035] Continue to execute the scan process until the value keyword is parsed. During parsing, parse according to different types of insert statements;

[0036] The types of inserting into the table include direct insert, specifying columns, and whether or not to include a database name.

[0037] Parsing according to different types of insert statements includes the following operations:

[0038] Based on the database name and table name, determine whether the table to be inserted is a time series table, and based on the symbol after the keyword value, determine whether the user has specified the column to be inserted;

[0039] If the user specifies the inserted column, the column name and inserted value parsed by the scan process are recorded in Columnsname and InsertValues ​​respectively, and the NewNumValue process is skipped;

[0040] If the user does not specify the columns to be inserted, the default is to insert all columns and only extract the InsertValues ​​value.

[0041] Preferably, the metadata information of the column includes the column type and the column ID;

[0042] When performing type conversion and length verification according to the metadata information of the column, the verification module is used to perform the following: matching the column name with the inserted column, performing type verification, null value verification, type conversion and length verification on the column value according to the column type. If failure occurs, an error is directly reported and recorded through the audit log. If all conversions can be successfully performed, the original payload splicing process is called to splice the inserted data into a long string payload according to specific rules, and the payload is sent to the corresponding storage engine.

[0043] Preferably, before performing type conversion and length verification according to the metadata information of the column, the verification module is used to verify the number of insertions through the following operations:

[0044] When the format of the inserted value cannot divide the inserted column, return to the original process and perform the sacan and parser processes again.

[0045] The insert statement short-circuiting method and system based on a time series database of the present invention have the following advantages:

[0046] 1. The inserted data can be type checked, null value checked, and length checked to ensure the correctness of the data. A detailed error reporting mechanism is also provided to facilitate user problem location.

[0047] 2. It saves the overhead of the parser stage, logical planning stage and physical planning stage, greatly speeding up the data insertion;

[0048] 3. Independent of the normal execution process of the execution engine, it does not affect the execution results and efficiency of other statements;

[0049] 4. The short-circuit switch can control whether the execution engine follows the short-circuit process, thereby reducing the risk of short-circuit execution errors. BRIEF DESCRIPTION OF THE DRAWINGS

[0050] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0051] The present invention is further described below in conjunction with the accompanying drawings.

[0052] Figure 1 It is a structural diagram of a time series database;

[0053] Figure 2 This is a flowchart of an insert statement short-circuiting execution process in an insert statement short-circuiting method based on a time series database in Example 1;

[0054] Figure 3 This is a flowchart of the insert statement parsing process in an insert statement short-circuiting method based on a time series database in Example 1. DETAILED DESCRIPTION

[0055] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it. However, the embodiments are not intended to limit the present invention. In the absence of conflict, the embodiments of the present invention and the technical features in the embodiments may be combined with each other.

[0056] The embodiment of the present invention provides an insert statement short-circuiting method and system based on a time series database, which solves the technical problem of shortening the execution process while ensuring length verification and type verification, thereby accelerating the execution speed of the insert statement.

[0057] Embodiment 1:

[0058] The present invention provides an insert statement short-circuiting method based on a time series database, comprising the following steps:

[0059] S100, determine whether the short-circuit switch is turned on, if it is turned on, execute the next step, otherwise execute the execution process of the original insert statement;

[0060] S200, parsing the SQL statement input by the user, and obtaining the database name, the inserted table name, the inserted column name and the corresponding column value by inserting the fixed format of the statement;

[0061] S300, perform authentication, and determine whether the table can be inserted through the user information saved in the current link. If yes, execute the next step. If not, return to the user according to the number of inserted rows or error information;

[0062] S400, judging whether it is a time series table according to the database name and the table name, and obtaining metadata information of the column; if it is, executing the next step; if not, executing the execution process of the original insert statement;

[0063] S500: Skip the parser stage, perform type conversion and length verification according to the metadata information of the column, and concatenate the converted results into a payload and send it to the storage engine;

[0064] S600: The storage engine performs an insert operation and returns information to the user based on the number of inserted rows or error information.

[0065] In this embodiment, step S200 parses the SQL statement input by the user, including the following steps:

[0066] (1) For the input SQL statement, determine whether it starts with the keyword insert. If so, it means that the SQL statement is an insert statement, and execute the next step for subsequent parsing. If not, return to the original parsing process;

[0067] (2) The scan process is continuously executed until the value keyword is parsed. During parsing, the analysis is performed according to the different types of insert statements.

[0068] The types of inserting into the table include direct insert, specifying columns, and whether or not to include a database name.

[0069] Parsing according to different types of insert statements includes the following operations:

[0070] (1) Based on the database name and table name, determine whether the table to be inserted is a time series table, and based on the symbol after the keyword value, determine whether the user has specified the column to be inserted;

[0071] (2) If the user specifies the column to be inserted, the column name and the inserted value parsed by the scan process are recorded in Columnsname and InsertValues ​​respectively, and the NewNumValue process is skipped;

[0072] (3) If the user does not specify the column to be inserted, the default is to insert the entire column and only extract the InsertValues ​​value.

[0073] In this embodiment, the metadata information of the column includes the column type and the column ID. When performing type conversion and length verification based on the metadata information of the column, the column name is matched with the inserted column, and the column value is type checked, null value checked, type converted, and length checked according to the column type. If it fails, an error is directly reported and recorded through the audit log. If all can be converted successfully, the original payload splicing process is called to splice the inserted data into a long string payload according to specific rules, and the payload is sent to the corresponding storage engine.

[0074] In this embodiment, before performing type conversion and length verification according to the metadata information of the column, the number of insertions is verified by the following operations: when the format of the inserted value cannot divide the inserted column, return to the original process and re-perform the sacan and parser processes.

[0075] In this embodiment, the insert statement short-circuit process is as follows Figure 2 As shown, first, the short-circuit switch is determined and the short-circuit execution process is started, otherwise the execution process of the original insert statement is executed.

[0076] When parsing the SQL input by the user, determine whether the SQL starts with the insert keyword. If so, it indicates that the statement is an insert statement. Then continue to parse the database name and the name of the inserted table. At this time, perform permission judgment and determine whether the insert operation can be performed on the table based on the user information saved in the current link. At this time, the insert statement can be parsed according to different types (direct insertion, specified columns, whether with library name): the library name and table name are used to determine whether the inserted table is a time series table, and then the "" after the keyword values ​​is used to determine whether the user has specified the inserted column. If it is not a time series table, the original insert process is executed. The column name (if specified by the user) and the inserted value are parsed in the scan stage and recorded in Columnsname and InsertValues ​​respectively. The NewNumValue process is skipped to improve the frequent memory allocation and reduce time consumption. If no column is specified, the default is full column insertion, and only the InsertValues ​​value is extracted. The original process is skipped. In order to distinguish the type of input values, the values ​​in single quotes and double quotes are marked as string types, numbers are marked as numeric types, and strings such as b'xxx' are marked as byte types. By marking different types, the difference between "NULL" and NULL can be distinguished.

[0077] Among them, as a specific implementation of insert statement parsing, its process is as follows Figure 3 As shown, the following operations are included:

[0078] (1) For the input SQL statement, determine whether the first token is insert. If not, return to the original parsing process. If yes, execute the next step:

[0079] (2) Continue to execute the scan process until the value keyword is encountered;

[0080] (3) When the value keyword is queried, determine whether the symbol "." appears in the scanned SQL statement. If so, the table name and database name exist at the same time. Then obtain the table name and database name according to the SQL statement position and execute the next step. If only the table name exists, use the database name in the current session and execute the next step.

[0081] (4) Determine whether the symbol "(" appears in the scanned SQL statement. If so, insert the tokens in "(" and ")" into the column as the specified column and execute the next step. If not, execute the next step directly.

[0082] (5) Determine whether it is a time series table based on the table name and database name. If so, fill the token after value into insertValues ​​as the inserted column. If not, return to the original parsing process.

[0083] In this embodiment, metadata information of the column inserted into the table is obtained, including information such as the column type and column ID, and the inserted column is matched according to the column name. Type check, null value check, type conversion and length check are performed on the column value according to the column type. If it fails, an error will be reported directly and recorded through the audit log (if the audit function is turned on). If all can be converted successfully, the original payload splicing process is called to splice the inserted data into a long string (payload) according to specific rules, and then send it to the corresponding storage engine.

[0084] In this embodiment, the number of insertions is checked: when the number of inserted values ​​cannot divide the number of inserted columns (all columns are inserted by default), it may be that the user inputs a syntax error or that an unsupported function is used, so at this time, return to the original process and re-scan and parse.

[0085] After receiving the payload, the storage engine will further parse it according to the agreed rules, parse the inserted value, and then write it to the disk, that is, insert it into the table, and return the insertion result to the execution engine.

[0086] Embodiment 2:

[0087] The present invention discloses an insert statement short-circuiting system based on a time series database, comprising a switch judgment module, a parsing module, an authentication module, a time series table judgment module, a verification module, and an insertion module. The system can execute the method disclosed in Example 1 to implement data insertion into the time series database.

[0088] The switch judgment module is used to judge whether the short-circuit switch is turned on. If it is turned on, it is used to call the parsing module; otherwise, it is used to execute the execution process of the original insert statement.

[0089] The parsing module is used to parse the SQL statement input by the user, and obtain the database name, the inserted table name, the inserted column name and the corresponding column value by inserting the fixed format of the statement.

[0090] In this embodiment, the parsing module is used to perform the following to parse the SQL statement input by the user:

[0091] (1) For the input SQL statement, determine whether it starts with the keyword insert. If so, it means that the SQL statement is an insert statement, and execute the next step for subsequent parsing. If not, return to the original parsing process;

[0092] (2) The scan process is continuously executed until the value keyword is parsed. During parsing, the analysis is performed according to the different types of insert statements.

[0093] The types of inserting into the table include direct insert, specifying columns, and whether or not to include a database name.

[0094] Parsing according to different types of insert statements includes the following operations:

[0095] (1) Based on the database name and table name, determine whether the table to be inserted is a time series table, and based on the symbol after the keyword value, determine whether the user has specified the column to be inserted;

[0096] (2) If the user specifies the column to be inserted, the column name and the inserted value parsed by the scan process are recorded in Columnsname and InsertValues ​​respectively, and the NewNumValue process is skipped;

[0097] (3) If the user does not specify the column to be inserted, the default is to insert the entire column and only extract the InsertValues ​​value.

[0098] As a specific implementation of insert statement parsing, the parsing module is used to perform the following parsing:

[0099] (1) For the input SQL statement, determine whether the first token is insert. If not, return to the original parsing process. If yes, execute the next step:

[0100] (2) Continue to execute the scan process until the value keyword is encountered;

[0101] (3) When the value keyword is queried, determine whether the symbol "." appears in the scanned SQL statement. If so, the table name and database name exist at the same time. Then obtain the table name and database name according to the SQL statement position and execute the next step. If only the table name exists, use the database name in the current session and execute the next step.

[0102] (4) Determine whether the symbol "(" appears in the scanned SQL statement. If so, insert the tokens in "(" and ")" into column as the specified column.

[0103] The authentication module is used for authentication. It determines whether the table can be inserted through the user information saved in the current link. If yes, it calls the timing table judgment module. If not, it returns to the user according to the number of inserted rows or error information.

[0104] The time series table judgment module is used to judge whether it is a time series table according to the database name and table name, and obtain the metadata information of the column. If it is, it is used to call the verification module; if not, it is used to execute the execution process of the original insert statement.

[0105] The verification module is used to skip the parser stage, perform type conversion and length verification based on the metadata information of the column, and splice the converted results into a payload and send it to the storage engine.

[0106] In this embodiment, the metadata information of the column includes the column type and the column ID. When performing type conversion and length verification according to the metadata information of the column, the verification module is used to match the inserted column according to the column name, and perform type verification, null value verification, type conversion and length verification on the column value according to the column type. If failure occurs, an error is directly reported and recorded through the audit log. If all conversions can be successfully performed, the original payload splicing process is called to splice the inserted data into a long string payload according to specific rules, and the payload is sent to the corresponding storage engine.

[0107] In this embodiment, before performing type conversion and length verification according to the metadata information of the column, the verification module is used to verify the number of insertions through the following operations: when the format of the inserted value cannot divide the inserted column, return to the original process and re-perform the sacan and parser processes.

[0108] The insert module is used to call the storage engine to perform insert operations and return to the user based on the number of inserted rows or error information.

[0109] The present invention has been shown and described in detail above through the accompanying drawings and preferred embodiments. However, the present invention is not limited to these disclosed embodiments. Based on the above multiple embodiments, those skilled in the art can know that the means in the above different embodiments can be combined to obtain more embodiments of the present invention, and these embodiments are also within the protection scope of the present invention.

Claims

1. A method for short-circuiting insert statements based on a time series database, characterized in that: The steps include: S100, determine whether the short-circuit switch is turned on, if it is turned on, execute the next step, otherwise execute the execution process of the original insert statement; S200, parsing the SQL statement input by the user, and obtaining the database name, the inserted table name, the inserted column name and the corresponding column value by inserting the fixed format of the statement; S300, perform authentication, and determine whether the table can be inserted through the user information saved in the current link. If yes, execute the next step. If not, return to the user according to the number of inserted rows or error information; S400, judging whether it is a time series table according to the database name and the table name, and obtaining metadata information of the column; if it is, executing the next step; if not, executing the execution process of the original insert statement; S500: Skip the parser stage, perform type conversion and length verification according to the metadata information of the column, and concatenate the converted results into a payload and send it to the storage engine; S600: The storage engine performs an insert operation and returns information to the user based on the number of inserted rows or error information.

2. The insert statement short-circuiting method based on a time series database according to claim 1, characterized in that: Parsing the SQL statement entered by the user includes the following steps: For the input SQL statement, determine whether it starts with the keyword insert. If so, it means that the SQL statement is an insert statement, and execute the next step for subsequent parsing. If not, return to the original parsing process; Continue to execute the scan process until the value keyword is parsed. During parsing, parse according to different types of insert statements; The types of inserting into the table include direct insert, specifying columns, and whether or not to include a database name. Parsing according to different types of insert statements includes the following operations: Based on the database name and table name, determine whether the table to be inserted is a time series table, and based on the symbol after the keyword value, determine whether the user has specified the column to be inserted; If the user specifies the inserted column, the column name and inserted value parsed by the scan process are recorded in Columnsname and InsertValues ​​respectively, and the NewNumValue process is skipped; If the user does not specify the columns to be inserted, the default is to insert all columns and only extract the InsertValues ​​value.

3. The insert statement short-circuiting method based on a time series database according to claim 1, characterized in that: The metadata information of a column includes the column type and column ID; When performing type conversion and length verification based on the metadata information of the column, match the column name with the inserted column, and perform type verification, null value verification, type conversion, and length verification on the column value according to the column type. If failure occurs, an error is reported directly and recorded through the audit log. If all conversions are successful, the original payload splicing process is called to splice the inserted data into a long string payload according to specific rules, and the payload is sent to the corresponding storage engine.

4. The insert statement short-circuiting method based on a time series database according to claim 1, characterized in that: Before performing type conversion and length verification based on the column metadata information, perform the following operations to verify the number of inserts: When the format of the inserted value cannot divide the inserted column, return to the original process and perform the sacan and parser processes again.

5. An insert statement short-circuiting system based on a time series database, characterized in that: Used to implement data insertion in a time series database by a method for short-circuiting insert statements based on a time series database as described in any one of claims 1 to 4, the system comprising a switch judgment module, a parsing module, an authentication module, a time series table judgment module, a verification module, and an insertion module; The switch judgment module is used to judge whether the short-circuit switch is turned on, and if it is turned on, it is used to call the parsing module, otherwise it is used to execute the execution process of the original insert statement; The parsing module is used to parse the SQL statement input by the user, and obtain the database name, the inserted table name, the inserted column name and the corresponding column value by inserting the fixed format of the statement; The authentication module is used to perform authentication, and judge whether the table can be inserted through the user information saved in the current link. If yes, the timing table judgment module is called, and if not, it is used to return to the user according to the number of inserted rows or error information; The time series table judgment module is used to judge whether it is a time series table according to the database name and the table name, and obtain the metadata information of the column. If it is, it is used to call the verification module; if not, it is used to execute the execution process of the original insert statement; The verification module is used to skip the parser stage, perform type conversion and length verification according to the metadata information of the column, and splice the converted results into a payload and send it to the storage engine; The insert module is used to call the storage engine to perform an insert operation and return the result to the user according to the number of inserted rows or error information.

6. The insert statement short-circuiting system based on time series database according to claim 5, characterized in that: The parsing module is used to parse the SQL statement input by the user as follows: For the input SQL statement, determine whether it starts with the keyword insert. If so, it means that the SQL statement is an insert statement, and execute the next step for subsequent parsing. If not, return to the original parsing process; Continue to execute the scan process until the value keyword is parsed. During parsing, parse according to different types of insert statements; The types of inserting into the table include direct insert, specifying columns, and whether or not to include a database name. Parsing according to different types of insert statements includes the following operations: Based on the database name and table name, determine whether the table to be inserted is a time series table, and based on the symbol after the keyword value, determine whether the user has specified the column to be inserted; If the user specifies the inserted column, the column name and inserted value parsed by the scan process are recorded in Columnsname and InsertValues ​​respectively, and the NewNumValue process is skipped; If the user does not specify the columns to be inserted, the default is to insert all columns and only extract the InsertValues ​​value.

7. The insert statement short-circuiting system based on time series database according to claim 5, characterized in that: The metadata information of a column includes the column type and column ID; When performing type conversion and length verification according to the metadata information of the column, the verification module is used to perform the following: matching the column name with the inserted column, performing type verification, null value verification, type conversion and length verification on the column value according to the column type. If failure occurs, an error is directly reported and recorded through the audit log. If all conversions can be successfully performed, the original payload splicing process is called to splice the inserted data into a long string payload according to specific rules, and the payload is sent to the corresponding storage engine.

8. The insert statement short-circuiting system based on time series database according to claim 5, characterized in that: Before performing type conversion and length verification based on the column metadata information, the verification module is used to verify the number of insertions through the following operations: When the format of the inserted value cannot divide the inserted column, return to the original process and perform the sacan and parser processes again.

Citation Information

Cited By

  • High-performance time sequence database data writing method and system

    CN120541130A