Storage function call optimization method and device, equipment and storage medium

By performing static data existence verification and pointer association on the global cache of the target database, the problems of low caching efficiency and large memory consumption under the traditional session-level caching mechanism are solved, and efficient storage function calls and memory resource optimization are achieved.

CN120950153APending Publication Date: 2025-11-14JINZHUAN INFORMATION TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511180642.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-22
Publication Date
2025-11-14

AI Technical Summary

Technical Problem

Traditional session-level PL/SQL caching mechanisms exhibit low caching efficiency and excessive memory consumption in high-concurrency environments, and cannot effectively share cached data.

Method used

By performing a static data existence check on the global cache of the target database, if no static data exists, the static code data of the candidate stored function is stored in the global cache, and the static code data and the dynamic storage array are associated through pointers. The function call instruction is then executed and the dynamic data is stored.

Benefits of technology

It improves the efficiency of stored function calls, reduces memory resource consumption, and enables the sharing of static data and the separate management of dynamic data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120950153A_ABST
    Figure CN120950153A_ABST
Patent Text Reader

Abstract

The invention discloses a storage function call optimization method and device, equipment and a storage medium. The method comprises the following steps: in response to a function call instruction of a candidate storage function in a target database, performing static data existence verification on a current global cache of the target database according to a current cache key of the target database to obtain an existence verification result; if the existence verification result is that the static data does not exist, determining code static data of the candidate storage function according to a candidate function code of the candidate storage function, and storing the code static data into the current global cache; determining a dynamic storage array of the candidate storage function according to the code static data, and associating the code static data with the dynamic storage array through a pointer; and executing the function call instruction according to the code static data, and storing dynamic data generated by the function call instruction in the call process into the dynamic storage array. According to the scheme, the storage function calling efficiency is improved, and the memory resource consumption is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and more particularly to the field of database technology, specifically to a method, apparatus, device, and storage medium for optimizing stored function calls. Background Technology

[0002] In modern database management systems, caching mechanisms for Procedural Language / Structured Query Language (PL / SQL) are typically session-level; this means that each database connection has its own PL / SQL cache, storing compiled PL / SQL code and related execution plans.

[0003] As database applications continue to expand in scale, the demand for high concurrency and large data volume processing is increasing. Traditional session-level PL / SQL caching mechanisms exhibit significant limitations in high-concurrency environments, including low caching efficiency, excessive memory consumption, and the inability to effectively share cached data between different sessions. Summary of the Invention

[0004] This application provides a method, apparatus, device, and storage medium for optimizing stored function calls, so as to improve the efficiency of stored function calls and reduce memory resource consumption.

[0005] According to one aspect of this application, a method for optimizing stored function calls is provided, the method comprising:

[0006] In response to a function call instruction for a candidate stored function in the target database, a static data existence check is performed on the current global cache of the target database based on the current cache key of the target database, and the existence check result is obtained.

[0007] If the existence check result is that no static data exists, then the code static data of the candidate storage function is determined according to the candidate function code of the candidate storage function, and the code static data is stored in the current global cache;

[0008] Based on the static code data, the dynamic storage array of the candidate storage functions is determined, and the static code data and the dynamic storage array are associated through pointers;

[0009] Based on the static code data, the function call instruction is executed, and the dynamic data generated during the function call instruction is stored in the dynamic storage array.

[0010] According to another aspect of this application, a stored function call optimization apparatus is provided, the apparatus comprising:

[0011] The static data verification module is used to respond to the function call instruction of the candidate stored function in the target database, and perform static data existence verification on the current global cache of the target database according to the current cache key of the target database to obtain the existence verification result.

[0012] The static data determination module is used to determine the code static data of the candidate storage function based on the candidate function code of the candidate storage function if the existence check result is that no static data exists, and store the code static data in the current global cache.

[0013] The storage array determination module is used to determine the dynamic storage array of the candidate storage function based on the static code data, and associate the static code data and the dynamic storage array through pointers;

[0014] The instruction execution module is used to execute the function call instruction based on the static code data, and to store the dynamic data generated by the function call instruction during the call process into the dynamic storage array.

[0015] According to another aspect of this application, an electronic device is provided, the electronic device comprising:

[0016] One or more processors;

[0017] Memory, used to store one or more programs;

