A data query method, device, apparatus and storage medium
By creating a shared global temporary table for read-only tables in a distributed database system and caching data locally on the compute nodes, the problems of high query costs and node expansion costs are solved, achieving efficient querying and flexible node management.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHANGHAI DAMENG DATABASE
- Filing Date
- 2023-05-04
- Publication Date
- 2026-07-24
AI Technical Summary
In a distributed database system, it is costly for computing nodes to retrieve data from data storage nodes for querying, and replicating data to all nodes increases the cost of dynamic node expansion.
When the target table is a read-only table, a shared global temporary table is created, and the data of this table is cached locally on the compute node. Queries are performed directly from the local cache, avoiding data replication between nodes.
This reduces query costs and lowers the cost of dynamic node expansion, improving query efficiency and system flexibility.
Smart Images

Figure CN116541438B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a data query method, apparatus, device and storage medium. Background Technology
[0002] A complete distributed database system consists of three parts: compute nodes (SP), data storage nodes (BP), and metadata server nodes (MP). The SP is the node that provides database services to the outside world in the distributed database system. It is responsible for receiving user requests, generating plans, dividing them into sub-plans, calculating parallelism according to certain rules, scheduling each sub-plan, and finally returning the execution results to the user. The BP is the node in the DMDPC cluster that actually stores the data. It is responsible for storing data, receiving subtask scheduling instructions from the SP, executing subtasks, and returning the results to the SP. The MP is the node in the DMDPC cluster that provides metadata services (i.e., dictionary information services). All DDL requests are forwarded by the SP to the MP for execution, and all metadata information is stored in the MP. The definition statements for both ordinary tables and temporary tables in this invention are stored on the MP.
[0003] In a distributed environment, different tables store data on different data storage nodes. Often, some tables contain data that is rarely modified. These tables are mostly read-only in the distributed database, but when other compute nodes want to use them, they must first retrieve the data from the data storage node before querying, resulting in a high query cost. Additionally, there are tables in the database that rarely change data and are unsuitable for partitioning, such as configuration-related tables. Each node needs to retrieve data from these configuration-related tables, making partitioning unsuitable. Besides the aforementioned problems, such tables often require replication, storing data across all nodes and increasing the cost of dynamic node expansion. Summary of the Invention
[0004] This invention provides a data query method, apparatus, device, and storage medium, which solves the problem that computing nodes need to obtain data from data storage nodes before querying, resulting in high query costs, and also solves the problem that data needs to be stored in all nodes through replication, increasing the cost of dynamic node expansion. It can reduce both query costs and the cost of dynamic node expansion.
[0005] According to one aspect of the present invention, a data query method is provided, comprising:
[0006] When a query instruction for a target table is received, the type of the target table is obtained;
[0007] If the target table is a read-only table, then obtain the target shared global temporary table corresponding to the target table;
[0008] The query command is used to query the target shared global temporary table corresponding to the target table, and the query result is obtained.
[0009] According to another aspect of the present invention, a data query device is provided, the data query device comprising:
[0010] The table type acquisition module is used to acquire the target table type when a query instruction for the target table is received.
[0011] The shared global temporary table acquisition module is used to acquire the target shared global temporary table corresponding to the target table if the target table type is a read-only table;
[0012] The query module is used to query the target shared global temporary table corresponding to the target table according to the query instruction, and obtain the query result.
[0013] Furthermore, the table type retrieval module is specifically used for:
[0014] If a query command for the target table is received for the first time, then the type of the target table is obtained;
[0015] The shared global temporary table retrieval module is specifically used for:
[0016] If the target table is a read-only table, the data in the target table is stored in the first shared global temporary table corresponding to the target table, thus obtaining the target shared global temporary table corresponding to the target table.
[0017] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0018] At least one processor; and
[0019] A memory communicatively connected to the at least one processor; wherein,
[0020] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the data query method according to any embodiment of the present invention.
[0021] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the data query method described in any embodiment of the present invention.
[0022] This invention, in its embodiment, obtains the target table type upon receiving a query instruction for a target table; if the target table type is a read-only table, it obtains the target shared global temporary table corresponding to the target table; and queries the target shared global temporary table corresponding to the target table according to the query instruction to obtain the query result. This solves both the problem of high query costs caused by computing nodes needing to obtain data from data storage nodes before querying, and the problem of increased costs associated with dynamic node expansion due to the need for replication to store data across all nodes. It reduces both query costs and the costs associated with dynamic node expansion.
[0023] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0024] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0025] Figure 1 This is a flowchart of a data query method according to an embodiment of the present invention;
[0026] Figure 2 This is a schematic diagram of the structure of a data query device according to an embodiment of the present invention;
[0027] Figure 3 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0028] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0029] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention 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 the invention 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 a 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.
[0030] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.
[0031] Example 1
[0032] Figure 1 This is a flowchart illustrating a data query method provided in an embodiment of the present invention. This embodiment is applicable to data query scenarios. The method can be executed by the data query device in this embodiment, which can be implemented in software and / or hardware, such as... Figure 1 As shown, the method specifically includes the following steps:
[0033] S110, when a query instruction for the target table is received, the type of the target table is obtained.
[0034] The target table type can be either a regular table or a read-only table. A regular table is both readable and writable, and can also be called a read-write table. A read-only table is only readable and cannot be written.
[0035] Specifically, when a query instruction for a target table is received, the type of the target table can be obtained by: determining the target table type based on the identification information of the target table when a query instruction for a target table is received.
[0036] S120, if the target table type is a read-only table, then obtain the target shared global temporary table corresponding to the target table.
[0037] Specifically, if the target table is a read-only table, the method for obtaining the target shared global temporary table corresponding to the target table can be as follows: if the target table is a read-only table and this is the first time a query instruction for the target table has been received, then the data in the target table is stored in the first shared global temporary table corresponding to the target table, thus obtaining the target shared global temporary table corresponding to the target table. Alternatively, if the target table is a read-only table, the method for obtaining the target shared global temporary table corresponding to the target table can also be as follows: if the target table is a read-only table and this is not the first time a query instruction for the target table has been received, then the target shared global temporary table corresponding to the target table is directly obtained.
[0038] It should be noted that, compared to the temporary table data in the shared global cache and the temporary table data in the non-shared local cache in this embodiment of the invention, the data in the non-shared local cache can only be used by one session, while the data in the shared global cache can be used by multiple sessions. Furthermore, compared to ordinary temporary tables, the globally shared temporary table in this embodiment of the invention is session-level and can only be used by one session, while the globally shared temporary table is global and can be used by multiple sessions.
[0039] S130, query the target shared global temporary table corresponding to the target table according to the query instruction, and obtain the query result.
[0040] The data stored in the target shared global temporary table is the same as the data in the target table.
[0041] The query results can be the returned data.
[0042] Specifically, the query result can be obtained by querying the target shared global temporary table corresponding to the target table according to the query instruction: querying the target shared global temporary table corresponding to the target table according to the key information carried by the query instruction, obtaining the data corresponding to the key information, and determining the data corresponding to the key information as the query result.
[0043] Optionally, when a query instruction for a target table is received, the target table type is obtained, including:
[0044] When a query command for the target table is received, determine whether it is the first time such a query command for the target table has been received.
[0045] If a query command for the target table is received for the first time, then the type of the target table is obtained;
[0046] Accordingly, if the target table type is a read-only table, then the target shared global temporary table corresponding to the target table is obtained, including:
[0047] If the target table is a read-only table, the data in the target table is stored in the first shared global temporary table corresponding to the target table, thus obtaining the target shared global temporary table corresponding to the target table.
[0048] It's important to note that when all sessions on the same compute node use the original regular tables, they all borrow the corresponding shared global temporary table to retrieve the data. All accesses to read-only tables are redirected to the shared global temporary table during the planning phase. This shared global temporary table also possesses all the indexes of the read-only tables, and access to it is completely transparent to the user (i.e., user access to the read-only table is automatically redirected to the shared global temporary table internally, without any additional user intervention or awareness). This eliminates the need for data replication on data nodes (i.e., there's no need to copy table data from the data storage node to the current compute node); access from all sessions can be completed simply by directly accessing the temporary table data in the compute node's local global cache. A single cache can be reused indefinitely. Furthermore, since the data in the temporary table is cached locally, join queries do not require retrieving data from remote data nodes, reducing query costs.
[0049] When a read-only table needs to be modified or is no longer used, it can be converted into a regular table. During the conversion process, the shared global temporary table is automatically destroyed, the relevant information in the global cache is automatically destroyed, and the read-only table access plan is automatically adjusted. Users are unaware of this process. Afterward, the read-only table is switched to a regular table, and there is no difference between it and a regular table.
[0050] Optional, also includes:
[0051] If a table type conversion instruction is received for a regular table, an initial shared global temporary table corresponding to the regular table is created;
[0052] An index is constructed on the initial shared global temporary table corresponding to the ordinary table based on the index information of the ordinary table, resulting in a read-only table and a first shared global temporary table corresponding to the read-only table.
[0053] The table type conversion instruction for a regular table is an instruction that converts a regular table into a read-only table.
[0054] It should be noted that the indexes in the first shared global temporary table are the same as the indexes in the ordinary table.
[0055] In a specific example, converting a regular table into a read-only table involves the following steps:
[0056] The user creates a regular table and loads data into it; this is to prepare the data for the user's subsequent use.
[0057] The system method A is called to switch the ordinary table to a read-only table. The database automatically creates a shared global temporary table and builds the required indexes on the temporary table.
[0058] The database automatically builds a global shared cache on the compute nodes (all compute nodes have one). On the first query of each compute node, temporary table data is loaded into the compute node's global shared cache. The attribute information of the temporary table and the read-only table (read-only table ID, temporary table ID, read-only table version, temporary table version, load thread ID, data address, and load time, etc.) are placed into each compute node's global shared cache. If a compute node does not query the temporary table, it does not load it.
[0059] When a user performs a query operation on a read-only table through a compute node, the database automatically modifies the execution plan, changing the access to the read-only table to an access to a shared global temporary table, and retrieving the temporary table data from the compute node's local global cache for return.
[0060] Optionally, if the target table type is a read-only table, the data in the target table is stored in the first shared global temporary table corresponding to the target table to obtain the target shared global temporary table corresponding to the target table, including:
[0061] Create a global shared cache;
[0062] If the target table is a read-only table, the data in the target table is stored in the first shared global temporary table corresponding to the target table to obtain the target shared global temporary table corresponding to the target table;
[0063] Obtain the attribute information of the target table and the attribute information of the target shared global temporary table corresponding to the target table;
[0064] The attribute information of the target table, the attribute information of the target shared global temporary table corresponding to the target table, and the target shared global temporary table are stored in the global shared cache.
[0065] It should be noted that each compute node needs to create a global shared cache. Only when it receives a query instruction for a read-only table for the first time will it store the data in the target table into the first shared global temporary table corresponding to the target table, thus obtaining the target shared global temporary table corresponding to the target table. Compute nodes that do not query the read-only table will neither register relevant information (attribute information of the target table and attribute information of the target shared global temporary table corresponding to the target table) nor load data; their global shared cache will be empty, and they can remain in a lightweight state indefinitely.
[0066] Specifically, the attribute information of the target table and the attribute information of the target shared global temporary table corresponding to the target table are stored in a global shared cache. This allows the shared global temporary table corresponding to the read-only table to be converted, the attribute information of the read-only table to be converted, and the attribute information of the shared global temporary table corresponding to the read-only table to be converted to be deleted based on the attribute information when performing table type conversion, thus obtaining a normal table.
[0067] Optional, also includes:
[0068] If a table type conversion instruction for a read-only table is received, the global shared cache is queried based on the identification information of the read-only table to be converted, and the shared global temporary table corresponding to the read-only table to be converted, the attribute information of the read-only table to be converted, and the attribute information of the shared global temporary table corresponding to the read-only table are obtained.
[0069] Delete the shared global temporary table corresponding to the read-only table to be converted, the attribute information of the read-only table to be converted, and the attribute information of the shared global temporary table corresponding to the read-only table to be converted, to obtain a normal table.
[0070] Among them, the table type conversion instruction for read-only tables is the instruction to convert a read-only table into a regular table.
[0071] Specifically, the method for querying the global shared cache based on the identifier information of the read-only table to be converted, and obtaining the shared global temporary table corresponding to the read-only table to be converted, the attribute information of the read-only table to be converted, and the attribute information of the shared global temporary table corresponding to the read-only table, can be as follows: Query the global shared cache. If the identifier information of the read-only table in the attribute information of the first read-only table in the global shared cache is the same as the identifier information of the read-only table to be converted, then obtain the shared global temporary table corresponding to the first read-only table, the attribute information of the first read-only table, and the attribute information of the shared global temporary table corresponding to the first read-only table in the global shared cache.
[0072] It should be noted that, depending on actual read / write requirements, the operations described in this invention can be used to convert between ordinary tables and read-only tables. When converting an ordinary table to a read-only table, a shared global temporary table is created; the data in this temporary table is not persisted to disk. The read-only table will coexist with this shared global temporary table. This temporary table is shared globally and exists on the computing nodes in a distributed environment; all authorized sessions can access it. Therefore, unnecessary data replication between nodes can be avoided. Furthermore, since the data is cached locally on the computing nodes, when the computing nodes query this table, the cost of join queries can be reduced. The shared global temporary table is loaded once and can be used throughout the entire lifecycle of the read-only table.
[0073] In a specific example, converting a read-only table into a regular table involves the following steps:
[0074] When a user calls system method B to switch a read-only table to a regular table, the database automatically clears the global cache of the compute nodes, severs the association between the shared global temporary table and the read-only table, and deletes the shared global temporary table, restoring the user's access to the regular table as before. Throughout the entire process, the user only needs to call the system method to convert between the regular table and the read-only table; all other usage is the same as with regular tables, and the user is unaware of the internal processing.
[0075] Optionally, the attribute information of the read-only table to be converted includes: the identification information of the read-only table to be converted and the version information of the read-only table to be converted. The attribute information of the shared global temporary table corresponding to the read-only table to be converted includes: the identification information of the shared global temporary table corresponding to the read-only table to be converted and the version information of the shared global temporary table corresponding to the read-only table to be converted.
[0076] The technical solution of this embodiment, when a query instruction for a target table is received, obtains the type of the target table; if the target table type is a read-only table, obtains the target shared global temporary table corresponding to the target table; and queries the target shared global temporary table corresponding to the target table according to the query instruction to obtain the query result. This solves the problem that computing nodes need to obtain data from data storage nodes before querying, resulting in high query costs, and also solves the problem that data needs to be stored in all nodes using replication, increasing the cost of dynamic node expansion. It can reduce query costs while reducing the cost of dynamic node expansion.
[0077] Example 2
[0078] Figure 2 This is a schematic diagram of a data query device provided in an embodiment of the present invention. This embodiment is applicable to data query scenarios. The device can be implemented using software and / or hardware, and can be integrated into any device that provides data query functionality, such as… Figure 2 As shown, the data query device specifically includes: a table type acquisition module 210, a shared global temporary table acquisition module 220, and a query module 230.
[0079] The table type acquisition module is used to acquire the target table type when a query instruction for the target table is received.
[0080] The shared global temporary table acquisition module is used to acquire the target shared global temporary table corresponding to the target table if the target table type is a read-only table;
[0081] The query module is used to query the target shared global temporary table corresponding to the target table according to the query instruction, and obtain the query result.
[0082] Optionally, the table type retrieval module is specifically used for:
[0083] If a query command for the target table is received for the first time, then the type of the target table is obtained;
[0084] The shared global temporary table retrieval module is specifically used for:
[0085] If the target table is a read-only table, the data in the target table is stored in the first shared global temporary table corresponding to the target table, thus obtaining the target shared global temporary table corresponding to the target table.
[0086] The above-described products can perform the methods provided in any embodiment of the present invention, and have the corresponding functional modules and beneficial effects for performing the methods.
[0087] Example 3
[0088] Figure 3 A schematic diagram of an electronic device 10 that can be used to implement embodiments of the present invention is shown. 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 (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0089] like Figure 3 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 may also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0090] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0091] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 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 11 performs the various methods and processes described above, such as data querying methods.
[0092] In some embodiments, the data query method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the data query method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to execute the data query method by any other suitable means (e.g., by means of firmware).
[0093] 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.
[0094] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing 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 performed. 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.
[0095] In the context of this invention, 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 may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may 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 fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0096] 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).
[0097] 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.
[0098] 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.
[0099] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0100] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. 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 invention should be included within the scope of protection of this invention.
Claims
1. A data query method, characterized in that, The method, executed by a compute node, includes: When a query instruction for a target table is received, the type of the target table is obtained; If the target table is a read-only table, then obtain the target shared global temporary table corresponding to the target table; The query command is used to query the target shared global temporary table corresponding to the target table, and the query result is obtained. If the target table type is a read-only table, then obtain the target shared global temporary table corresponding to the target table, including: If the target table is a read-only table, the data in the target table is stored in the first shared global temporary table corresponding to the target table to obtain the target shared global temporary table corresponding to the target table; The method further includes: If a table type conversion instruction is received for a regular table, an initial shared global temporary table corresponding to the regular table is created; An index is constructed on the initial shared global temporary table corresponding to the ordinary table based on the index information of the ordinary table, resulting in a read-only table and a first shared global temporary table corresponding to the read-only table; the index in the first shared global temporary table is the same as the index in the ordinary table; Wherein, if the target table type is a read-only table, the data in the target table is stored in the first shared global temporary table corresponding to the target table, to obtain the target shared global temporary table corresponding to the target table, including: Create a global shared cache; the global shared cache is located on the compute node; If the target table is a read-only table, the data in the target table is stored in the first shared global temporary table corresponding to the target table to obtain the target shared global temporary table corresponding to the target table; Obtain the attribute information of the target table and the attribute information of the target shared global temporary table corresponding to the target table; The attribute information of the target table, the attribute information of the target shared global temporary table corresponding to the target table, and the target shared global temporary table are stored in the global shared cache.
2. The method according to claim 1, characterized in that, When a query instruction for a target table is received, the type of the target table is obtained, including: When a query command for the target table is received, determine whether it is the first time such a query command for the target table has been received. If a query command for the target table is received for the first time, the type of the target table is obtained.
3. The method according to claim 1, characterized in that, Also includes: If a table type conversion instruction for a read-only table is received, the global shared cache is queried based on the identification information of the read-only table to be converted, and the shared global temporary table corresponding to the read-only table to be converted, the attribute information of the read-only table to be converted, and the attribute information of the shared global temporary table corresponding to the read-only table are obtained. Delete the shared global temporary table corresponding to the read-only table to be converted, the attribute information of the read-only table to be converted, and the attribute information of the shared global temporary table corresponding to the read-only table to be converted, to obtain a normal table.
4. The method according to claim 3, characterized in that, The attribute information of the read-only table to be converted includes: the identification information of the read-only table to be converted and the version information of the read-only table to be converted. The attribute information of the shared global temporary table corresponding to the read-only table to be converted includes: the identification information of the shared global temporary table corresponding to the read-only table to be converted and the version information of the shared global temporary table corresponding to the read-only table to be converted.
5. A data query device, characterized in that, The device includes: The table type acquisition module is used to acquire the target table type when a query instruction for the target table is received. The shared global temporary table acquisition module is used to acquire the target shared global temporary table corresponding to the target table if the target table type is a read-only table; The query module is used to query the target shared global temporary table corresponding to the target table according to the query instruction, and obtain the query result; The shared global temporary table retrieval module is also used for: If the target table is a read-only table, the data in the target table is stored in the first shared global temporary table corresponding to the target table to obtain the target shared global temporary table corresponding to the target table; The device is also used for: If a table type conversion instruction is received for a regular table, an initial shared global temporary table corresponding to the regular table is created; An index is constructed on the initial shared global temporary table corresponding to the ordinary table based on the index information of the ordinary table, resulting in a read-only table and a first shared global temporary table corresponding to the read-only table; the index in the first shared global temporary table is the same as the index in the ordinary table; Wherein, if the target table type is a read-only table, the data in the target table is stored in the first shared global temporary table corresponding to the target table, to obtain the target shared global temporary table corresponding to the target table, including: Create a global shared cache; the global shared cache is located on the compute node; If the target table is a read-only table, the data in the target table is stored in the first shared global temporary table corresponding to the target table to obtain the target shared global temporary table corresponding to the target table; Obtain the attribute information of the target table and the attribute information of the target shared global temporary table corresponding to the target table; The attribute information of the target table, the attribute information of the target shared global temporary table corresponding to the target table, and the target shared global temporary table are stored in the global shared cache.
6. The apparatus according to claim 5, characterized in that, The table type retrieval module is specifically used for: If a query command for the target table is received for the first time, then the type of the target table is obtained; The shared global temporary table retrieval module is specifically used for: If the target table is a read-only table, the data in the target table is stored in the first shared global temporary table corresponding to the target table, thus obtaining the target shared global temporary table corresponding to the target table.
7. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the data query method according to any one of claims 1-4.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the data query method according to any one of claims 1-4.