Temporary table management method and device for database, medium and product

By assigning unique block table identifiers and physical location nodes to temporary tables in PL/SQL blocks, the logical name and physical name are decoupled, solving the problem of duplicate temporary table name conflicts in PL/SQL blocks, achieving smooth execution of database operations and improving user experience.

CN120705195APending Publication Date: 2025-09-26CETC JINCANG (BEIJING) TECH CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510820367.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-18
Publication Date
2025-09-26

AI Technical Summary

Technical Problem

In a database, creating a temporary table in a PL/SQL block is prone to execution failure due to duplicate name conflicts, and existing technologies are unable to effectively avoid this situation.

Method used

Assign unique block table identifiers and corresponding physical location nodes to temporary tables in PL/SQL blocks, manage temporary tables by decoupling logical names and physical names to avoid duplicate name conflicts.

Benefits of technology

It effectively avoids duplicate name conflicts of temporary tables in PL/SQL blocks, ensures smooth execution of database operations, improves user experience without increasing user burden.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120705195A_ABST
    Figure CN120705195A_ABST
Patent Text Reader

Abstract

The invention provides a temporary table management method and device for a database, a medium and a product. The temporary table management method of the database comprises the following steps: acquiring a connection request of a client, and configuring a user process for the client to execute an operation statement of the client; receiving a procedural program block from the client and detecting a temporary table creation statement in the procedural program block; creating an intra-block temporary table according to a temporary table creation statement in the procedural program block and distributing a unique block table identifier and a corresponding physical location node for the intra-block temporary table, wherein the unique block table identifier comprises an original table name of the intra-block temporary table and a unique mark representing the procedural program block; and detecting operation on the temporary table in the execution process of the procedural program block, searching according to the unique block table identifier of the operated temporary table to obtain the corresponding physical temporary table file, and performing operation. And the situation that execution fails due to name duplication conflicts of the temporary tables when the temporary tables are created in a procedural program block, namely, a PL / SQL block is avoided.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of databases, and in particular to a temporary table management method, equipment, medium and product for a database. Background Art

[0002] In a database, a temporary table is a special database object used to store temporary data. This data exists only within a specific session or transaction cycle and is not permanently written to physical storage. With the development of database services and the increasing complexity of data processing, temporary tables are playing an increasingly important role in database management systems. They can be used in a variety of scenarios, such as those requiring temporary storage of intermediate calculation results for complex queries, temporary isolation of test data for batch operations, and avoiding data interference in multi-user concurrent scenarios. This improves database performance and simplifies data processing.

[0003] In actual applications, since databases often execute related operations by calling pre-created PL / SQL blocks (Procedural Language / Structured Query Language, a program unit that combines SQL statements with procedural logic), when there are statements to create temporary tables in the PL / SQL block, it is very easy for the temporary table to have a name conflict with an existing temporary table in the process or when the PL / SQL block is nested, resulting in execution failure. Summary of the Invention

[0004] An object of the present invention is to provide a database temporary table management method, device, medium and product that help avoid execution failure caused by duplicate name conflicts when creating temporary tables in PL / SQL blocks.

[0005] In particular, the present invention provides a temporary table management method for a database, comprising:

[0006] Obtaining a connection request from a client, and configuring a user process for the client to execute an operation statement of the client;

[0007] receiving a procedural program block from the client and detecting a temporary table creation statement in the procedural program block;

[0008] Creating an intra-block temporary table according to a temporary table creation statement in the procedural program block and assigning a unique block table identifier and a corresponding physical location node to the intra-block temporary table, wherein the unique block table identifier includes an original table name of the intra-block temporary table and a unique tag representing the procedural program block;

[0009] During the execution of the procedural program block, an operation on a temporary table is detected, and the corresponding physical temporary table file is found according to the unique block table identifier of the operated temporary table and the operation is performed.

[0010] Optionally, after the step of configuring a user process for the client, the step further includes:

[0011] Configuring a preset linked list for the user process;