[0018] When the one or more programs are executed by the one or more processors, the one or more processors implement any of the stored function call optimization methods provided in the embodiments of this application.

[0019] According to another aspect of this application, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements any of the stored function call optimization methods provided in the embodiments of this application.

[0020] According to another aspect of this application, a computer program product is provided, including a computer program that, when executed by a processor, implements any of the stored function call optimization methods provided in the embodiments of this application.

[0021] This application, in response to a function call instruction for a candidate stored function in the target database, performs a static data existence check on the current global cache of the target database based on the current cache key, obtaining the existence check result. If the existence check result indicates that no static data exists, the static code data of the candidate stored function is determined based on the candidate function code and stored in the current global cache. Based on the static code data, the dynamic storage array of the candidate stored function is determined, and a pointer is used to associate the static code data and the dynamic storage array. Based on the static code data, the function call instruction is executed, and the dynamic data generated during the function call is stored in the dynamic storage array. This technical solution, through optimization of static data sharing and dynamic data separation management, helps improve the efficiency of stored function calls and reduce memory resource consumption. Attached Figure Description

[0022] Figure 1 This is a flowchart of a stored function call optimization method provided according to Embodiment 1 of this application;

[0023] Figure 2 This is a flowchart of a stored function call optimization method provided according to Embodiment 2 of this application;

[0024] Figure 3 This is a schematic diagram of a stored function call optimization device according to Embodiment 3 of this application;

[0025] Figure 4 This is a schematic diagram of the structure of an electronic device that implements the stored function call optimization method of Embodiment 4 of this application. Detailed Implementation

[0026] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0027] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0028] Furthermore, it should be noted that the collection, storage, use, processing, transmission, provision, and disclosure of candidate storage functions and current cache keys and other related data involved in the technical solution of this application all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0029] Example 1

[0030] Figure 1 This is a flowchart of a stored function call optimization method according to Embodiment 1 of this application. This embodiment is applicable to the situation of optimizing the execution process of stored functions in a database. It can be executed by a stored function call optimization device, which can be implemented in hardware and / or software. The stored function call optimization device can be configured in a computer device, such as a server.

[0031] like Figure 1 As shown, the method includes:

[0032] S110. In response to the function call instruction of the candidate stored function in the target database, perform static data existence verification on the current global cache of the target database according to the current cache key of the target database, and obtain the existence verification result.

[0033] In this embodiment, the target database refers to the database that needs to be processed. Candidate stored functions are functions built into the database for caching; these can be PL / SQL functions, package functions, etc. Function call instructions are used to call a stored procedure or stored function and perform related operations; these instructions can come from the application or user input. The current cache key is an identifier used to identify and locate cached data in the database caching system. The current global cache refers to the memory area in the target database used for storing and quickly accessing data; it contains data and cache information across the entire database. It should be noted that the current global cache can be managed using an optimistic locking mechanism to ensure data consistency during concurrent access across multiple sessions. Static data existence verification verifies whether static data exists in the current global cache. The existence verification result characterizes whether static data exists in the current global cache; static data refers to data that does not change during program execution; this type of data is usually already loaded into memory and ready for processing. Unlike dynamic data (which changes at runtime), static data is not modified during code execution.

[0034] In an alternative implementation, in response to a function call instruction from a stored procedure in the target database, a static data existence check can be performed on the current global cache of the target database based on the current cache key of the target database to obtain the existence check result.

[0035] In this embodiment, a stored procedure is a named program unit that encapsulates SQL statements and PL / SQL code, and it is typically used to perform a series of database operations.

[0036] S120. If the existence check result is that there is no static data, then the code static data of the candidate stored function is determined according to the candidate function code of the candidate stored function, and the code static data is stored in the current global cache.

[0037] In this embodiment, candidate function code refers to a set of code snippets or function implementations that may be selected. Static code data refers to the static data stored in a function or program. It is usually certain fixed or unchanged parts of the function and can include static data such as instruction information, execution plan, variables, and parameter information used for execution.

[0038] For example, when a PL / SQL function, package function, or stored procedure is called, the global cache is checked for the existence of the corresponding compiled static data based on the cache key. If not found, the compilation process is triggered to convert the PL / SQL code into an optimized execution plan and generate the compilation result, i.e., the code static data, including instruction information, execution plan, variables, parameter information, and other static data used for execution.

