System and Method for Optimizing Execution Cost of Natural Language-Based Database Queries Using Artificial Intelligence
Patent Information
- Application Number
- KR1020250211332
- Authority / Receiving Office
- KR · KR
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2025-12-26
- Publication Date
- 2026-09-18
- Estimated Expiration
- 2045-12-26
Smart Images

Figure 112025147606915-PAT00015_ABST
Abstract
Description
Technology Field
[0001] The present invention relates to a database query processing technology using artificial intelligence, and more specifically, to a system and method for optimizing the execution cost of natural language-based database queries using artificial intelligence, wherein the execution cost of a query is evaluated and controlled in advance between an artificial intelligence agent that generates and processes natural language-based queries into database queries and a database, and the query with the optimized execution cost is selected and executed. Background Technology
[0002] With the recent advancement of artificial intelligence technology, numerous AI agents that access databases based on natural language queries are being utilized across various systems and services.
[0003] These AI agents automatically interpret user requests and generate and execute database queries, thereby promoting the automation and efficiency of data access.
[0004] However, in a structure where multiple AI agents independently access a database server to generate and execute queries, there are increasing instances where each agent requests queries without being fully aware of the database's current load status, index efficiency, and operational policies.
[0005] As a result, problems are occurring where identical or similar queries are executed repeatedly, or queries with excessive execution costs are indiscriminately sent to the database server.
[0006] In such an environment, not only are the database server's computational and I / O resources unnecessarily consumed, but problems such as increased costs associated with query execution, degraded service quality, and increased complexity in operational policies and security and audit management are also caused.
[0007] In particular, conventional technology had a limitation in that it was difficult to systematically manage the query execution of each agent due to the absence of an intermediate control layer capable of comprehensively reviewing and controlling costs at the pre-execution stage for queries generated by artificial intelligence agents.
[0008] Furthermore, since there were no realistic alternatives other than simple blocking for queries with excessive execution costs, it was difficult to maintain query processing continuity while ensuring database operational stability.
[0009] Accordingly, there is a growing need for technical means to control execution in environments where multiple AI agents coexist by pre-screening database query execution and optimizing queries based on cost and policy considerations. Prior art literature
[0010] Republic of Korea Published Patent Application No. 10-2025-0022084 (Publication Date: Feb. 14, 2025) Republic of Korea Published Patent Application No. 10-2025-0076384 (Publication Date: May 29, 2025) The problem to be solved
[0011] The objective of the present invention to solve the aforementioned problem is to provide a system and method for optimizing the execution cost of natural language-based database queries that can prevent database overload and operational instability by evaluating and screening the execution cost in advance at a pre-execution stage for natural language-based database queries generated by a plurality of artificial intelligence agents.
[0012] In addition, the objective of the present invention is to provide a technology that can efficiently reduce execution costs while maintaining service continuity by intervening a standardized interface server between an artificial intelligence agent and a database to integrally control query execution, and by generating and selecting an alternative query that maintains logical equivalence of query results for queries with excessive execution costs.
[0013] Furthermore, the objective of the present invention is to provide a natural language-based database query execution cost control technology that can be stably applied even in various operating environments and load conditions by predicting execution costs and determining dynamic thresholds that reflect database schema information, statistical information, index efficiency information, and operational performance indicators. means of solving the problem
[0014] A system for optimizing the execution cost of a natural language-based database query using artificial intelligence according to the present invention for solving the aforementioned problem comprises: an artificial intelligence agent that receives a natural language query and generates a database query statement in a system for performing a natural language-based database query; and a standardized interface server that is linked between the artificial intelligence agent and the database, manages extended metadata including schema information and operational status information of the database, evaluates the execution cost of a database query statement received from the artificial intelligence agent, and provides the evaluation result to the artificial intelligence agent, wherein the artificial intelligence agent reconstructs the query statement to reduce the execution cost while maintaining a result logically identical to the database query statement based on the execution cost evaluation result provided by the standardized interface server, and executes the query statement in the database.
[0015] In addition, in a system for optimizing the execution cost of a natural language-based database query using artificial intelligence according to the present invention, the artificial intelligence agent is characterized by reconstructing the query statement in at least one of changing the join order, transforming the query structure, or inducing the use of an index.
[0016] In addition, in the system for optimizing the execution cost of natural language-based database queries using artificial intelligence according to the present invention, the standardized interfacing interface server is characterized by managing extended metadata including statistical information of a table or column, index efficiency information, and database load information.
[0017] In addition, in the system for optimizing the execution cost of a natural language-based database query using artificial intelligence according to the present invention, the standardized interfacing interface server is characterized by evaluating the execution cost using execution plan information for the database query.
[0018] In addition, in a system for optimizing the execution cost of a natural language-based database query using artificial intelligence according to the present invention, the standardized interfacing interface server compares the execution cost calculated for the database query with a preset cost threshold, and if the execution cost exceeds the cost threshold, generates a judgment result indicating that the database query is subject to execution restriction before being directly executed, and provides this result to the artificial intelligence agent.
[0020] Furthermore, the method for optimizing the execution cost of a natural language-based database query using artificial intelligence according to the present invention for solving the aforementioned problem comprises, in a method for optimizing the execution cost of a natural language-based database query: (a) receiving a natural language query and generating a draft of the database query by an artificial intelligence agent; (b) collecting or referencing extended metadata including statistical information of a table or column, index efficiency information, and operational performance indicators of the database, along with schema information of the database; (c) predicting the execution cost for the draft of the database query using the extended metadata and determining whether the predicted execution cost exceeds a preset threshold; (d) generating one or more alternative queries that maintain a result logically identical to the draft of the database query when the execution cost exceeds the threshold; and (e) selecting the query with the lowest execution cost among the alternative queries and executing it in the database.
[0021] In addition, in the method for optimizing the execution cost of a natural language-based database query using artificial intelligence according to the present invention, the execution cost prediction in step (c) is characterized by being performed based on the execution plan information of the database query.
[0022] In addition, in the method for optimizing the execution cost of a natural language-based database query using artificial intelligence according to the present invention, the threshold of step (c) is characterized by being dynamically adjusted according to the current load state of the database or service quality standards.
[0023] In addition, in the method for optimizing the execution cost of a natural language-based database query using artificial intelligence according to the present invention, the generation of alternative query statements in step (d) is characterized by being performed according to a predefined transformation rule so as to maintain the logical equivalence of the query results.
[0025] A computer program according to the present invention for solving the above-described problem is characterized by being stored in a storage medium to execute a method for optimizing the execution cost of a natural language-based database query using the artificial intelligence described above on a computer. Effects of the invention
[0026] According to the present invention, by predicting and examining the execution cost of a database query generated by an artificial intelligence agent at a pre-execution stage, database overload and performance degradation can be prevented in advance.
[0027] In addition, according to the present invention, query execution can be centrally and integrally controlled even in an environment where multiple artificial intelligence agents access a database simultaneously, thereby improving database operational stability and management efficiency.
[0028] In addition, according to the present invention, even when the cost of executing a query exceeds a threshold, cost optimization can be achieved while maintaining service continuity by generating and selecting an alternative query instead of simply blocking.
[0029] In addition, according to the present invention, by utilizing extended metadata including statistical information of tables and columns, index efficiency information, and database load information, it is possible to predict realistic execution costs that reflect the actual operating environment.
[0030] In addition, according to the present invention, by evaluating execution costs based on execution plan information, it becomes possible to determine costs based on the actual execution path rather than the grammatical form of the query.
[0031] In addition, according to the present invention, by dynamically adjusting the threshold based on the current load status of the database or service quality standards, excessive restrictions or excessive allowances based on fixed standards can be prevented.
[0032] In addition, according to the present invention, by generating alternative query statements according to transformation rules that maintain the logical equivalence of the query results, the accuracy and reliability of the query results can be ensured while lowering execution costs.
[0033] In addition, according to the present invention, the processes of execution cost evaluation, threshold determination, and alternative query selection are implemented in a separated modular structure, thereby improving system scalability and applicability to various database environments.
[0034] In addition, according to the present invention, by providing the basis for cost judgment and decision related to query execution to the artificial intelligence agent, the explainability of the query optimization process and operational transparency are enhanced.
[0035] Consequently, the present invention enables the stable operation of natural language-based database query processing technology even in large-scale and multi-agent environments, thereby simultaneously realizing efficient utilization of database resources and reduction of operating costs. Brief explanation of the drawing
[0036] FIG. 1 is a diagram showing the block configuration of a natural language-based database query execution cost optimization system using artificial intelligence according to an embodiment of the present invention. FIG. 2 is a flowchart showing the detailed flow of a method for optimizing the execution cost of a natural language-based database query using artificial intelligence according to an embodiment of the present invention. Figure 3 is a flowchart of SQL data processing between an NL2SQL AI Agent and an MCP server by applying a method for optimizing the execution cost of a natural language-based database query using artificial intelligence according to an embodiment of the present invention. Figure 4 is a diagram illustrating the entire query processing process in an MCP agent and an MCP server to which the method for optimizing the execution cost of a natural language-based database query using artificial intelligence according to an embodiment of the present invention is applied. Specific details for implementing the invention
[0037] Before describing the present invention in detail, it should be understood that the terms and words used in this specification should not be interpreted as being limited to their ordinary or dictionary meanings, and that the inventor of the present invention may appropriately define and use the concepts of various terms to best describe their invention, and furthermore, that these terms and words should be interpreted in a meaning and concept consistent with the technical spirit of the present invention.
[0038] In other words, it should be understood that the terms used in this specification are used merely to describe preferred embodiments of the present invention and are not intended to specifically limit the content of the present invention, and that these terms are defined in consideration of various possibilities of the present invention.
[0039] In addition, it should be noted that in this specification, singular expressions may include plural expressions unless the context clearly indicates a different meaning, and that even if they are expressed in a similarly plural form, they may include the meaning of the singular.
[0040] Throughout this specification, where it is stated that a component "includes" another component, unless specifically stated otherwise, this may mean that it does not exclude any other component but may include any other component.
[0041] Furthermore, it should be noted that in cases where it is stated that a component "exists inside or is installed in connection with" another component, this component may be installed in direct connection or contact with the other component, or it may be installed at a certain distance apart, and in the case where it is installed at a certain distance apart, there may be a third component or means for fixing or connecting the component to the other component, and a description of this third component or means may be omitted.
[0042] On the other hand, if it is stated that one component is "directly connected" or "directly connected" to another component, it should be understood that there is no third component or means.
[0043] Likewise, other expressions describing the relationship between each component, such as “between” and “right between”, or “adjacent to” and “directly adjacent to”, should be interpreted as having the same intent.
[0044] In addition, it should be understood that in this specification, terms such as “one side,” “other side,” “one side,” “other side,” “first,” “second,” etc., are used to clearly distinguish one component from another component, and that the meaning of the component is not restricted by such terms.
[0045] In addition, position-related terms such as "up," "down," "left," and "right" used in this specification should be understood as indicating the relative position of the corresponding component in the drawing, and unless an absolute position is specified, these position-related terms should not be understood as referring to an absolute position.
[0046] Furthermore, in specifying the reference numerals for each component of each drawing in this specification, the same component has the same reference numeral even if it is shown in different drawings; that is, the same reference numeral throughout the specification indicates the same component.
[0047] In the drawings attached to this specification, the size, position, connection relationships, etc., of each component constituting the present invention may be described in a partially exaggerated, reduced, or omitted manner for the convenience of explanation or to sufficiently clearly convey the concept of the present invention, and therefore, the proportions or scale may not be strictly accurate.
[0048] In addition, in describing the present invention below, detailed descriptions of components, such as prior art and known technology, that are deemed to unnecessarily obscure the essence of the invention may be omitted.
[0050] Preferred embodiments of the present invention will be described in detail below with reference to the drawings.
[0051] FIG. 1 is a diagram showing the block configuration of a natural language-based database query execution cost optimization system using artificial intelligence according to an embodiment of the present invention.
[0052] The system for optimizing the execution cost of natural language-based database queries using artificial intelligence according to an embodiment of the present invention relates to a natural language-based database query processing system and aims to provide a system that solves the problem of unpredictability of query execution costs and reduced database operational stability that occurs during the process of converting natural language queries into database query statements.
[0053] Conventional natural language-based query systems primarily focused on converting natural language queries into grammatically or semantically accurate database queries, but they had limitations in that they could not determine before execution whether the generated query would cause excessive computational costs, I / O load, or service delays in an actual database environment.
[0054] Accordingly, in an embodiment of the present invention, an artificial intelligence agent (100) that processes natural language queries and a standardized interface server (200) that evaluates and reviews execution costs between the artificial intelligence agent (100) and the database prior to query execution are configured as distinct entities, thereby structurally separating the generation of queries and the determination of safety regarding query execution, and providing a pre-execution-based query cost optimization structure in which the agent reconstructs and executes the query based on the cost evaluation results of the server.
[0055] That is, the system for optimizing the execution cost of a natural language-based database query using artificial intelligence according to an embodiment of the present invention is a structural control system in which, prior to the execution of a query, a server outside the database performs a cost review, and based on the review result, an artificial intelligence agent (100) generates and executes a query with reduced execution costs while maintaining the same query result. This clearly distinguishes the technical location of operation and the controlling entity from a query optimizer or post-monitoring method inside the database.
[0057] Key terms frequently used throughout this specification may be defined as follows.
[0058] “Natural language-based query” means a query entered by a user in the form of everyday language or unstructured sentences, which may include requests for tables, columns, conditions, aggregation, or analysis of a database.
[0059] The above natural language-based query is not written directly in a database query language such as SQL, but is based on the premise that it is interpreted and converted by an artificial intelligence agent (100) and generated and processed into a database query statement.
[0060] “Artificial Intelligence Agent (100) (AI Agent)” refers to a functional entity that receives a natural language-based query, generates a database query, and determines whether to execute the query or reconstruct the query based on the execution cost evaluation result provided by a standardized interface server (200).
[0061] The artificial intelligence agent (100) above is not limited to a specific model, framework, or company implementation and includes a software or hardware configuration capable of performing natural language processing, reasoning, query generation, and judgment functions.
[0062] The term “database query” means a query expression that is executable to query, aggregate, or analyze data in a relational database or a data store equivalent thereto.
[0063] The above database query may be in SQL or an equivalent format and includes a query generated or reconstructed by an artificial intelligence agent (100) in response to a natural language-based query.
[0064] “Standardized Interworking Interface Server (200)” refers to an intermediate control entity that is connected between an artificial intelligence agent (100) and a database, evaluates the execution cost before executing a query, and provides the result to the artificial intelligence agent (100). The server does not directly execute the query and functions as an external pre-examination layer distinct from the query optimizer inside the database.
[0065] An MCP (Model Context Protocol) server can be one example of a standardized interface server (200).
[0066] “Extended metadata” means a set of metadata that includes, in addition to schema information of the database, statistical information of tables or columns, index efficiency information, operational performance indicators of the database, etc.
[0067] The above extended metadata is used to predict the execution cost of a query and as input information for threshold determination and query reconstruction.
[0068] “Execution cost” means a cost indicator including at least one of the amount of computation, I / O cost, resource occupancy, or system load level expected to be required when a database query is executed.
[0069] The above execution cost can be predicted based on extended metadata and execution plan information without actually executing the query.
[0070] “Threshold” refers to a reference value for determining whether the predicted execution cost exceeds an acceptable range. The threshold may be a fixed value, but includes a reference point that is dynamically adjusted in consideration of the current load status of the database, quality of service standards, operational policies, or data reliability.
[0071] “Alternative Query” means a database query that is restructured to reduce execution costs while returning results that are logically identical to the draft query.
[0072] Alternative queries include changing the join order, converting the query structure, adjusting index access paths, etc.
[0073] It can be generated through transformations that affect execution costs but do not affect query results.
[0074] “Logical Equivalence” means that when different queries are executed in a database, the meaning of the data returned, the aggregation results, or the analysis results are essentially identical. This presupposes that the meaning of the results provided to the user is maintained even if the format or execution path of the query changes.
[0075] “Execution Cost Optimization” refers to a series of control processes that predict and determine execution costs at a stage prior to query execution, and generate and select alternative queries when a threshold is exceeded, thereby reducing execution costs while maintaining the same query results.
[0076] “Real-time Performance Metrics” refers to indicators that reflect the current or recent state of a database and may include CPU utilization, memory usage, I / O wait status, index utilization status, etc. The above real-time performance metrics may be reflected in execution cost prediction and threshold determination.
[0078] More specifically, as shown in FIG. 1, the system for optimizing the execution cost of a natural language-based database query using artificial intelligence according to an embodiment of the present invention may be configured to include a standardized interface between an artificial intelligence agent (100) and a database.
[0079] Here, the artificial intelligence agent (100) may be configured as an artificial intelligence model agent that interprets a natural language query input by a user to generate a database query and determines whether to execute the query or reconstruct the query based on the execution cost evaluation result provided by a standardized integration interface server (200).
[0080] Additionally, the artificial intelligence agent (100) is a decision-making entity responsible for generating and judging queries, and may be functionally separated from the database itself in that it does not directly control the internal structure or execution environment of the database, but rather adjusts the query by accepting the judgment result of the server at a stage prior to query execution.
[0081] As shown in FIG. 1, the artificial intelligence agent (100) may be configured to include a natural language query interpretation module (110), a query generation module (120), and an execution judgment and query reconstruction module (140).
[0082] The natural language query parsing module (110) can analyze a natural language query input by a user and generate a structured query expression including a table, column, condition, aggregation request, etc. that is the subject of the query.
[0083] This module can convert natural language queries into intermediate representations suitable for generating database queries by using natural language processing models or semantic analysis models.
[0084] The query generation module (120) may be configured to generate a draft query that can be executed in a database based on the structured query expression. The query generated at this stage may be grammatically and semantically correct, but it may not necessarily take into account the execution cost or operational load in an actual database environment.
[0085] Additionally, the artificial intelligence agent (100) receives an execution cost evaluation result provided by a standardized interoperability interface server (200) and can determine whether to execute the query as is or reconstruct it based on the evaluation result.
[0086] In particular, if it is determined that the execution cost is excessive, the artificial intelligence agent (100) can reconstruct the query to reduce the execution cost of the query within the scope of maintaining the logical identity of the query results.
[0087] At this time, the execution judgment module (130) and the query reconstruction module (140) can reconstruct the query in at least one of the following ways: changing the join order, changing the query structure (subquery, common table expression, condition placement change, etc.), or changing the query expression to induce index usage.
[0088] Such query reconstruction may be a goal-oriented rewriting that reflects the results of the server cost evaluation, rather than random generation.
[0089] Additionally, it is preferable that the artificial intelligence agent (100) reconstructs the query in at least one of changing the join order, converting the query structure, or inducing the use of an index through the above-described query reconstruction module (140).
[0090] That is, the system for optimizing the execution cost of a natural language-based database query using artificial intelligence according to an embodiment of the present invention provides a specific query reconstruction method performed by an artificial intelligence agent (100) in response to the results of the examination, while presupposing a structure of prior cost examination by a server (standardized interoperability interface server (200)).
[0091] In other words, the embodiment of the present invention goes beyond the abstract level of simply “rebuilding if cost is high” and designates representative computational elements (joins, structures, index access paths) that determine actual execution costs as reconstruction targets, thereby allowing the reconstruction of the agent to be controlled in a direction that reduces costs from the perspective of a DB execution plan, rather than being an arbitrary generation.
[0092] The definitions of terms regarding components applied to embodiments of the present invention are as follows.
[0093] 1) “Query restructuring” means a transformation operation that changes the form, order of operations, and access path of a query to reduce the execution cost (amount of operations, I / O, memory usage, etc.) of the query while maintaining the logical meaning of the query results (same record set and same aggregation results).
[0094] 2) “Change join order” means changing the order of joins when multiple tables are combined to reduce the size of intermediate result sets or to rewrite the execution plan in a way that lowers the cost by applying conditions with high selectivity first.
[0095] 3) “Query structure transformation” means changing the query structure so that the execution plan changes while maintaining the logical expression of the query, such as flattening subqueries, transforming between Common Table Expressions (CTEs) and subqueries, moving the position of the WHERE clause (pushdown), and changing the position of aggregations.
[0096] 4) “Inducing index usage” means reconfiguration that avoids full table scans and induces selectivity-based access paths, such as converting condition clauses to be index-friendly so that the DB selects efficient indexes (e.g., removing function application), adjusting the expression of join key / filter conditions, or (depending on the implementation) providing hint expressions that promote index usage.
[0098] As shown in FIG. 1, the standardized interface server is linked between the artificial intelligence agent (100) and the database and represents a preliminary screening entity that evaluates the execution cost of a query before executing the query and provides the result to the artificial intelligence agent (100).
[0099] The above server does not directly execute the query statement, nor does it replace the query optimizer within the database, but rather performs the role of externally determining the suitability of execution at a stage prior to the execution of the query statement.
[0100] And, the standardized interoperability interface server (200) may be configured to include an extended metadata management module, an execution cost evaluation module (220), a cost threshold determination module (230), and a cost evaluation result provision module.
[0101] Here, the extended metadata management module (210) may be a configuration that collects and manages extended metadata including not only schema information of the database, but also statistical information of tables or columns, index efficiency information, and operational status information of the database.
[0102] This extended metadata is intended to reflect actual execution cost characteristics that are difficult to predict based solely on the syntax or structure of a query.
[0103] In addition, the standardized interlocking interface server (200) may not be a passive relay device that simply receives a query and calculates the cost, but may be configured to systematically manage various database state information that substantially determines the execution cost of the query.
[0104] In conventional technology, query execution costs were often determined based solely on table and column information included in the query, or by relying only on execution plans temporarily generated within the database.
[0105] In contrast, in an embodiment of the present invention, a standardized interoperability interface server (200) continuously manages extended metadata including statistical information of a table or column, index efficiency information, and database load information through an extended metadata management module (210), thereby enabling cost evaluation that reflects the actual operating environment at the time of query execution.
[0106] More specifically, the extended metadata management module operates based on the following technical principles.
[0107] 1) Management of statistical information of tables or columns: By managing statistical information such as the number of records, distribution, and selectivity, the impact of specific conditions or join operations on the size of intermediate result sets can be estimated in advance.
[0108] 2) Management of index efficiency information: By managing efficiency information that reflects not only the existence of an index but also actual usage frequency, selectivity, and recent usage history, it is possible to determine whether a query is likely to utilize an index or cause a full scan.
[0109] 3) Database load information management: By reflecting the current or recent CPU, memory, and I / O load status, the cost evaluation reflects the fact that even the same query may be acceptable depending on the time of execution.
[0110] In this way, the extended metadata management module can provide a basis for more realistically predicting query execution costs by managing static schema information and dynamic operational status information together.
[0111] Through this, the embodiment of the present invention can reflect actual execution cost characteristics that cannot be identified solely by the grammar or structure of a query, and not only can execution suitability be determined differently depending on the database load status even for the same query, but the reliability of the execution cost evaluation is also improved, allowing for more rational threshold determination and query reconstruction in subsequent steps.
[0113] The execution cost evaluation module (220) can calculate the execution cost for a database query provided by the artificial intelligence agent (100) using the extended metadata.
[0114] Execution costs may include at least one of computational volume, I / O costs, and resource occupancy, and may comprehensively reflect the impact on database operations when executing a query.
[0115] In addition, the standardized interface server (200) can evaluate the execution cost of a database query using execution plan information rather than simple static rules through the execution cost evaluation module (220).
[0116] This means that cost evaluation is performed by reflecting the execution path that the database is actually likely to select, rather than relying simply on external factors such as query length and the number of joins.
[0117] Accordingly, in the embodiment of the present invention, the execution cost evaluation module (220) clarifies that the cost evaluation is not a formal judgment but a technical judgment based on an execution plan.
[0118] More specifically, the execution cost evaluation module (220) operates according to the following principles.
[0119] 1) Use of query execution plan information: Refer to the execution plan information generated for the query to obtain information such as join method, access path, and estimated amount of computation.
[0120] 2) Combination with extended metadata: Execution plan information is interpreted in combination with extended metadata according to claim 3. For example, even if index access is scheduled in the execution plan, the actual cost may be high if the efficiency of the index is low.
[0121] 3) Calculation of comprehensive execution cost: Calculate the cost of the impact of query execution on database operations by considering at least one of computational volume, I / O cost, and potential resource occupancy.
[0122] In the system according to such an embodiment of the present invention, the execution cost evaluation through the execution cost evaluation module (220) is performed before the query is actually executed, so the suitability for execution can be determined without placing a burden on the database.
[0123] That is, according to an embodiment of the present invention, cost prediction considering the actual execution path is possible before executing a query, and not only is the accuracy of cost evaluation improved compared to simple rule-based judgment, but threshold judgment can also be performed more reliably.
[0125] And, the standardized interoperability interface server (200) can determine whether the query is suitable for execution by comparing the calculated execution cost with a preset cost threshold through the cost threshold determination module (230).
[0126] The cost threshold used in this case is not a fixed constant value, but can be set as an optimized benchmark considering risk, operational costs, and policy or regulatory compliance, and can be adjusted based on data reliability, operational context, or post-hoc feedback.
[0127] In other words, the server can evaluate execution suitability through judgment logic that considers multi-layered criteria and constraints, rather than simple comparison operations.
[0128] In this way, the standardized interoperability interface server (200) can determine whether to restrict execution by comparing the calculated execution cost with a preset cost threshold through the cost threshold determination module (230), and provide the determination result to the artificial intelligence agent (100).
[0129] Cost threshold determination enables active execution control at the pre-execution stage rather than post-execution tuning, as control over query execution is performed before the query is delivered to the database, rather than through post-execution monitoring or response after a failure occurs.
[0130] Such a cost threshold determination module (230) operates according to the following technical principles.
[0131] 1) Comparison of execution cost and cost threshold: Compare the calculated execution cost with a preset cost threshold.
[0132] 2) Nature of the cost threshold: The cost threshold may be a fixed value, but depending on the implementation, it may be set as an optimized reference point considering operational policies, risks, data reliability, etc.
[0133] 3) Generation of execution restriction judgment result: If the execution cost exceeds the cost threshold, a judgment result is generated indicating that the query is subject to execution restriction before it is directly executed.
[0134] 4) Provision of judgment result: The above judgment result is provided to the artificial intelligence agent (100) and used as a basis for the agent to decide whether to reconstruct the query or postpone execution.
[0135] In this way, the standardized interface server (200) does not directly determine whether to execute, but can induce the agent's decision-making by providing an execution restriction judgment result.
[0137] And, the standardized interworking interface server (200) can provide the execution cost evaluation result or whether the cost threshold is exceeded to the artificial intelligence agent (100) through the execution cost evaluation result provision module (240).
[0138] The information provided at this time may be a simple allow / block result, and depending on the implementation, it may include reference information or cost items that cause cost overruns.
[0139] The provision of results through the execution cost evaluation result provision module (240) can be used as a basis for judgment necessary for the artificial intelligence agent to reconstruct the query.
[0141] FIG. 2 is a flowchart showing the detailed flow of a method for optimizing the execution cost of a natural language-based database query using artificial intelligence according to an embodiment of the present invention.
[0142] The method for optimizing the execution cost of a natural language-based database query using artificial intelligence according to an embodiment of the present invention relates to a method for optimizing the execution cost of a natural language-based database query, and aims to solve the conventional problem in which a database query generated from a natural language query causes excessive execution costs in an actual operating environment, which can lead to service delays or database overload.
[0143] In particular, conventional natural language-based query processing technologies have tended to focus on the accuracy of converting natural language queries into query statements such as SQL, and have failed to clearly provide a closed-loop optimization procedure that objectively determines before execution how much cost the generated query statement entails from an execution plan perspective or whether it is acceptable under the database load conditions at the time of execution, and generates and selects alternative query statements based on the results.
[0144] Accordingly, a method for optimizing the execution cost of a natural language-based database query using artificial intelligence according to an embodiment of the present invention provides a pre-execution-based execution cost optimization method comprising a series of steps including (1) generating a draft query from a natural language query, (2) referencing extended metadata including not only schema information but also statistics, index efficiency and operational performance indicators, etc., (3) predicting and determining the execution cost of the draft query before execution, (4) generating an alternative query that maintains the same result when a threshold is exceeded, and (5) selecting and executing the query with the lowest execution cost among them.
[0145] This method goes beyond simply generating queries and combines technical judgments to control query execution (cost prediction and threshold determination) with query reconstruction to maintain result equivalence and lowest cost selection, thereby providing a method for practically effective cost optimization in an operational environment.
[0146] More specifically, as shown in FIG. 2, the method for optimizing the execution cost of a natural language-based database query using artificial intelligence according to an embodiment of the present invention may be configured to include: (a) a step of generating a draft query; (b) a step of collecting or referencing extended metadata; (c) a step of predicting execution costs and determining whether a threshold is exceeded; (d) a step of generating an alternative query; and (e) a step of selecting and executing the lowest-cost query.
[0147] Here, (a) step (S100) is a query draft generation step, which may be a step in which an artificial intelligence agent (100) generates a database query draft by receiving a natural language query from a user.
[0148] Here, “draft query” is a query in a format executable in a database, and is a primary result generated to reflect the meaning of a natural language query.
[0149] The artificial intelligence agent (100) analyzes a natural language query to structure the query intent, such as the query target (table / column), condition clause, aggregation, and sorting, and generates a query statement based on this.
[0150] However, since the draft query generated in step (a) (S100) prioritizes natural language semantic correspondence, there is no guarantee that the cost in the actual execution environment is optimal, and verification and adjustment of the cost aspect may be performed in subsequent steps.
[0152] (b) Step (S200) is an extended metadata collection or reference step, which may be a step of collecting or referencing extended metadata including statistical information of tables or columns, index efficiency information, and database operation performance indicators along with database schema information.
[0153] Here, “extended metadata” refers to a set of information intended to reflect execution characteristics (such as intermediate result size, index utilization potential, and current load status) that cannot be determined solely from the query syntax itself.
[0154] "Statistical information" provides factors that affect the size of query filter and join results, such as selectivity, distribution, and the number of records.
[0155] "Index efficiency information" contributes to access path selection and cost prediction by reflecting not only the existence of an index but also its usability or efficiency.
[0156] "Operational Performance Indicators" make cost assessment more realistic by reflecting the fact that the load can vary depending on the execution time, even for the same query.
[0157] Therefore, step (b) (S200) functions as input data for subsequent cost prediction and threshold determination, and provides a technical basis that is distinct from simple schema-based NL2SQL.
[0159] (c) Step (S300) is a step for predicting execution costs and determining whether a threshold is exceeded, which may be a step for predicting execution costs using extended metadata for a draft query and determining whether the predicted execution cost exceeds a preset threshold.
[0160] Here, “execution cost” may include cost indicators affecting database operations, such as computational load, I / O costs, and potential resource occupancy, while “threshold” refers to the criterion value determining whether to limit execution.
[0161] Execution cost prediction can be performed by evaluating the operations and access paths expected to be triggered by the query based on extended metadata.
[0162] For example, cases where a full scan is expected due to low selectivity, where intermediate results increase significantly due to the join order, or where the cost impact is amplified due to high load during specific time periods may be considered.
[0163] In addition, the “threshold” can be set as a fixed value, but depending on the implementation, it can be set as a reference point considering policies, the operating environment, and risks.
[0164] Furthermore, the aforementioned execution cost prediction is preferably performed based on the execution plan information of the database query.
[0165] In other words, the execution cost prediction step can be performed based on database query execution plan information, rather than relying on simple static rules or query shape analysis.
[0166] Accordingly, in the embodiments of the present invention, the cost prediction step may be a technical prediction process that reflects the access path, join method, and operation order that the database is likely to actually select, rather than an abstract judgment or empirical estimation.
[0167] Specifically, execution plan information may include information such as table access methods, join algorithms, estimated computational load, and intermediate result sizes, and in an embodiment of the present invention, execution costs are predicted by combining such execution plan information with extended metadata.
[0168] Accordingly, resource consumption during execution can be estimated relatively accurately without actually executing the query, which improves the reliability of cost judgment in the pre-execution stage and strengthens the validity of subsequent threshold determination and alternative query generation.
[0169] Furthermore, since the threshold applied to the embodiments of the present invention is not a fixed value but can be dynamically adjusted according to the current load status of the database or service quality standards, realism and flexibility in determining execution costs can be secured.
[0170] This technically reflects the fact that even the same query may have different acceptance criteria depending on whether the system load is low or high.
[0171] That is, the threshold according to the present invention can be adjusted according to changes in the operating environment, such as the CPU usage rate of the database, I / O waiting state, and response delay allowance criteria, and thereby the judgment of execution cost is performed by considering the operational context rather than a uniform standard.
[0172] As a result, by allowing query execution within a range that does not compromise service quality and restricting execution more conservatively under high load conditions, it is possible to achieve the effect of simultaneously maintaining database stability and service levels.
[0174] Dynamic setting and judgment logic of thresholds
[0175] The threshold applied to the embodiments of the present invention refers to a reference value for determining whether the execution cost of a database query exceeds an acceptable range.
[0176] The above threshold may be predefined as a fixed constant value, but in embodiments of the present invention, it may be dynamically set by comprehensively considering the operating environment, policy criteria, and data reliability for more sophisticated execution control.
[0177] In other words, the threshold in the present invention is not a simple comparison criterion, but functions as a reference point that balances operational risk, cost burden, and policy or regulatory compliance resulting from the execution of a query, thereby enabling a more reasonable determination of whether to restrict the execution of a query.
[0178] The following describes in detail a technical approach to setting thresholds and reference points during the design phase of the active reasoning and decision engine and the RAG rule combination formula. Additionally, layer structure, normalization, conflict resolution, optimization formulas, decision logic, data reliability, and change management procedures may be included.
[0180] benchmark Layer Determining threshold based on structure
[0181] In one embodiment, the threshold may be managed in a structure having a plurality of reference layers. For example, the reference layer may be configured as follows.
[0182] 1) Layer 1 (L1; Laws / Regulations): Absolute standards that must be strictly adhered to, such as statutes, administrative guidelines, and standard guidelines.
[0183] 2) Layer 2 (L2; Company Regulations): Internal operational policies, quality standards, or risk management standards
[0184] 3) Layer 3 (L3; Context): Contextual information at the time of query execution, such as database load status, time zone, project metadata, etc.
[0185] 4) Layer 4 (L4; Feedback): Post-execution feedback information such as past execution results, alarm history, and audit logs.
[0186] Based on the above layer structure, thresholds can be set by prioritizing the criteria of the upper layer and reflecting information from the lower layer in the form of correction coefficients or weights. This enables adaptive threshold determination for operational situations without violating legal or policy constraints.
[0188] Threshold Optimization Using Cost Functions and Constraints
[0189] In one embodiment, the threshold can be calculated as the solution to an optimization problem having a cost function and constraints.
[0190] For example, the final threshold can be an optimization output formula such as the following [Equation 1] having a cost function and a constraint.
[0192]
[0194] Here, the symbols in [Mathematical Formula 1] are as follows.
[0195] : Threshold variable. The threshold value used by the system when making a decision.
[0196] : Optimal Threshold. The optimal value that satisfies the cost function and constraints.
[0197] argmin τ : An operation to find the value that minimizes the cost function J(τ) for τ.
[0198] J(τ): Objective Function. An evaluation function that combines the differences in risk, cost, and regulatory compliance.
[0199] C(τ): Constraints. Includes legal regulations, safety, quality, and data reliability conditions.
[0200] w1, w2, w3: Weights for each element (risk, cost, regulatory compliance) in the cost function.
[0201] RiskUnder: Risk that occurs when the baseline is low (possibility of reduced safety or quality)
[0202] CostOver: Costs incurred when the threshold is high (operating expenses, time delays, etc.).
[0203] Compliance Gap: The degree of inconsistency with regulations and internal rules.
[0204] d≥d0: Data reliability condition. Reliability (d) must be greater than or equal to the minimum standard (d0).
[0206] [Mathematical Equation 1] represents the process of finding the optimal reference point (τ) by balancing risk, cost, and regulatory compliance.
[0207] In other words, since the constraint C(τ) must be satisfied, it can be seen that optimization is achieved within a range that does not violate legal regulations or safety standards.
[0208] In addition, the cost function may include, for example, the risk incurred when the threshold is excessively low, the operating costs incurred when the threshold is excessively high, and the degree of discrepancy with policies or regulations.
[0209] In addition, the above optimization process may include constraints such as data reliability conditions, and if the reliability of the data is below a preset standard, the threshold judgment may be conservatively adjusted or an additional review of the query execution may be requested.
[0210] With this configuration, the threshold functions not as a simple setting value, but as an optimal reference point that comprehensively considers risk, cost, and compliance requirements.
[0212] RAG rule normalization and conflict resolution
[0213] In one embodiment of the present invention, the query execution judgment and threshold application may be performed according to a normalized rule expression method.
[0214] The above rule can be normalized and managed in the form of a 4-tuple including a condition, an evaluation metric, a threshold (τ), and a subsequent action.
[0215] For example, it can be defined as a rule that allows query execution or generates a warning depending on whether an evaluation metric satisfies a preset threshold under specific operating conditions.
[0216] In addition, if multiple rules are applied simultaneously and a conflict occurs, a conflict resolution logic may be used that prioritizes the rule corresponding to the higher standard.
[0217] For example, rules corresponding to laws or absolute standards are applied with the highest priority, while rules corresponding to internal policies may be adjusted by applying a conservatism factor.
[0218] Furthermore, the threshold can be adjusted by reflecting contextual information at the time of query execution, and the threshold is limited to a range of preset minimum and maximum values, thereby preventing excessive relaxation or excessive reinforcement.
[0220] Examples of domain-specific design logic
[0221] 1) Construction / Safety : [Mathematical Formula 2]
[0223]
[0225] : Optimal Reference Point (Installation Rate %)
[0226] κ : Conservatism coefficient (degree of strictness of internal rules)
[0227] : Context correction factor (environmental influences such as altitude, wind speed, etc.)
[0228] 95.98 : Default standard value for regulations (L1) and internal regulations (L2)
[0230] 2) Financial / Contract : [Mathematical Formula 3]
[0232]
[0234] : Optimal Payment Period (Net X)
[0235] DR: Historical Latency
[0236] DRref : Reference Latency
[0237] CR: Counterparty Credit Rating
[0238] LQbuffer: Liquidity buffer
[0239] β1, β2, β3: Influence weights of each element
[0241] 3) Manufacturing / Quality : [Mathematical Formula 4]
[0243]
[0245] : Defect rate threshold
[0246] qmax: Maximum allowable defect rate
[0247] : Maintenance cycle
[0248] γ,η : Correction factors (time, environmental influence)
[0249] F( ), G(env): Time and environment functions
[0250] : Maximum allowable sensor deviation
[0252] 4) Healthcare : [Mathematical Formula 5]
[0254]
[0256] R: Risk Index
[0257] SI: Concomitant Administration Score
[0258] PR: Patient risk
[0259] Dose Deviation: Deviation from the standard dosage
[0260] w SI , w PR w D : Weight of each element
[0262] Active reasoning engine decision rules
[0263] In one embodiment of the present invention, the determination of whether to execute a query and the threshold may be performed according to the decision rules of an active inference engine, and the active inference engine calculates a risk or cost indicator related to query execution by comparing a fusion vector generated from a plurality of modalities including text information, visual information, and sensor information with a reference record.
[0264] The above-described indicators are applied to preset or dynamically optimized thresholds to determine alarm levels in multiple stages, and in the event of a threshold violation, explainable inference results are generated that include a supporting sentence or image corresponding to the cause of the violation, applied regulations or policy criteria, correction coefficients, and a final judgment result.
[0265] In addition, by automatically outputting alarms, reports, alternative phrases, or additional query items based on the above inference results, it can be configured so that follow-up actions for query execution are systematically carried out.
[0267] Threshold correction based on data reliability and post-hoc feedback
[0268] In one embodiment of the present invention, data reliability evaluation may be considered together to ensure the reliability of threshold determination.
[0269] The above data reliability can be calculated by comprehensively considering the data source, timeliness, and possibility of analysis errors, and if the reliability is low, the threshold judgment may be relaxed or a human review step may be added.
[0270] In addition, the weights or correction factors used to set the threshold can be updated using feedback on the results after query execution, the effects of execution restriction measures, or changes in costs or risks.
[0271] Accordingly, the threshold determination applied in one embodiment of the present invention may have a closed-loop structure that is continuously improved by reflecting operational experience.
[0272] According to the threshold setting and judgment logic described above, the method for optimizing the execution cost of a natural language-based database query using artificial intelligence according to an embodiment of the present invention provides the following effects.
[0273] 1) Database query execution can be controlled based on criteria that reflect the operational context and policies, rather than fixed criteria.
[0274] 2) By comprehensively considering risks, costs, and regulatory compliance, excessive blocking or excessive permission can be prevented.
[0275] 3) By reflecting data reliability and post-hoc feedback, the accuracy and adaptability of threshold determination are improved.
[0276] Consequently, the method for optimizing the execution cost of a natural language-based database query using artificial intelligence according to an embodiment of the present invention can provide a technical system that controls the execution cost of a natural language-based database query based on dynamic and intelligent reference points rather than static judgments.
[0278] (d) Step (S400) is an alternative query generation step, which may be a step of generating one or more alternative queries that maintain a result logically identical to the query draft when the execution cost exceeds a threshold.
[0279] Here, “logically identical results” means that the record sets or aggregate results returned from the database are essentially identical, and it presupposes a reconstruction that maintains semantic and result equivalence, rather than queries that differ merely in format.
[0280] Alternative queries can be generated to lower execution costs by, for example, changing the join order, transforming the query structure (adjusting subqueries / CTEs / condition placement, etc.), or modifying expressions to induce index usage.
[0281] This step (d) (S400) is not limited to simple regeneration (LLM retry) but may be a goal-oriented query reconstruction step that takes the result of the cost overrun as input.
[0282] And, the generation of alternative queries in step (d) (S400) may be performed according to predefined transformation rules so that the logical equivalence of the query results is maintained.
[0283] That is, the alternative query generation step of step (d) (S400) may be performed according to a predefined transformation rule so as to maintain the logical equivalence of the query results, rather than by random rewriting or simple retries.
[0284] Through this, it can be clearly seen that the query reconstruction in the embodiment of the present invention is not an arbitrary generation, but a controlled technical transformation based on result reliability.
[0285] Here, transformation rules may include transformations that affect execution costs but do not affect query results, such as changing join order, transforming query structure, or changing index access paths, and alternative queries are generated according to these rules.
[0286] As a result, the embodiment of the present invention can lower execution costs while maintaining the accuracy of query results, and can provide a technical effect of achieving cost optimization without compromising the reliability of data provided to users.
[0288] (e) Step (S500) is a minimum cost query selection and execution step, which may be a step of selecting the query with the lowest execution cost among the generated alternative queries and executing it in the database.
[0289] For each alternative query, the execution cost can be calculated according to a cost estimation procedure (e.g., an evaluation identical to or equivalent to Step (c) (S300), and the lowest cost query is selected by comparing the results.
[0290] Accordingly, the most efficient query in the operating environment can be executed while maintaining the same results.
[0291] That is, step (e) (S500) does not end with “alternative generation” but may be a step that completes an optimization closed loop connecting to execution by comparing and selecting candidates.
[0293] FIG. 3 illustrates a flowchart of SQL data processing between an NL2SQL AI Agent and an MCP server by applying a method for optimizing the execution cost of a natural language-based database query using artificial intelligence according to an embodiment of the present invention.
[0294] As shown in FIG. 3, a method for optimizing the execution cost of a natural language-based database query using artificial intelligence according to an embodiment of the present invention has a data processing flow that is shared between an artificial intelligence agent (100) (NL2SQL AI Agent) and a standardized interface server (200) (e.g., MCP Server). First, the artificial intelligence agent (100) receives a natural language query from a user and interprets it to generate a draft of a database query statement (SQL) (steps 1 and 2).
[0295] The generated SQL draft is transmitted to the server, and the server calculates the estimated execution cost of the SQL draft by referring to extended metadata containing schema information and operational status information of the database, performs a preliminary review, and then returns the review result to the artificial intelligence agent (100) (step 3).
[0296] Afterward, the server determines whether the calculated cost exceeds a preset threshold through a branch (step 4), and if it is below the threshold, returns a result indicating that the query is executable, and the artificial intelligence agent (100) can proceed to a subsequent step.
[0297] Meanwhile, if it is determined in step 4 that the cost exceeds a threshold (Yes), the artificial intelligence agent (100) generates alternative SQL candidate sets within the scope of maintaining logical equivalence of the query results (step 5).
[0298] The generated alternative candidate group is transmitted to the server, and the server calculates the estimated cost per candidate for each alternative candidate and provides it to the artificial intelligence agent (100) (step 6).
[0299] The artificial intelligence agent (100) compares the provided candidate cost information to finally select the alternative SQL corresponding to the lowest cost (step 7), confirms the selected optimization query, and then executes the query in the database to obtain and interpret the result, thereby terminating the processing (step 8).
[0300] Through this flow, the embodiment of the present invention evaluates and screens costs prior to query execution, and when a threshold is exceeded, generates alternative candidates and compares costs for each candidate to select and execute the lowest-cost query, thereby achieving execution cost optimization that maintains the accuracy of query results while ensuring database operational stability.
[0302] FIG. 4 is a diagram illustrating the entire query processing process in an MCP agent (artificial intelligence agent (100)) and an MCP server (standardized interfacing interface server (200)) to which the method for optimizing the execution cost of a natural language-based database query using artificial intelligence according to an embodiment of the present invention is applied.
[0303] As illustrated in FIG. 4, the method for optimizing the execution cost of a natural language-based database query using artificial intelligence according to one embodiment of the present invention includes an entire process in which a query is processed by mutual interaction between an MCP agent (artificial intelligence agent (100)) and an MCP server (standardized interfacing interface server (200)).
[0304] First, an MCP agent, such as an LN2SQL AI agent, receives a natural language query from a user and generates a draft database query (SQL) based on extended metadata (S110).
[0305] Next, the MCP agent requests and receives real-time performance indicators, including the current load status of the database and index efficiency, from the MCP server to determine the suitability of executing the query (S130).
[0306] Using the real-time performance indicators and extended metadata received in this way, the estimated execution cost of the query draft is calculated, and it is determined whether the cost exceeds a preset threshold (S310).
[0307] Meanwhile, if the estimated execution cost in S310 is below the threshold (No), the MCP agent finalizes the SQL draft into an optimized query, executes it in the database to obtain and interpret the results, and then proceeds to the step of providing the results to the user (S430, S510).
[0308] Conversely, if the estimated execution cost exceeds a threshold (Yes), the MCP agent searches for alternative paths within the scope of maintaining logical equivalence of the query results to generate alternative SQL candidate sets, and the MCP server calculates and provides the estimated cost for each candidate, thereby enabling the MCP agent to select and confirm the query corresponding to the lowest cost (S410).
[0309] Afterward, the selected optimization query is executed in the database, and the execution result is interpreted and provided to the user, thereby terminating the process (S510).
[0310] Through this, the system and method for optimizing the execution cost of natural language-based database queries using artificial intelligence according to an embodiment of the present invention can efficiently optimize the performance of natural language query processing while ensuring database operational stability by performing cost prediction and threshold determination reflecting real-time performance indicators before query execution, and selecting and executing the lowest-cost query through alternative candidate comparison when the threshold is exceeded.
[0312] In addition, another embodiment of the present invention may feature a computer program stored on a storage medium to execute a method for optimizing the execution cost of a natural language-based database query using artificial intelligence on a computer.
[0313] In addition, the program applied to the method for optimizing the execution cost of a natural language-based database query using artificial intelligence according to one embodiment of the present invention may be implemented as computer-readable code on a computer-readable recording medium. The codes and code segments implementing the above program can be easily inferred by a computer programmer in the field.
[0314] Here, a computer-readable recording medium may include any type of recording device in which data that can be read by a computer system is stored. Examples of computer-readable recording media may include ROM, RAM, CD-ROM, magnetic tape, floppy disk, optical disk, etc. Additionally, computer-readable recording media may be distributed across networked computer systems and may be written and executed as computer-readable code in a distributed manner.
[0316] Although various preferred embodiments of the present invention have been described above with some examples, the descriptions of various embodiments described in the "Specific details for carrying out the invention" section are merely illustrative, and those skilled in the art to which the present invention pertains will understand that the present invention can be modified in various ways or equivalent embodiments can be carried out based on the above description.
[0317] In addition, since the present invention can be implemented in various other forms, the present invention is not limited by the description above. The above description is provided merely to make the disclosure of the present invention complete and to fully inform those skilled in the art of the scope of the present invention, and it should be understood that the present invention is defined only by each claim of the claims. Explanation of the symbols
[0318] 100 : Artificial Intelligence Agent 110 : Natural Language Query Interpretation Module 120 : Query generation module 130 : Execution judgment module 140 : Query Reconstruction Module 200: Standardized Interconnection Interface Server 210 : Extended Metadata Management Module 220 : Execution Cost Evaluation Module 230 : Cost Threshold Determination Module 240 : Cost evaluation result provision module
Claims
Claim 1 In a system for performing natural language-based database queries, an artificial intelligence agent that receives a natural language query as input and generates a database query statement; A system for optimizing the execution cost of natural language-based database queries using artificial intelligence, comprising: a standardized interface server that is linked between the artificial intelligence agent and the database, manages extended metadata including schema information and operational status information of the database, evaluates the execution cost of a database query received from the artificial intelligence agent, and provides the evaluation result to the artificial intelligence agent; wherein the artificial intelligence agent reconstructs the query to reduce the execution cost while maintaining a logically identical result to the database query based on the execution cost evaluation result provided by the standardized interface server and executes it in the database; wherein the standardized interface server manages extended metadata including statistical information of a table or column, index efficiency information, and database load information, evaluates the execution cost using execution plan information for the database query, compares the execution cost calculated for the database query with a preset cost threshold, and, if the execution cost exceeds the cost threshold, generates a judgment result indicating that the database query is subject to execution restriction before being directly executed and provides it to the artificial intelligence agent. Claim 2 A system for optimizing the execution cost of natural language-based database queries using artificial intelligence, wherein, in claim 1, the artificial intelligence agent reconstructs the query statement in at least one of changing the join order, transforming the query structure, or inducing the use of an index. Claim 3 delete Claim 4 delete Claim 5 delete Claim 6 A method for optimizing the execution cost of a natural language-based database query comprises: (a) receiving a natural language query and generating a draft of the database query by an artificial intelligence agent; (b) collecting or referencing extended metadata including statistical information of tables or columns, index efficiency information, and operational performance indicators of the database, along with schema information of the database; (c) predicting the execution cost for the draft of the database query using the extended metadata and determining whether the predicted execution cost exceeds a preset threshold; (d) if the execution cost exceeds the threshold, generating one or more alternative queries that maintain a result logically identical to the draft of the database query. and (e) a step of selecting the query with the lowest execution cost among the alternative queries and executing it in a database, wherein step (c) includes a step of predicting the execution cost using the extended metadata for the draft database query using execution plan information, comparing the predicted execution cost with a preset cost threshold, and determining that the database query is subject to execution restriction if the execution cost exceeds the cost threshold. A method for optimizing the execution cost of a natural language-based database query using artificial intelligence. Claim 7 delete Claim 8 A method for optimizing the execution cost of a natural language-based database query using artificial intelligence, wherein, in claim 6, the threshold of step (c) is dynamically adjusted according to the current load state of the database or service quality standards. Claim 9 A method for optimizing the execution cost of a natural language-based database query using artificial intelligence, wherein, in claim 6, the generation of alternative queries in step (d) is performed according to predefined transformation rules so as to maintain the logical equivalence of the query results. Claim 10 A computer program characterized by being stored on a storage medium to execute a method for optimizing the execution cost of a natural language-based database query using artificial intelligence according to any one of claims 6, 8, and 9 on a computer.
Citation Information
Patent Citations
Natural language to structured query generation via paraphrasing
US20200257679A1
System, method, and computer program product for progressive query processing
US7383246B2
Hybrid query execution plan generation and cost model evaluation
US8356027B2