[0012] The step of allocating a unique block table identifier to the intra-block temporary table includes:

[0013] The unique block table identifier is recorded in the preset linked list.

[0014] Optionally, when it is detected that the procedural program block exits, the preset linked list is queried to see whether there is a unique block table identifier containing the unique mark of the procedural program block. If so, the in-block temporary table created by the procedural program block is deleted and the corresponding unique block table identifier in the preset linked list is deleted.

[0015] Optionally, the unique block table identifier further includes a unique mark of the intra-block temporary table in the procedural program block.

[0016] Optionally, receiving an independent temporary table creation statement from the client;

[0017] Creating an in-process temporary table according to the independent temporary table creation statement and assigning a unique process table identifier and a corresponding physical location node to the in-process temporary table, wherein the unique process table identifier includes the original table name and a unique identifier of the in-process temporary table;

[0018] The unique process table identifier is recorded in the preset linked list.

[0019] Optionally, receiving an independent temporary table operation statement from the client;

[0020] Check whether there is a unique process table identifier corresponding to the temporary table being operated in the preset linked list. If so, find the corresponding physical temporary table file according to the unique process table identifier and perform the operation. If not, prohibit executing the independent temporary table operation statement.

[0021] Optionally, when it is detected that the user process exits, all temporary tables belonging to the user process are deleted according to the records of the preset linked list owned by the user process.

[0022] According to another aspect of the present invention, a computer device is also provided, comprising a memory, a processor, and a computer executable program stored in the memory and running on the processor, and the processor implements the temporary table management method of the database according to any one of the above items when executing the computer executable program.

[0023] According to another aspect of the present invention, a computer-readable storage medium is provided, on which a computer-executable program is stored. When the computer-executable program is executed by a processor, the temporary table management method of the database according to any one of the above items is implemented.

[0024] According to another aspect of the present invention, a computer program product is provided, including a computer executable program, which, when executed by a processor, implements the temporary table management method for a database according to any one of the above items.

[0025] The database temporary table management method of the present invention is as follows: when a procedural program block is received from a client and a temporary table creation statement is detected in the procedural program block, a temporary table is created within the block according to the temporary table creation statement in the procedural program block, and a unique block table identifier and a corresponding physical location node are assigned to the temporary table within the block. The unique block table identifier includes the original table name of the temporary table within the block and a unique tag representing the procedural program block. During the execution of the procedural program block, an operation on the temporary table is detected, and the corresponding physical temporary table file is found and the operation is performed based on the unique block table identifier of the operated temporary table. In other words, by assigning the unique block table identifier as the underlying physical name to the temporary table created within the procedural program block, the logical name and physical name of the temporary table within the block are decoupled. The database system manages the temporary table within the block through the physical name, i.e., the unique block table identifier, thereby helping to avoid execution failures caused by temporary table duplication conflicts when creating a temporary table in the procedural program block, i.e., a PL / SQL block. Moreover, while ensuring the smooth execution of database operations, the program burden of database users is not increased, helping to ensure that database users have a better user experience.

[0026] Based on the following detailed description of specific embodiments of the present invention in conjunction with the accompanying drawings, those skilled in the art will become more aware of the above and other objects, advantages and features of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Hereinafter, some specific embodiments of the present invention will be described in detail in an exemplary and non-limiting manner with reference to the accompanying drawings. The same reference numerals in the accompanying drawings indicate the same or similar components or parts. It should be understood by those skilled in the art that these drawings are not necessarily drawn to scale. In the accompanying drawings:

[0028] Figure 1is a schematic flow chart of a temporary table management method for a database according to an embodiment of the present invention;

[0029] Figure 2 is a schematic flow chart of a temporary table management method for a database according to another embodiment of the present invention;

[0030] Figure 3 is a schematic flow chart of a temporary table management method for a database according to yet another embodiment of the present invention;

[0031] Figure 4 is a schematic flow chart of a temporary table management method for a database according to yet another embodiment of the present invention;