[0039] S130. Based on the static code data, determine the dynamic storage array of the candidate stored functions, and associate the static code data and the dynamic storage array through pointers.

[0040] In this embodiment, a dynamic storage array refers to a data structure that can be dynamically allocated and resized during program execution. Unlike static data, dynamic data changes as the program executes and may be stored according to runtime conditions. Dynamic data is data that changes during program execution; it is the opposite of static data, which remains unchanged during program execution, while dynamic data changes based on different operations or calculations. A pointer is a data type that stores the memory address of a variable; in database operations, pointers are typically used to reference specific memory regions or data structures, allowing multiple parts to share and access the same data.

[0041] Understandably, by associating static data and dynamic storage arrays with pointers, dynamic data can be associated with static data during execution without the need for copying.

[0042] S140. Based on the static data of the code, execute the function call instruction and store the dynamic data generated during the function call instruction into the dynamic storage array.

[0043] For example, storing the dynamic data generated during the function call instruction into a dynamic storage array can be done by saving the corresponding dynamic data generated during execution, such as variable values, parameter values, and cursor positions, according to the number in the static code data.

[0044] This application embodiment, in response to a function call instruction for a candidate stored function in the target database, performs a static data existence check on the current global cache of the target database based on the current cache key, obtaining an existence check result. If the existence check result indicates that no static data exists, the static code data of the candidate stored function is determined based on the candidate function code, and this static code data is stored in the current global cache. Based on the static code data, the dynamic storage array of the candidate stored function is determined, and a pointer is used to associate the static code data and the dynamic storage array. Based on the static code data, the function call instruction is executed, and the dynamic data generated during the function call is stored in the dynamic storage array. This technical solution, through optimization of static data sharing and dynamic data separation management, helps improve the efficiency of stored function calls and reduce memory resource consumption.

[0045] Example 2

[0046] Figure 2This is a flowchart of a stored function call optimization method according to Embodiment 2 of this application. Based on the technical solutions of the above embodiments, this embodiment refines "determining the static code data of the candidate stored function based on the candidate function code of the candidate stored function" into "performing syntax parsing and optimization on the candidate function code of the candidate stored function to obtain an abstract syntax tree of the candidate function code; wherein, the abstract syntax tree refers to a tree-like representation used to characterize the code structure of the candidate function code; performing query optimization on the candidate function code based on the abstract syntax tree, determining the target execution strategy from the candidate execution strategies of the candidate function code; and determining the static code data of the candidate stored function based on the candidate function code and the target execution strategy." It should be noted that for parts not detailed in this embodiment, please refer to the relevant descriptions in other embodiments. Figure 2 As shown, the method includes:

[0047] S210. In response to the function call instruction of the candidate stored function in the target database, perform static data existence verification on the current global cache of the target database according to the current cache key of the target database, and obtain the existence verification result.

[0048] S220. If the existence check result is that there is no static data, then the candidate function code of the candidate storage function is parsed and optimized to obtain the abstract syntax tree of the candidate function code.

[0049] In this embodiment, an abstract syntax tree refers to a tree-like representation of the code structure used to characterize the code of candidate functions; each node in the tree represents a language construct in the code (such as an operator, variable, statement, etc.), and the edges of the tree represent the relationships between these constructs.

[0050] S230. Based on the abstract syntax tree, perform query optimization on the candidate function code, and determine the target execution strategy from the candidate execution strategies of the candidate function code.

[0051] In this embodiment, query optimization refers to the process of improving query efficiency by selecting the best execution strategy (or execution plan) during database query processing. Execution strategy refers to the specific execution path or execution plan chosen by the database when executing a query; execution strategies typically include selecting appropriate algorithms, indexes, access paths, etc., with the aim of making query execution more efficient; candidate execution strategies refer to executable paths or plans in candidate function code; the target execution strategy refers to the selected optimal path or plan.

[0052] S240. Based on the candidate function code and the target execution strategy, determine the static code data of the candidate stored functions and store the static code data in the current global cache.

[0053] Optionally, based on the candidate function code and the target execution strategy, at least one candidate dynamic change data of the candidate function code is determined, wherein the candidate dynamic change data refers to the parameters or variables that the candidate function code will dynamically calculate and change during execution; the at least one candidate dynamic change data is numbered to obtain the target dynamic change data, and the target dynamic change data and the target execution strategy are summarized to obtain the static code data of the candidate stored function.