[0032] Figure 5 is a schematic flow chart of a temporary table management method for a database according to yet another embodiment of the present invention;

[0033] Figure 6 is a schematic flow chart of a temporary table management method for a database according to yet another embodiment of the present invention;

[0034] Figure 7 is a schematic diagram of a computer device according to one embodiment of the present invention;

[0035] Figure 8 is a schematic diagram of a computer-readable storage medium according to one embodiment of the present invention;

[0036] Figure 9 is a schematic diagram of a computer program product according to one embodiment of the present invention. DETAILED DESCRIPTION

[0037] It should be understood by those skilled in the art that the embodiments described below are only some embodiments of the present invention, rather than all embodiments of the present invention, and that these embodiments are intended to explain the technical principles of the present invention and are not intended to limit the scope of protection of the present invention. Based on the embodiments provided by the present invention, all other embodiments obtained by those skilled in the art without creative effort should still fall within the scope of protection of the present invention.

[0038] It should be noted that the logic and / or steps represented in the flowchart or described in other ways herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable medium for use by an instruction execution system, device or equipment (such as a computer-based system, a system including a processor or other system that can fetch instructions from an instruction execution system, device or equipment and execute instructions), or used in combination with these instruction execution systems, devices or equipment.

[0039] The flowchart provided by the present invention is not intended to indicate that the operations of the method will be performed in any particular order, or that all operations of the method are included in all every case. In addition, the method may include additional operations. Within the scope of the technical ideas provided by the present embodiment method, additional changes can be made to the above method.

[0040] like Figure 1 As shown, in one embodiment, the temporary table management method of a database generally includes:

[0041] Step S101: Receiving a connection request from a client, a user process is configured for the client to execute the client's operation statements. Specifically, the database server receives a connection request from a client, or database user, and configures a user process for the requesting client to manage the session between the server and the client. The user process is then used to execute the client's operation statements, i.e., SQL (Structured Query Language) statements.

[0042] In step S102, a procedural program block is received from the client and a temporary table creation statement is detected in the procedural program block. Specifically, the server receives a procedural program block, i.e., a PL / SQL block, from the client and, during execution of the PL / SQL block, detects the presence of a temporary table creation statement in the PL / SQL block. PL / SQL blocks include stored procedures, functions, anonymous blocks, and the like.

[0043] It should be noted that the procedural program block in this embodiment can be an independent procedural program block or a PL / SQL block nested in other PL / SQL blocks.

[0044] Step S103, create an intra-block temporary table according to the temporary table creation statement in the procedural program block and assign a unique block table identifier and a corresponding physical location node to the intra-block temporary table. The unique block table identifier includes the original table name of the intra-block temporary table and a unique tag representing the procedural program block.

[0045] Specifically, the unique block table identifier is the unique physical table name assigned by the database system to a temporary table within the block at the underlying level. Its logical name remains the original table name in its creation statement, and the database system automatically maps the two. Furthermore, the unique identifier representing a procedural block can include the procedural block type and the sequence number in which that type is used. For example, if the procedural block type is a stored procedure and this is the first time the current user process uses the stored procedure, "proc-1" can be used as the unique identifier for the procedural block.

[0046] The physical location node is the storage location of the created temporary table, which is mapped to the unique block table identifier, so that the corresponding physical temporary table file can be found according to the unique block table identifier.

[0047] Step S104: During the execution of the procedural program block, if an operation on a temporary table is detected, the corresponding physical temporary table file is retrieved based on the unique block table identifier of the temporary table being operated on, and the operation is performed. Specifically, during the execution of the procedural program block, if an operation statement that operates on a temporary table is detected after the temporary table is created, only the temporary table created in the current procedural program block is retrieved based on the unique block table identifier, and the operation is performed on the retrieved temporary table.

[0048] Specifically, a unique block table identifier is obtained according to the original table name of the operated temporary table and the unique tag of the current procedural program block, and a corresponding physical location node is found according to the unique block table identifier, thereby obtaining a physical temporary table file.

[0049] For example, a temporary table creation statement "CREATE TEMP TABLENAME" is detected in a procedural program block, where NAME is the original table name of the temporary table, or the logical table name. A unique block table identifier is assigned to the temporary table when it is created. During the execution of the procedural program block, a query on the temporary table "SELECT * FROM NAME" is detected. It is necessary to find the physical location node corresponding to the unique block table identifier that includes NAME and the unique mark of the current procedural program block, so as to find the physical temporary table file and query the physical temporary table file.

[0050] Because procedural blocks can be sealed in advance and called by name, and database users usually have customary naming conventions when creating temporary tables, it is easy to use the same table name in a pre-sealed procedural block and in subsequent ordinary operation statements. If a user first creates a temporary table with an ordinary operation statement and then calls a procedural block, or if a user creates two procedural blocks and uses the same table name in both, then nested calls to the two procedural blocks (that is, calling another procedural block from within one procedural block) will result in a temporary table name conflict, leading to execution failure. Using different table names increases user management difficulty and affects the user experience.

[0051] Therefore, in the solution of this embodiment, when a procedural program block is received from a client and a temporary table creation statement is detected in the procedural program block, a temporary table in the block is created according to the temporary table creation statement in the procedural program block and a unique block table identifier and a corresponding physical location node are assigned to the temporary table in the block. The unique block table identifier includes the original table name of the temporary table in the block and a unique tag representing the procedural program block. During the execution of the procedural program block, an operation on the temporary table is detected, and the corresponding physical temporary table file is found and the operation is performed based on the unique block table identifier of the temporary table being operated. In other words, by assigning a unique block table identifier as the underlying physical name to the temporary table created in the procedural program block, the logical name and physical name of the temporary table in the block are decoupled, and the database system manages the temporary table in the block through the physical name, i.e., the unique block table identifier, thereby helping to avoid the occurrence of execution failures due to temporary table duplication conflicts when creating temporary tables in the procedural program block, i.e., the PL / SQL block. Moreover, while ensuring the smooth execution of database operations, the program burden of database users will not be increased, which helps to ensure that database users have a better user experience. In addition, after an operation on a temporary table is detected in a procedural block, only temporary tables created in the current procedural block are allowed.

[0052] It should be noted that the unique block table identifier can also include the unique mark of the temporary table within the block within the procedural program block. For example, the order of the temporary tables created within the procedural program block is used as the unique mark, that is, the first temporary table created in the block is 1, the second temporary table created is 2, and so on.

[0053] In this way, in some very special scenarios, such as recursive operations of procedural program blocks, the uniqueness of the physical name of the recursively created temporary table is guaranteed.

[0054] like Figure 2 As shown, in one embodiment, the step of configuring a user process for the client includes: configuring a preset linked list for the user process; the step of allocating a unique block table identifier for the intra-block temporary table includes: recording the unique block table identifier in the preset linked list.

[0055] like Figure 2 As shown, the temporary table management method of the database of this example generally includes:

[0056] Step S201: Obtain a connection request from a client, and configure a user process for the client to execute an operation statement of the client.

[0057] Step S202: configure a preset linked list for the user process. Specifically, a preset linked list unique to the user process is configured.

[0058] Step S203: receiving a procedural program block from the client and detecting a temporary table creation statement in the procedural program block.

[0059] Step S204, create an intra-block temporary table according to the temporary table creation statement in the procedural program block and assign a unique block table identifier and a corresponding physical location node to the intra-block temporary table. The unique block table identifier includes the original table name of the intra-block temporary table and a unique tag representing the procedural program block.

[0060] Step S205: Record the unique block table identifier into a preset linked list. Specifically, the unique block table identifier assigned to the temporary table within the block is recorded into the preset linked list.

[0061] Step S206 , when an operation on a temporary table is detected during the execution of the procedural program block, the corresponding physical temporary table file is searched and operated according to the unique block table identifier of the operated temporary table.