[0054] In this embodiment, candidate dynamic change data refers to parameters or variables that dynamically change during the execution of candidate function code due to factors such as execution steps, input parameters, and external conditions. These data may have different values ​​each time they are executed, therefore requiring dynamic calculation and updating during execution. Numbering refers to identifying the candidate dynamic change data so that it can be clearly referenced and tracked in subsequent processing; assigning a unique number to each dynamic change data simplifies data management, analysis, and operation. Target dynamic change data consists of the numbered candidate dynamic change data; these are the final dynamic data determined and used for execution. This data has been identified and organized, and is ready for dynamic calculation during actual execution. Summarizing refers to combining the target dynamic change data and the target execution strategy to form a complete execution framework, ultimately yielding the static code data of the candidate stored functions.

[0055] For example, the variables, parameters, etc. that will change during the execution of the candidate function code are identified and assigned unique numbers to them to obtain target dynamic change data. The target execution strategy and target change dynamic data are summarized and saved in a global variable for management and shared by all sessions.

[0056] S250. Based on the static data of the code, determine the dynamic storage array of the candidate stored functions, and associate the static data of the code and the dynamic storage array through pointers.

[0057] Optionally, the execution context data of the candidate stored functions is determined based on the target execution strategy in the static code data; and the dynamic storage array of the candidate stored functions is determined based on the execution context data.

[0058] In this embodiment, context data refers to the collection of various dynamic and static information that affects the behavior of a candidate stored function during its execution. This data may include the current user's permissions, the current database status, hardware resource information, temporary calculation results, etc. Execution context data refers to the environment and parameters that the candidate stored function depends on during its execution.

[0059] S260. Based on the static data of the code, execute the function call instruction and store the dynamic data generated during the function call instruction into the dynamic storage array.

[0060] In one alternative implementation, if nested calling processes exist during the execution of a function call instruction, the data in the dynamic storage array is passed to the nested calling processes using the pass-by-reference method.

[0061] In this embodiment, nested call processes refer to a situation where one function call occurs during the execution of another function; that is, a function may call other functions during its execution, and this call structure is usually recursive or multi-level nested. Pass-by-reference refers to a mechanism for passing function parameters, where the function receives the memory address of the parameter instead of its value; in this way, the function can directly modify the original data instead of returning a new copy.

[0062] This application embodiment, in response to a function call instruction for a candidate stored function in the target database, performs a static data existence check on the current global cache of the target database based on the current cache key, obtaining an existence check result. If the existence check result indicates that no static data exists, the candidate function code of the candidate stored function is parsed and optimized to obtain an abstract syntax tree of the candidate function code. Here, the abstract syntax tree refers to a tree-like representation of the code structure used to characterize the candidate function code. Based on the abstract syntax tree, the candidate function code is query-optimized, and a target execution strategy is determined from the candidate execution strategies of the candidate function code. Based on the candidate function code and the target execution strategy, the static data of the candidate stored function code is determined and stored in the current global cache. Based on the static data, the dynamic storage array of the candidate stored function is determined, and pointers are used to associate the static data and the dynamic storage array. Based on the static data, the function call instruction is executed, and the dynamic data generated during the function call is stored in the dynamic storage array. This technical solution, through the optimization of static data sharing and dynamic data separation management, helps to improve the efficiency of stored function calls and reduce memory resource consumption.

[0063] Example 3

[0064] Figure 3 This is a schematic diagram of a stored function call optimization device according to Embodiment 3 of this application. It is applicable to optimizing the execution process of stored functions in a database. This stored function call optimization device can be implemented in hardware and / or software and can be configured in a computer device, such as a server. Figure 3 As shown, the device includes:

[0065] The static data verification module 310 is used to respond to the function call instruction of the candidate stored function in the target database, and perform static data existence verification on the current global cache of the target database according to the current cache key of the target database to obtain the existence verification result.

[0066] The static data determination module 320 is used to determine the code static data of the candidate storage function based on the candidate function code of the candidate storage function if the existence check result is that there is no static data, and store the code static data in the current global cache.

[0067] The storage array determination module 330 is used to determine the dynamic storage array of candidate storage functions based on the static data of the code, and associate the static data of the code and the dynamic storage array through pointers;