[0062] In this embodiment, a preset linked list is allocated to the user process. After a unique block table identifier is assigned to an intra-block temporary table, the unique block table identifier is recorded in the preset linked list. This simple linked list structure and low memory usage make it suitable for the short lifecycle and frequent dynamic changes in the number of temporary tables. Furthermore, the linked list's naturally sequential storage structure facilitates rapid search and destruction of intra-block temporary tables.

[0063] It should be noted that, in some other embodiments, a structure such as a hash table may also be used to store the unique block table identifier.

[0064] It should be noted that for steps not described in detail in this embodiment, refer to the above description.

[0065] Reference Figure 3 As shown, in one embodiment, the temporary table management method of a database generally includes:

[0066] Step S301, detecting the exit of a process block. Specifically, that is, detecting that all process blocks have been executed, an end mark, generally "END", is written in the process block. When the end mark is detected, the process block is detected to have exited.

[0067] In step S302, a query is made to determine whether a unique block table identifier containing a unique tag of the procedural program block exists in the preset linked list. If so, step S303 is executed. If not, the process ends. Specifically, after the procedural program block exits, the query is made to determine whether a unique block table identifier of a temporary table created during the execution of the procedural program block exists in the preset linked list. If not, no additional operations are performed.

[0068] Step S303: Delete the temporary tables within the blocks created by the procedural program block and delete the corresponding unique block table identifiers in the preset linked list. If the preset linked list contains unique block table identifiers for temporary tables created during the execution of the procedural program block, delete all temporary tables within the blocks created by the procedural program block and delete the corresponding unique block table identifiers in the preset linked list.

[0069] In the solution of this embodiment, because a unique block table identifier is assigned to the in-block temporary table, the in-block temporary table in each procedural program block can be accurately managed. After the procedural program block exits, the temporary table generated by the procedural program block and the corresponding unique block table identifier in the preset linked table are immediately and accurately deleted, immediately releasing resources, improving database operation efficiency, and ensuring the consistency of the records in the preset linked table and the physical temporary table file. In addition, the records in the preset linked table can also improve the efficiency of searching and deleting the temporary table in the procedural program block.

[0070] like Figure 4 As shown, in one embodiment, the temporary table management method of a database generally includes:

[0071] Step S401: A standalone temporary table creation statement is received from a client. Specifically, a standalone temporary table creation statement is received from the client, not a temporary table creation statement contained within a PL / SQL block. Because PL / SQL has both a start and end marker, it is possible to identify whether a temporary table creation statement belongs to a PL / SQL block based on the context.

[0072] In step S402, a temporary table is created within the process based on the independent temporary table creation statement and a unique process table identifier and a corresponding physical location node are assigned to the temporary table. The unique process table identifier includes the original table name and a unique identifier. Specifically, a temporary table created by the independent temporary table creation statement belongs to the process and is visible within the process. The unique identifier can be a string consisting of the current user's process ID and an incrementing sequence number, or other unique character string.

[0073] Step S403: Record the unique process table identifier into a preset linked list.

[0074] In the solution of this embodiment, after receiving an independent temporary table creation statement from the client, an in-process temporary table is created and a unique process table identifier and a corresponding physical location node are assigned to the in-process temporary table. The unique process table identifier is recorded in a preset linked list, which facilitates unified management of the in-process temporary table and facilitates comparison when the in-process temporary table is subsequently deleted.

[0075] like Figure 5 As shown, in one embodiment, the temporary table management method of a database generally includes:

[0076] Step S501: receiving an independent temporary table operation statement from the client. Specifically, receiving an independent temporary table operation statement from the client, rather than a temporary table operation statement contained in a PL / SQL block.

[0077] Step S502 checks whether the unique process table identifier corresponding to the temporary table being operated exists in the preset linked table. If so, step S503 is executed. If not, step S504 is executed. Specifically, the corresponding unique process table identifier is obtained based on the original table name of the temporary table being operated, and then the unique process table identifier is searched in the preset linked table.

[0078] Step S503: Find the corresponding physical temporary table file based on the unique process table identifier and perform the operation. If the unique process table identifier corresponding to the temporary table being operated exists in the preset linked list, the corresponding physical location node is found based on the unique process table identifier, that is, the stored physical temporary table file is obtained, and the operation is performed on the physical temporary table file.

[0079] Step S504 prohibits the execution of independent temporary table operation statements. If the unique process table identifier corresponding to the temporary table being operated on does not exist in the preset linked list, the operation on the temporary table is prohibited. This prevents forged requests from directly accessing the database kernel. Instead, the preset linked list first confirms whether the request is executable, thus helping to block illegal requests.

[0080] Furthermore, in one embodiment, when it is detected that a user process has exited, all temporary tables belonging to the user process are deleted according to the records of the preset linked list owned by the user process, thereby facilitating accurate and comprehensive deletion of all temporary tables of the user process and releasing system resources.

[0081] like Figure 6 As shown, in one embodiment, taking the case where two procedural program blocks of the stored procedure type have a temporary table with the same name created, and the user process also receives an independent operation statement for creating a temporary table with the same name, and there are nested calls to the stored procedures as an example, the solution of this embodiment is explained in a specific example manner. The two stored procedures are recorded as stored procedure 1 and stored procedure 2, and stored procedure 1 internally calls stored procedure 2.

[0082] Step S601: Create an in-process temporary table based on an independent temporary table creation statement. Specifically, the temporary table is created based on a temporary table creation statement that is not contained in a PL / SQL block. Simultaneously, a unique process table identifier and a physical location node are assigned to the in-process temporary table.

[0083] Step S602: Execute stored procedure 1. Specifically, the operation statements within stored procedure 1 are executed from the start position. During this process, after detecting the creation statement of the temporary table within the block, the temporary table within the block of stored procedure 1 is created, a unique block table identifier is assigned to the temporary table within the block, and the identifier is recorded in the preset linked list.

[0084] Step S603: Execute stored procedure 2. Specifically, because stored procedure 1 calls stored procedure 2, after executing the statement that calls stored procedure 2, the operation statement of stored procedure 2 is executed. During this process, when the statement that creates an intra-block temporary table is executed, the intra-block temporary table of stored procedure 2 is created and a unique block table identifier is assigned to the intra-block temporary table. This is recorded in the preset linked list.

[0085] Step S604: During the execution of stored procedure 2, an operation statement on a temporary table is detected, and the temporary table in the block created in stored procedure 2 is operated according to the unique block table identifier of stored procedure 2.

[0086] Step S605, after the execution of stored procedure 2 is completed, it is checked whether there is a unique block table identifier corresponding to stored procedure 2 in the preset linked table. If so, step S606 is executed; if not, step S607 is executed.

[0087] Step S606: exit stored procedure 2, and delete the in-block temporary table created by stored procedure 2 and the corresponding unique block table identifier in the preset linked list.

[0088] Step S607: Only the stored procedure 2 is exited, that is, no other additional operations are performed.

[0089] Step S608: During the execution of stored procedure 1, an operation statement on a temporary table is detected, and the temporary table in the block created in stored procedure 1 is operated according to the unique block table identifier of stored procedure 1.

[0090] Step S609, after the execution of stored procedure 1 is completed, it is checked whether there is a unique block table identifier corresponding to stored procedure 1 in the preset linked table. If so, step S610 is executed; if not, step S611 is executed.

[0091] Step S610: exit the stored procedure 1, and delete the in-block temporary table created by the stored procedure 1 and the corresponding unique block table identifier in the preset linked list.

[0092] Step S611: only exit the stored procedure 1, that is, no other additional operations are performed.