[0068] The instruction execution module 340 is used to execute function call instructions based on static code data, and to store the dynamic data generated during the function call process into a dynamic storage array.

[0069] This application embodiment, in response to a function call instruction for a candidate stored function in the target database, performs a static data existence check on the current global cache of the target database based on the current cache key, obtaining an existence check result. If the existence check result indicates that no static data exists, the static code data of the candidate stored function is determined based on the candidate function code, and this static code data is stored in the current global cache. Based on the static code data, the dynamic storage array of the candidate stored function is determined, and a pointer is used to associate the static code data and the dynamic storage array. Based on the static code data, the function call instruction is executed, and the dynamic data generated during the function call is stored in the dynamic storage array. This technical solution, through optimization of static data sharing and dynamic data separation management, helps improve the efficiency of stored function calls and reduce memory resource consumption.

[0070] Optionally, the static data determination module 320 includes:

[0071] The syntax parsing unit is used to perform syntax parsing and optimization on the candidate function code of the candidate stored functions to obtain an abstract syntax tree of the candidate function code; whereby the abstract syntax tree is a tree-like representation of the code structure used to characterize the candidate function code.

[0072] The query optimization unit is used to perform query optimization on candidate function code based on the abstract syntax tree, and determine the target execution strategy from the candidate execution strategies of the candidate function code;

[0073] The data determination unit is used to determine the static code data of candidate stored functions based on the candidate function code and the target execution strategy.

[0074] Optional, data determination unit, specifically used for:

[0075] Based on the candidate function code and the target execution strategy, at least one candidate dynamic change data of the candidate function code is determined, wherein the candidate dynamic change data refers to the parameters or variables that the candidate function code dynamically calculates and changes during execution;

[0076] Number at least one candidate dynamic change data to obtain the target dynamic change data, and summarize the target dynamic change data and the target execution strategy to obtain the static code data of the candidate stored function.

[0077] Optionally, the storage array determination module 330 is specifically used for:

[0078] Based on the target execution strategy in the static code data, determine the execution context data of the candidate stored functions;

[0079] The dynamic storage array of candidate stored functions is determined based on the execution context data.

[0080] Optionally, the instruction execution module 340 is also used for:

[0081] If nested calling processes exist during the execution of a function call instruction, the data in the dynamically stored array is passed to the nested calling processes using the pass-by-reference method.

[0082] The stored function call optimization apparatus provided in this application embodiment can execute the stored function call optimization method provided in any embodiment of this application, and has the corresponding functional modules and beneficial effects for executing each stored function call optimization method.

[0083] According to embodiments of this application, this application also provides an electronic device, a readable storage medium, and a computer program product.

[0084] Example 4

[0085] Figure 4 This is a schematic diagram of the structure of an electronic device 410 implementing the stored function call optimization method of the embodiments of this application. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or claimed herein.

[0086] like Figure 4 As shown, the electronic device 410 includes at least one processor 411 and a memory, such as a read-only memory (ROM) 412 or a random access memory (RAM) 413, communicatively connected to the at least one processor 411. The memory stores computer programs executable by the at least one processor. The processor 411 can perform various appropriate actions and processes based on the computer program stored in the ROM 412 or loaded from storage unit 418 into the RAM 413. The RAM 413 may also store various programs and data required for the operation of the electronic device 410. The processor 411, ROM 412, and RAM 413 are interconnected via a bus 414. An input / output (I / O) interface 415 is also connected to the bus 414.

[0087] Multiple components in electronic device 410 are connected to I / O interface 415, including: input unit 416, such as keyboard, mouse, etc.; output unit 417, such as various types of displays, speakers, etc.; storage unit 418, such as disk, optical disk, etc.; and communication unit 419, such as network card, modem, wireless transceiver, etc. Communication unit 419 allows electronic device 410 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0088] Processor 411 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 411 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 411 performs the various methods and processes described above, such as stored function call optimization methods.

[0089] In some embodiments, the store-function call optimization method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 418. In some embodiments, part or all of the computer program may be loaded and / or mounted on electronic device 410 via ROM 412 and / or communication unit 419. When the computer program is loaded into RAM 413 and executed by processor 411, one or more steps of the store-function call optimization method described above may be performed. Alternatively, in other embodiments, processor 411 may be configured as the store-function call optimization method by any other suitable means (e.g., by means of firmware).