[0093] Step S612: Upon detecting an independent temporary table operation statement, the corresponding physical temporary table file is searched based on the unique process table identifier and the operation is performed. Specifically, after all stored procedures have completed, if an independent temporary table operation statement that does not belong to a PL / SQL block is received, the corresponding physical temporary table file is searched based on the unique process table identifier and the operation is performed.

[0094] Step S613: The user process ends, and the temporary table created in the user process and the corresponding unique process table identifier in the preset linked list are deleted.

[0095] In the solution of this embodiment, by assigning a unique block table identifier and a corresponding physical location node to the in-block temporary table, the logical name and physical name of the in-block temporary table are decoupled. The database system manages the in-block temporary table through the physical name, i.e., the unique block table identifier, so that the in-block temporary table creation statement can still successfully create a temporary table when using the same table name as the process-independent temporary table creation statement, or when two procedural program blocks with the same table name are nested.

[0096] This embodiment also provides a computer device and a computer-readable storage medium. Figure 7 is a schematic diagram of a computer device 10 according to one embodiment of the present invention. Figure 8 is a schematic diagram of a computer-readable storage medium 20 according to one embodiment of the present invention.

[0097] The computer device 10 may include a memory 110, a processor 120, and a computer executable program 11 stored in the memory 110 and running on the processor 120, and when the processor 120 executes the computer executable program 11, the temporary table management method of the database of any of the above embodiments is implemented.

[0098] The computer-readable storage medium 20 stores a computer-executable program 11 thereon. When the computer-executable program 11 is executed by a processor, the temporary table management method of the database in any of the above embodiments is implemented.

[0099] This embodiment also provides a computer program product. Figure 9 1 is a schematic diagram of a computer program product 30 according to an embodiment of the present invention. The computer program product 30 includes a computer executable program 11. When the computer executable program 11 is executed by the processor 120, it implements any of the above-mentioned methods for managing temporary tables of a database.

[0100] Specifically, the computer executable program 11 for performing the operations of the present invention can be assembly instructions, instruction set architecture (ISA) instructions, computer instructions, computer-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages.

[0101] For the purposes of the description of this embodiment, the computer-readable storage medium 20 can be any device that can contain, store, communicate, propagate, or transmit a program for use with an instruction execution system, device, or apparatus, or in conjunction with such instruction execution systems, devices, or apparatuses. More specific examples (a non-exhaustive list) of computer-readable media include the following: an electrical connection having one or more wirings (electronic devices), a portable computer disk cartridge (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and editable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disc read-only memory (CDROM). In addition, the computer-readable storage medium 20 can even be paper or other suitable medium on which the program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering, or processing in other suitable ways as necessary, and then stored in a computer memory.

[0102] It should be understood that each part of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system.

[0103] Computer device 10 may be, for example, a server, a desktop computer, a laptop computer, a tablet computer, or a smartphone. In some examples, computer device 10 may be a cloud acquisition node. Computer device 10 may be described in the general context of computer system executable instructions (such as program modules) executed by a computer system. Generally, program modules may include routines, programs, object programs, components, logic, data structures, etc. that perform specific tasks or implement specific abstract data types. Computer device 10 may be implemented in a distributed cloud acquisition environment where remote processing devices linked via a communication network perform tasks. In a distributed cloud acquisition environment, program modules may be located on local or remote acquisition system storage media, including storage devices.

[0104] The computer device 10 may include a processor 120 adapted to execute stored instructions, and a memory 110 that provides temporary storage for the instructions during operation. The processor 120 may be a single-core processor, a multi-core processor, an acquisition cluster, or any number of other configurations. The memory 110 may include random access memory (RAM), read-only memory, flash memory, or any other suitable storage system.

[0105] The processor 120 may be connected to an I / O interface (input / output interface) suitable for connecting the computer device 10 to one or more I / O devices (input / output devices) via a system interconnect (e.g., PCI, PCI-Express, etc.). The I / O devices may include, for example, a keyboard and a pointing device, wherein the pointing device may include a touchpad or a touch screen, etc. The I / O devices may be built-in components of the computer device 10, or may be devices externally connected to an acquisition device.

[0106] Processor 120 can also be linked to the display interface that is suitable for connecting computer device 10 to display device through system interconnection.Display device can comprise the display screen that is built-in component of computer device 10.Display device can also comprise the computer monitor, television or projector etc. that are externally connected to computer device 10.In addition, network interface controller (network interface controller, NIC) can be suitable for connecting computer device 10 to network through system interconnection.In certain embodiments, NIC can use any suitable interface or protocol (such as Internet Small Computer System Interface etc.) to transmit data.Network can be cellular network, radio network, wide area network (WAN)), local area network (LAN) or Internet etc.Remote device can be connected to computer device through network.

[0107] At this point, those skilled in the art will recognize that, although a number of exemplary embodiments of the present invention have been shown and described in detail herein, many other variations or modifications consistent with the principles of the present invention may be directly determined or derived from the disclosure of the present invention without departing from the spirit and scope of the present invention. Therefore, the scope of the present invention should be understood and deemed to cover all such other variations or modifications.

Claims

1. A method for managing a temporary table of a database, comprising: Obtaining a connection request from a client, and configuring a user process for the client to execute an operation statement of the client; receiving a procedural program block from the client and detecting a temporary table creation statement in the procedural program block; Creating an intra-block temporary table according to a temporary table creation statement in the procedural program block and assigning a unique block table identifier and a corresponding physical location node to the intra-block temporary table, wherein the unique block table identifier includes an original table name of the intra-block temporary table and a unique tag representing the procedural program block; During the execution of the procedural program block, an operation on a temporary table is detected, and the corresponding physical temporary table file is found according to the unique block table identifier of the operated temporary table and the operation is performed.

2. The temporary table management method of a database according to claim 1, wherein: The step of configuring a user process for the client includes: Configuring a preset linked list for the user process; The step of allocating a unique block table identifier to the intra-block temporary table includes: The unique block table identifier is recorded in the preset linked list.

3. The temporary table management method of a database according to claim 2, wherein: When it is detected that the procedural program block exits, the preset linked list is queried to see whether there is a unique block table identifier containing the unique mark of the procedural program block. If so, the in-block temporary table created by the procedural program block is deleted and the corresponding unique block table identifier in the preset linked list is deleted.

4. The temporary table management method of a database according to claim 2, wherein: The unique block table identifier also includes a unique mark of the intra-block temporary table in the procedural program block.

5. The temporary table management method of a database according to claim 2, wherein: receiving an independent temporary table creation statement from the client; Creating an in-process temporary table according to the independent temporary table creation statement and assigning a unique process table identifier and a corresponding physical location node to the in-process temporary table, wherein the unique process table identifier includes the original table name and a unique identifier of the in-process temporary table; The unique process table identifier is recorded in the preset linked list.

6. The temporary table management method of a database according to claim 5, wherein: receiving an independent temporary table operation statement from the client; Check whether there is a unique process table identifier corresponding to the temporary table being operated in the preset linked list. If so, find the corresponding physical temporary table file according to the unique process table identifier and perform the operation. If not, prohibit executing the independent temporary table operation statement.

7. The temporary table management method of a database according to claim 2, wherein: It is detected that the user process exits, and all temporary tables belonging to the user process are deleted according to the records of the preset linked list owned by the user process.

8. A computer device comprising a memory, a processor, and a computer executable program stored in the memory and running on the processor, wherein the processor implements the temporary table management method of a database according to any one of claims 1 to 7 when executing the computer executable program.

9. A computer-readable storage medium having a computer-executable program stored thereon, wherein when the computer-executable program is executed by a processor, the method for managing a temporary table of a database according to any one of claims 1 to 7 is implemented.

10. A computer program product, comprising a computer executable program, wherein when the computer executable program is executed by a processor, the method for managing a temporary table of a database according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • A method for implementing SQL Server-compatible global temporary tables based on the openGauss database

    CN122673192A