[0090] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0091] Computer programs used to implement the methods of this application may be written in any combination of one or more programming languages. These computer programs may be provided to the processor of a general-purpose computer, a special-purpose computer, or other programmable stored function call optimization device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0092] In the context of this application, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0093] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0094] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0095] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0096] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this application can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this application can be achieved, and this is not limited herein.

[0097] The specific embodiments described above do not constitute a limitation on the scope of protection of this application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the scope of protection of this application.

Claims

1. A method for optimizing stored function calls, characterized in that, include: In response to a function call instruction from a candidate stored function in the target database, a static data existence check is performed on the current global cache of the target database based on the current cache key of the target database, and the existence check result is obtained. If the existence check result is that no static data exists, then the code static data of the candidate storage function is determined according to the candidate function code of the candidate storage function, and the code static data is stored in the current global cache; Based on the static code data, the dynamic storage array of the candidate storage functions is determined, and the static code data and the dynamic storage array are associated through pointers; Based on the static code data, the function call instruction is executed, and the dynamic data generated during the function call instruction is stored in the dynamic storage array.

2. The method according to claim 1, characterized in that, Based on the candidate function codes of the candidate stored functions, the static code data of the candidate stored functions is determined, including: The candidate function code of the candidate storage function is parsed and optimized to obtain an abstract syntax tree of the candidate function code; wherein, the abstract syntax tree refers to a tree-shaped representation of the code structure used to characterize the candidate function code; Based on the abstract syntax tree, the candidate function code is queried and optimized, and the target execution strategy is determined from the candidate execution strategies of the candidate function code; Based on the candidate function code and the target execution strategy, determine the static code data of the candidate stored function.

3. The method according to claim 2, characterized in that, The step of determining the static code data of the candidate stored function based on the candidate function code and the target execution strategy includes: Based on the candidate function code and the target execution strategy, at least one candidate dynamic change data of the candidate function code is determined, wherein the candidate dynamic change data refers to the parameters or variables that the candidate function code dynamically calculates and changes during execution; The at least one candidate dynamic change data is numbered to obtain the target dynamic change data, and the target dynamic change data and the target execution strategy are summarized to obtain the static code data of the candidate stored function.

4. The method according to claim 1, characterized in that, Based on the static code data, the dynamic storage array of the candidate stored functions is determined, including: Based on the target execution strategy in the static code data, determine the execution context data of the candidate stored functions; The dynamic storage array of the candidate storage functions is determined based on the execution context data.

5. The method according to claim 1, characterized in that, The step of executing the function call instruction based on the static code data, and storing the dynamic data generated during the function call instruction into the dynamic storage array, includes: If nested calling processes exist during the execution of the function call instruction, the data in the dynamic storage array is passed to the nested calling processes using the pass-by-reference method.

6. A storage function call optimization apparatus, characterized in that, include: The static data verification module is used to respond to the function call instruction of the candidate stored function in the target database, and perform static data existence verification on the current global cache of the target database according to the current cache key of the target database to obtain the existence verification result. The static data determination module is used to determine the code static data of the candidate storage function based on the candidate function code of the candidate storage function if the existence check result is that no static data exists, and to store the code static data in the current global cache. The storage array determination module is used to determine the dynamic storage array of the candidate storage function based on the static code data, and associate the static code data and the dynamic storage array through pointers; The instruction execution module is used to execute the function call instruction based on the static code data, and to store the dynamic data generated by the function call instruction during the call process into the dynamic storage array.

7. The apparatus according to claim 6, characterized in that, The static data determination module includes: The syntax parsing unit is used to perform syntax parsing and optimization on the candidate function code of the candidate stored function to obtain an abstract syntax tree of the candidate function code; wherein, the abstract syntax tree refers to a tree-shaped representation of the code structure used to characterize the candidate function code; The query optimization unit is used to perform query optimization on the candidate function code based on the abstract syntax tree, and determine the target execution strategy from the candidate execution strategies of the candidate function code; The data determination unit is used to determine the static code data of the candidate stored function based on the candidate function code and the target execution strategy.

8. An electronic device, characterized in that, include: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the stored function call optimization method as described in any one of claims 1-5.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the stored function call optimization method as described in any one of claims 1-5.

10. A computer program product comprising a computer program that, when executed by a processor, implements the stored function call optimization method according to any one of claims 1-5.