Database data dictionary management method and device, equipment and storage medium

By employing a reference counting mechanism in the data dictionary, the problem of low access efficiency in the data dictionary is solved. By retaining metadata with a reference count of 0, scanning time and memory allocation are reduced, thereby improving access efficiency and resource utilization.

CN120407572BActive Publication Date: 2025-10-24TIANJIN NANKAI UNIV GENERAL DATA TECH
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510912862.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-07-03
Publication Date
2025-10-24
Estimated Expiration
2045-07-03

AI Technical Summary

Technical Problem

In existing technologies, data dictionary access is inefficient because memory is released immediately when the metadata reference count is 0, leading to frequent scanning of system tables and re-allocation of memory, which reduces access efficiency.

Method used

A reference counting mechanism is used. When the reference count of metadata is 0, the memory is not released immediately, but is temporarily kept in the data dictionary. The decision on whether to release it is made when it is accessed later, so as to reduce scanning time and memory allocation.

Benefits of technology

It improves the access efficiency of the data dictionary, reduces the scanning time and memory allocation time of the database system, avoids the waste of memory resources, and improves resource utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120407572B_ABST
    Figure CN120407572B_ABST
Patent Text Reader

Abstract

The application discloses a data dictionary management method, device and equipment of a database and a storage medium. The technical scheme of the embodiment of the application implements a reference counting mechanism on metadata in a data dictionary. However, in the case that the reference counting of stored metadata is reduced to zero and the memory of the data dictionary is sufficient, the stored metadata with zero reference counting is not deleted, but is temporarily retained in the data dictionary, so that the scanning time of a database system and the memory application time of the data dictionary are reduced when the same stored metadata is accessed subsequently, the response time of the data dictionary is effectively shortened, the access efficiency of the data dictionary is improved, the waste of memory resources of the data dictionary is avoided, and the resource utilization rate of the data dictionary of the database is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of database memory technology, and in particular to a database data dictionary management method, device, equipment and storage medium. Background Art

[0002] When a database session accesses a table in the database, it needs to obtain the table's meta-information, including schema information, table name, table identifier, column attributes, number of rows, and other information. The table's meta-information is stored in system tables, which are called data dictionaries.

[0003] Because this metadata is frequently accessed, to improve access efficiency, it is cached in the session's memory context after access. When no longer needed, the information is released from memory. However, when accessed again, the data dictionary lacks the table information, requiring a system table scan and memory allocation, which reduces data dictionary access efficiency. Therefore, a method to improve data dictionary access efficiency is urgently needed. Summary of the Invention

[0004] The present invention provides a method, device, equipment and storage medium for managing a data dictionary of a database, so as to realize data dictionary management of the database and improve access efficiency of the data dictionary.

[0005] In a first aspect, an embodiment of the present invention provides a method for managing a data dictionary of a database, the method comprising:

[0006] For the stored metadata in the data dictionary, if indexing is performed based on the stored metadata, the reference count of the stored metadata is increased by a preset value; if indexing is completed based on the stored metadata, the reference count of the stored metadata is decreased by a preset value;

[0007] If the number of references to the stored metadata is reduced to zero and there is no need to release the memory occupied by the data dictionary, the stored metadata is retained in the data dictionary.

[0008] In a second aspect, an embodiment of the present invention further provides a data dictionary management device for a database, the device comprising:

[0009] a count modification module configured to increase a reference count of stored metadata in a data dictionary by a preset value if indexing is performed based on the stored metadata, and to decrease a reference count of the stored metadata by a preset value if indexing is completed based on the stored metadata;

[0010] a data retention module, configured to retain the stored metadata in the data dictionary if the reference count of the stored metadata is reduced to zero and there is no need to release the occupied memory of the data dictionary.

[0011] In a third aspect, an electronic device is provided, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the database data dictionary management method according to any of the embodiments of the present application when executing the program.

[0012] In a fourth aspect, a storage medium storing computer executable instructions is provided, and the computer executable instructions are used to execute the database data dictionary management method according to any of the embodiments of the present application when executed by a computer processor.

[0013] The technical scheme of the embodiments of the present application implements the reference counting mechanism on the metadata in the data dictionary, but does not delete the stored metadata with the reference count of zero, but retains the stored metadata in the data dictionary temporarily, so as to reduce the scanning time of the database system and the memory application time of the data dictionary when the same stored metadata is accessed subsequently, effectively shortens the response time of the data dictionary, improves the access efficiency of the data dictionary, avoids the waste of the memory resources of the data dictionary, and improves the resource utilization rate of the data dictionary.

[0014] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present application, nor is it used to limit the scope of the present application. Other features of the present application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS

[0015] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced below. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0016] Figure 1 is a flowchart of a database data dictionary management method provided by the first embodiment of the present application;

[0017] Figure 2 is a flowchart of a database data dictionary management method provided by the second embodiment of the present application;

[0018] Figure 3 is a flowchart of saving target metadata into the data dictionary provided by the second embodiment of the present application;

[0019] Figure 4 is a structural schematic diagram of a database data dictionary management device provided by embodiment three of the present application;

[0020] Figure 5 is a structural schematic diagram of an electronic device implementing a database data dictionary management method of the present application. DETAILED DESCRIPTION

[0021] In order to make the personnel in the technical field better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below in combination with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by the personnel in the field without creative labor should belong to the scope of protection of the present application.

[0022] It should be noted that the terms "first", "second", and the like in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but can include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0023] Embodiment one

[0024] Figure 1 A flowchart of a database data dictionary management method is provided for embodiment one of the present application. The present embodiment can be applicable to the database data dictionary management situation. The method can be executed by a database data dictionary management device. The database data dictionary management device can be realized in the form of hardware and / or software. The database data dictionary management device can be configured in any electronic device with network communication and calculation. As shown in the figure, the method comprises the following steps. Figure 1

[0025] S110, for the stored metadata in the data dictionary, if indexing is performed based on the stored metadata, the reference count of the stored metadata is increased by a preset value, and if indexing based on the stored metadata is ended, the reference count of the stored metadata is decreased by a preset value.

[0026] ​It should be noted that the embodiment is based on the method for managing the data dictionary in the memory context of the database system.

[0027] In the embodiment, the metadata is data describing data, used to define and explain information such as structure, attribute, relationship and constraint of data. The stored metadata in the data dictionary is metadata that already exists in the data dictionary, and the type of the stored metadata can be structure metadata, business metadata, operation metadata or technical metadata.

[0028] If the type of the stored metadata is structure metadata, the storage form of the metadata in the data dictionary can be composed of table name, field name, data type, whether the data is null, business description and the like.

[0029] The reference count of the metadata is used to record the number of references of the metadata by other objects or entities. At the same time, the reference count of the metadata can be used to track the usage of the metadata, to ensure the lifecycle management of the metadata and data consistency. The preset value in the embodiment is usually 1.

[0030] In the data dictionary, each time there is a new reference to the target metadata, the reference count of the target metadata is increased by 1; when the reference is deleted, the reference count of the target metadata is decreased by 1.

[0031] Specifically, when the database has a session start, the data dictionary content is empty in the SysCache (system cache) memory context. With subsequent access to the metadata of the table, the metadata is found from the system table, and then memory is applied in the system cache and placed in the data dictionary.

[0032] The data dictionary is an array containing various table information such as table name, column information and schema information. Each type has a hash bucket, and each hash bucket has a double-linked list, and the list elements are the table metadata contents, and each list element has a reference counter.

[0033] When the target metadata corresponding to the target data is found in the data dictionary, the target metadata is accessed, the reference count of the target metadata is increased by 1, the cache address of the target metadata is referenced, and the target metadata is moved to the head of the double-linked list. When the access ends and the target metadata is no longer accessed, the reference counter of the target metadata is decreased by 1.

[0034] It should be noted that the reference counting mechanism is implemented for the metadata in the data dictionary, the reference count is increased by 1 when accessed and decreased by 1 when released, which can effectively judge the access frequency of the data, and ensure that the metadata with low usage frequency or no longer used can be recycled in time, to realize a more reasonable cache eviction algorithm.

[0035] S120, if the reference count of the stored metadata is reduced to zero and there is no need to release the occupied memory of the data dictionary, the stored metadata is kept in the data dictionary.

[0036] In the embodiment, the occupied memory of the data dictionary is from the occupied memory space of the stored metadata. If there is no need to release the occupied memory of the data dictionary, two situations can occur. One is that the remaining memory of the data dictionary is enough to store new metadata in the current data access process. The other is that the metadata to be accessed has been stored in the memory of the data dictionary, and there is no need to store new metadata in the current data access process. It can be understood that if the above two situations occur, there is no need to release the occupied memory of the data dictionary.

[0037] It should be noted that in the existing data dictionary management method of the database, after the metadata is accessed, it is cached in the memory context of the database session. When the reference count of the metadata is 0, it indicates that the data is no longer accessed, and the metadata is released from the memory of the data dictionary. However, when the data is accessed again, since the metadata is not in the data dictionary, the system table of the database needs to be scanned again, and the memory of the data dictionary needs to be applied again to store the metadata of the data, which reduces the access efficiency of the data dictionary.

[0038] However, in the embodiment, when the reference count of the metadata is reduced to 0, the metadata is not immediately deleted from the data dictionary, but is temporarily kept in the memory of the data dictionary. It is considered that the metadata will be accessed again in the future. Therefore, in the present scheme, the metadata with the reference count of 0 is temporarily kept in the memory of the data dictionary, so that when the data is accessed next time, the system table of the database does not need to be scanned again, and the memory of the data dictionary does not need to be applied again for the corresponding metadata. Therefore, by temporarily keeping the metadata with the reference count of 0 in the data dictionary, the access efficiency of the data dictionary can be greatly improved.

[0039] The embodiment of the present application discloses a data dictionary management method of a database. For the stored metadata in the data dictionary, if indexing is performed based on the stored metadata, the reference count of the stored metadata is increased by a preset value; if indexing based on the stored metadata is ended, the reference count of the stored metadata is decreased by the preset value; if the reference count of the stored metadata is reduced to zero and there is no need to release the occupied memory of the data dictionary, the stored metadata is retained in the data dictionary. The technical scheme of the embodiment of the present application implements the reference count mechanism for the metadata in the data dictionary. However, in the case that the reference count of the stored metadata is reduced to zero and the memory of the data dictionary is sufficient, the stored metadata with the reference count of zero is not deleted, but is temporarily retained in the data dictionary, so as to reduce the scanning time of the database system and the memory application time of the data dictionary in the subsequent access to the same stored metadata, effectively shorten the response time of the data dictionary, improve the access efficiency of the data dictionary, avoid the waste of the memory resources of the data dictionary, and improve the resource utilization rate of the data dictionary.

[0040] Embodiment two

[0041] Figure 2 A flowchart of a data dictionary management method of a database provided by the embodiment two of the present application is provided. The embodiment of the present application is further specified on the basis of the above-mentioned embodiment. The embodiment can be applied to the data dictionary management of a database. The method can be executed by a data dictionary management device of a database. The data dictionary management device of the database can be realized in the form of hardware and / or software. The data dictionary management device of the database can be configured in any electronic device with network communication and calculation. As shown in the figure, the method comprises the following steps. Figure 2

[0042] S210, in the case that the stored metadata does not match the target metadata in the retrieved data dictionary, detecting whether the memory of the data dictionary meets the storage condition of storing the target metadata.

[0043] In the embodiment, the target metadata is used to represent the metadata associated with the to-be-accessed data in the database. The target metadata records the structure and attribute information of the to-be-accessed data.

[0044] It should be noted that, in the access process of the to-be-accessed data in the database, if the stored metadata does not match the target metadata in the retrieved data dictionary, it indicates that the target metadata associated with the to-be-accessed data is not created in the data dictionary.

[0045] ​Further, in the process of accessing the data to be accessed in the database, if it is determined that the target metadata associated with the data to be accessed does not exist in the data dictionary, the target metadata needs to be saved to the data dictionary, so as to access the data to be accessed through the data dictionary.

[0046] Further, after determining the need to save the target metadata to the data dictionary, whether the memory of the data dictionary meets the storage condition of storing the target metadata can be determined by comparing the remaining memory space in the data dictionary with the required memory required for storing the target metadata.

[0047] In the embodiment, whether the memory of the data dictionary meets the storage condition of storing the target metadata is detected, so as to cope with different operations on the data dictionary in the process of data access.

[0048] As an optional but not limited implementation, in the case that it is searched that the stored metadata in the data dictionary does not match the target metadata, whether the memory of the data dictionary meets the storage condition of storing the target metadata includes but is not limited to the following steps:

[0049] In the case that it is searched that the stored metadata in the data dictionary does not match the target metadata, the required memory required for storing the target metadata is determined, the required memory is added to the memory occupied by the stored metadata in the data dictionary to obtain a first memory, and the first memory is compared with a second memory, the second memory being a preset memory threshold of the data dictionary.

[0050] In the embodiment, the first memory is used to represent the updated occupied memory after the target metadata is stored in the data dictionary, that is, the latest occupied memory of the stored metadata in the data dictionary. The second memory is a preset memory threshold of the data dictionary, and the second memory can be understood as the maximum memory of the data dictionary.

[0051] The database uses dynamic memory in the data dictionary management process of the database. A memory block linked list of various sizes is recorded. When the occupied space of the data dictionary is obtained, the memory block linked list needs to be traversed to calculate the occupied memory of the data dictionary, and when the method is frequently called, the access efficiency of the data dictionary is reduced.

[0052] In the scheme, in order to improve the efficiency of obtaining the occupied memory of the data dictionary, an occupied memory field is added to the structure of the data dictionary, the occupied memory field is used to record the occupied memory of the stored data in the data dictionary, and the occupied memory of the data dictionary can be directly obtained by reading the occupied memory field, so as to quickly check whether the memory occupied by the data dictionary needs to be released. The traversal process of each memory block linked list and the numerical calculation process are avoided, and the access efficiency of the data dictionary is improved.

[0053] It should be noted that, in the process of accessing the data to be accessed in the database, if it is determined that the target metadata associated with the data to be accessed does not exist in the data dictionary, it is further determined whether the memory of the data dictionary meets the storage condition for storing the target metadata, so as to store the target metadata.

[0054] Specifically, the required memory required for storing the target metadata in the data dictionary is determined first, and then the memory occupied by the stored metadata in the data dictionary is quickly obtained through the occupied memory field. The required memory required for storing the target metadata in the data dictionary is accumulated on the basis of the memory occupied by the stored metadata in the data dictionary, to obtain the first memory.

[0055] In the scheme of the present application, a parameter for representing the second memory can be configured in the database, and the second memory and the first memory are compared to detect whether the data dictionary needs to release the stored metadata.

[0056] S220, if yes, the target metadata is saved in the data dictionary as stored metadata.

[0057] In the embodiment, if it is further detected that the memory of the data dictionary can meet the storage condition for storing the target metadata, it can be indicated that the remaining memory space of the data dictionary is greater than the required memory required for storing the target metadata, and the occupied memory of the data dictionary does not need to be released. The target metadata can be directly stored and saved in the data dictionary. The saved target metadata is the stored metadata in the data dictionary.

[0058] As an optional but not limited implementation manner, if yes, the target metadata is saved in the data dictionary as stored metadata, comprising:

[0059] If it is determined that the first memory is less than the second memory, the target metadata is saved in the data dictionary.

[0060] In the embodiment, the memory of the data dictionary that can meet the storage condition for storing the target metadata can also be that the first memory is less than the second memory, and the required memory required for storing the target metadata in the data dictionary is accumulated on the basis of the memory occupied by the stored metadata in the data dictionary, which is less than the preset memory threshold of the data dictionary. It can be understood that the maximum memory of the data dictionary is greater than the occupied memory after the target metadata is saved in the data dictionary, and the target metadata can be directly saved in the data dictionary.

[0061] S230, if no, the occupied memory of the data dictionary is released, and then the target metadata is saved in the data dictionary as stored metadata.

[0062] If the memory of the data dictionary does not satisfy the storage condition for storing the target metadata, it indicates that the remaining memory space of the data dictionary is less than the required memory for storing the target metadata, and the occupied memory of the data dictionary needs to be released before the target metadata is stored.

[0063] As an optional but not limited implementation, if the condition is not satisfied, the target metadata is saved to the data dictionary as stored metadata after the occupied memory of the data dictionary is released, and the steps include but are not limited to the following steps:

[0064] If it is determined that the first memory is greater than or equal to the second memory, it is determined that the occupied memory of the data dictionary needs to be released; the to-be-released metadata is determined from the stored metadata of the data dictionary, the to-be-released metadata is released, and the target metadata is saved to the data dictionary.

[0065] In this embodiment, the to-be-released metadata is the metadata to be released from the data dictionary, which is used to release the occupied memory of the stored data of the data dictionary and expand the remaining memory space of the data dictionary.

[0066] It should be noted that the memory of the data dictionary does not satisfy the storage condition for storing the target metadata, which can also be that the first memory is greater than or equal to the second memory, and the required memory of the target metadata stored in the data dictionary is accumulated on the basis of the occupied memory of the stored metadata in the data dictionary, which is greater than or equal to the preset memory threshold of the data dictionary. It can be understood that the maximum memory of the data dictionary is less than the occupied memory after the target metadata is saved to the data dictionary, and the occupied memory of the data dictionary needs to be released before the target metadata is saved to the data dictionary.

[0067] Further, in the case where it is determined that the occupied memory of the data dictionary needs to be released, the to-be-released metadata is determined from the stored metadata of the data dictionary, and the to-be-released metadata is released to provide more memory for saving the target metadata to the data dictionary.

[0068] In actual application, the data elimination strategy can be set according to the data size, reference count or access frequency of the stored metadata, and the to-be-released data is determined according to the data elimination strategy, and the occupied memory of the to-be-released metadata is released. The elimination strategy can be understood as a rule or logic for determining the to-be-released metadata according to a set rule.

[0069] In this embodiment, the to-be-released metadata is determined from the stored metadata of the data dictionary, and the to-be-released metadata is released to save the target metadata to the data dictionary, thereby avoiding memory leakage of the data dictionary.

[0070] As an optional but non-limiting implementation, determining the to-be-released metadata from the stored metadata of the data dictionary includes but is not limited to the following steps:

[0071] Traversing the reference count of the stored metadata from the tail of the double-linked list of the data dictionary; if it is determined that the reference count is the first data, the stored metadata corresponding to the first data is taken as the to-be-released data;

[0072] The method further includes:

[0073] If it is determined that the reference count is the second data, the stored metadata corresponding to the second data is moved to the head of the double-linked list; the reference count of the first data is 0, and the reference count of the second data is non-0.

[0074] In the embodiment, the first data is metadata with a reference count of 0, and the second data is metadata with a reference count of non-0.

[0075] It should be noted that when the reference count of the stored metadata in the data dictionary is 0, it indicates that the current session does not reference the metadata, and the metadata can be deleted from the data dictionary.

[0076] Specifically, the to-be-released metadata is found by traversing from the tail of the double-linked list of the data dictionary, when the first data of the data dictionary is queried, the corresponding first data is deleted from the double-linked list, and the memory occupied by the first data is released from the memory, when the second data of the data dictionary is queried, the corresponding second data is moved to the head of the double-linked list, so that the metadata with low access frequency is kept at the tail of the list, and the determination efficiency of the to-be-released metadata is improved.

[0077] The embodiment preferentially retains the metadata with high access frequency, so that the limited memory of the data dictionary is used to the maximum extent, and the access efficiency of the data dictionary is improved.

[0078] As an optional but non-limiting implementation, the method further includes but is not limited to the following steps:

[0079] If the target metadata is saved to the data dictionary, the required memory for saving the target metadata is accumulated on the basis of the memory occupied by the stored metadata in the data dictionary before the target metadata is saved, so as to update the memory occupied by the stored metadata; if there is a demand for releasing the memory occupied by the data dictionary and the to-be-released metadata is released, the memory occupied by the to-be-released metadata is subtracted from the memory occupied by the stored metadata in the data dictionary, so as to update the memory occupied by the stored metadata.

[0080] It should be noted that the storage process of the target metadata and the release process of the metadata to be released in the embodiment are both accompanied by a dynamic updating process of the memory occupied by the stored data in the data dictionary.

[0081] Specifically, in the storage process of the target metadata, after the target metadata is saved to the data dictionary, the required memory for saving the target metadata is accumulated on the basis of the memory occupied by the stored metadata in the data dictionary before the target metadata is saved, so as to update the memory occupied by the stored metadata.

[0082] Specifically, in the release process of the metadata to be released, after the metadata to be released is released, the memory occupied by the metadata to be released is subtracted from the memory occupied by the stored metadata in the data dictionary, so as to update the memory occupied by the stored metadata.

[0083] Referring to Figure 3 As shown in the flowchart of saving the target metadata to the data dictionary, in the case where it is determined that the stored metadata in the data dictionary does not match the target metadata, the target metadata is prepared to be inserted into the data dictionary, the required memory for storing the target metadata is accumulated with the memory occupied by the stored metadata in the data dictionary, to obtain the accumulated memory, then it is detected whether the accumulated memory exceeds the maximum memory of the data dictionary, if the accumulated memory does not exceed the maximum memory, the target metadata is stored to the data dictionary. Otherwise, if the accumulated memory exceeds the maximum memory, the memory needs to be released. Further, the metadata with the reference count of 0 is determined to be the metadata to be released and is released by sequentially traversing from the tail of the double-linked list, and the metadata with the reference count not being 0 is moved to the head of the double-linked list. Then, after the occupied memory release operation of the data dictionary is performed, the target metadata is stored to the data dictionary.

[0084] In the embodiment, by performing the dynamic updating of the memory occupied by the stored data in the data dictionary in the storage process of the target metadata and the release process of the metadata to be released, the occupied memory of the data dictionary can be accurately managed, which helps to improve the resource utilization rate of the data dictionary and avoid memory overflow. The memory occupied by the stored data can be determined in real time and numerical calculation, metadata storage or metadata release are performed, so as to improve the access efficiency of the data dictionary.

[0085] The technical scheme of the embodiment of the present application further detects whether the memory of the data dictionary meets the storage condition of storing the target metadata in the case that it is determined that the stored metadata does not match the target metadata in the data dictionary. If the memory of the data dictionary meets the storage condition of storing the target metadata, it indicates that the remaining memory space of the data dictionary is greater than the required memory for storing the target metadata, and the occupied memory of the data dictionary does not need to be released, and the target metadata can be directly stored in the data dictionary. If the memory of the data dictionary does not meet the storage condition of storing the target metadata, it indicates that the remaining memory space of the data dictionary is less than the required memory for storing the target metadata, and the occupied memory of the data dictionary needs to be released before the target metadata is stored. Through the technical scheme of the embodiment, the mechanism of not deleting the stored metadata with zero reference count is coped with, and the data storage of the target metadata is realized according to different situations, and the access efficiency of the data dictionary is improved.

[0086] Embodiment three

[0087] Figure 4 A structural schematic diagram of a database data dictionary management device provided by the embodiment of the present application. The embodiment can be applied to the data dictionary management of a database. The database data dictionary management device can be realized in the form of hardware and / or software, and can be configured in any electronic device with network communication and calculation. As shown in the figure, the device comprises: Figure 4

[0088] A count modification module, configured to increase the reference count of the stored metadata in the data dictionary by a preset value if the stored metadata is indexed, and decrease the reference count of the stored metadata by the preset value if the indexing of the stored metadata is ended.

[0089] A data retention module, configured to retain the stored metadata in the data dictionary if the reference count of the stored metadata is reduced to zero and there is no need to release the occupied memory of the data dictionary.

[0090] As an optional but not limited implementation manner, the method further comprises:

[0091] In the case that it is detected that the stored metadata does not match the target metadata in the data dictionary, it is detected whether the memory of the data dictionary meets the storage condition of storing the target metadata.

[0092] If yes, the target metadata is saved in the data dictionary as the stored metadata.

[0093] ​If not, the target metadata is saved to the data dictionary as stored metadata after releasing the occupied memory of the data dictionary.

[0094] As an optional but non-limiting implementation, in the case that the stored metadata matching the target metadata does not exist in the data dictionary, it is determined whether the memory of the data dictionary meets the storage condition for storing the target metadata, including:

[0095] In the case that the stored metadata matching the target metadata does not exist in the data dictionary, the required memory for storing the target metadata is determined;

[0096] The required memory is accumulated on the basis of the occupied memory of the stored metadata in the data dictionary to obtain a first memory;

[0097] The first memory is compared with a second memory; the second memory is a preset memory threshold of the data dictionary.

[0098] As an optional but non-limiting implementation, if yes, the target metadata is saved to the data dictionary as stored metadata, including:

[0099] If it is determined that the first memory is less than the second memory, the target metadata is saved to the data dictionary.

[0100] As an optional but non-limiting implementation, if not, the target metadata is saved to the data dictionary as stored metadata after releasing the occupied memory of the data dictionary, further including:

[0101] If it is determined that the first memory is greater than or equal to the second memory, it is determined that there is a need to release the occupied memory of the data dictionary;

[0102] The to-be-released metadata is determined from the stored metadata of the data dictionary, the to-be-released metadata is released, and the target metadata is saved to the data dictionary.

[0103] As an optional but non-limiting implementation, the to-be-released metadata is determined from the stored metadata of the data dictionary, including:

[0104] The reference count of the stored metadata is traversed in sequence from the tail of the double-linked list of the data dictionary;

[0105] If it is determined that the reference count is first data, the stored metadata corresponding to the first data is taken as to-be-released data;

[0106] The method further includes:

[0107] If the reference count is determined as the second data, the stored metadata corresponding to the second data is moved to the head of the double-linked list; the reference count of the first data is 0, and the reference count of the second data is non-0.

[0108] As an optional but non-limiting implementation, the method further comprises:

[0109] If the target metadata is saved into the data dictionary, the required memory for saving the target metadata is accumulated on the basis of the memory occupied by the stored metadata in the data dictionary before the target metadata is saved, so as to update the memory occupied by the stored metadata.

[0110] If there is a demand for releasing the memory occupied by the data dictionary and the to-be-released metadata is released, the memory occupied by the to-be-released metadata is subtracted from the memory occupied by the stored metadata in the data dictionary, so as to update the memory occupied by the stored metadata.

[0111] The embodiment of the application discloses a data dictionary management method of a database, which comprises: for stored metadata in a data dictionary, if indexing based on the stored metadata is performed, increasing a reference count of the stored metadata by a preset value, if the indexing based on the stored metadata is ended, decreasing the reference count of the stored metadata by the preset value, and if the reference count of the stored metadata is decreased to zero and there is no demand for releasing the memory occupied by the data dictionary, retaining the stored metadata in the data dictionary. The technical scheme of the embodiment of the application implements the reference count mechanism for the metadata in the data dictionary, but in the case that the reference count of the stored metadata is decreased to zero and the memory of the data dictionary is sufficient, the stored metadata with the reference count of zero is not deleted, but is temporarily retained in the data dictionary, so as to reduce the scanning time of the database system and the memory application time of the data dictionary in the subsequent access to the same stored metadata, effectively shorten the response time of the data dictionary, improve the access efficiency of the data dictionary, avoid the waste of the memory resources of the data dictionary, and improve the resource utilization rate of the data dictionary.

[0112] The data dictionary management device of the database provided in the embodiment of the application can execute the data dictionary management method of the database provided in any embodiment of the application, and has the corresponding function modules and beneficial effects of the execution method.

[0113] Embodiment four

[0114] Figure 5A structural diagram of an electronic device 10 that can be used to implement embodiments of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular telephones, smartphones, wearable devices (e.g., headsets, glasses, watches, etc.), and other similar computing devices. The components shown here, their connections and relationships, and their functions, are meant to be examples only, and are not intended to limit the implementations of the present application described and / or claimed in this document.

[0115] As shown in Figure 5 The electronic device 10 includes at least one processor 11, and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., connected in communication with the at least one processor 11, where the memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer programs stored in the read-only memory (ROM) 12 or loaded from the storage unit 18 into the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0116] Various components in the electronic device 10 are connected to the I / O interface 15, including an input unit 16, such as a keyboard, a mouse, etc., an output unit 17, such as various types of displays, a speaker, etc., a storage unit 18, such as a magnetic disk, an optical disk, etc., and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.

[0117] The processor 11 can be various general and / or special purpose processing components with processing and computing capabilities. Some examples of the 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 appropriate processor, controller, microcontroller, etc. The processor 11 performs various methods and processes described above, such as the data dictionary management method of the database.

[0118] In some embodiments, the data dictionary management method of a database can be implemented as a computer program tangibly embodied in a computer readable storage medium, such as storage unit 18. In some embodiments, portions or all of the computer program can be loaded onto the electronic device 10 via, e.g., ROM 12 and / or communication unit 19. When the computer program is loaded onto RAM 13 and executed by processor 11, one or more steps of the data dictionary management method of a database described above can be performed. Alternatively, in other embodiments, processor 11 can be configured to perform the data dictionary management method of a database by any other suitable means, e.g., by means of firmware.

[0119] In particular, the processes described above with reference to the flowcharts can be implemented as a computer software program according to embodiments of the present application. For example, embodiments of the present application include a computer program product comprising a computer program tangibly embodied on a non-transitory computer readable medium, the computer program containing program code for executing the methods illustrated by the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication unit 19, or installed from storage unit 18, or installed from ROM 12. When the computer program is executed by processor 11, the above-described functions defined in the methods of embodiments of the present application are performed.

[0120] Various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a complex programmable logic device (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.

[0121] Computer programs for implementing the methods of the present application can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer program, when executed, enables the functions / acts specified in the flowcharts and / or block diagrams to be implemented. The computer program can be executed entirely on a machine, partially on a machine, partially on a machine as a standalone software package and partially on a remote machine or entirely on a remote machine or server.

[0122] In the context of the present application, a computer-readable storage medium can be a tangible medium that can contain or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. A computer-readable storage medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of a machine-readable storage medium will include one or more lines of a program of instructions in a transitory signal, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0123] To provide for interaction with a user, the systems and techniques described here 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 a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the electronic device. Other kinds of devices can be used to provide for interaction with a user as well; 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 acoustic, speech, or tactile input.

[0124] The systems and techniques described herein can be implemented in a computing system that includes a back end component, e.g., as a data server, or that includes a middleware component, e.g., an application server, or that includes a front end component, e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described herein, or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication, e.g., a communication network. Examples of communication networks include a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0125] The computing system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. A server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system, to solve the defects of large management difficulty and weak business scalability in traditional physical host and VPS service.

[0126] It should be understood that the various forms of flow shown above can be re-ordered, added to, or deleted from without departing from the scope of the present disclosure. For example, the steps recited in the present disclosure can be executed in parallel, executed in sequence, or executed in different orders, as long as the desired results of the technical solutions of the present disclosure can be achieved, and the present disclosure is not limited herein.

[0127] The specific embodiments described above are not intended to limit the scope of the present disclosure. 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 modification, equivalent replacement, and improvement within the spirit and principles of the present disclosure should be included in the scope of the present disclosure.

Claims

1. A data dictionary management method of a database, characterized by, The method comprises the following steps: If the stored metadata in the data dictionary is indexed based on the stored metadata, the reference count of the stored metadata is increased by a preset value, and if the indexing based on the stored metadata is ended, the reference count of the stored metadata is decreased by the preset value; If the reference count of the stored metadata is reduced to zero and there is no need to release the occupied memory of the data dictionary, the stored metadata is retained in the data dictionary; The method further comprises the following steps: If the stored metadata in the data dictionary does not match the target metadata, it is detected whether the memory of the data dictionary meets the storage condition of storing the target metadata; If yes, the target metadata is saved in the data dictionary as stored metadata; If no, the occupied memory of the data dictionary is released, and then the target metadata is saved in the data dictionary as stored metadata; If the stored metadata in the data dictionary does not match the target metadata, it is detected whether the memory of the data dictionary meets the storage condition of storing the target metadata, which comprises the following steps: If the stored metadata in the data dictionary does not match the target metadata, the required memory for storing the target metadata is determined; The required memory is added to the occupied memory of the stored metadata in the data dictionary to obtain first memory; The first memory is compared with second memory, and the second memory is a preset memory threshold of the data dictionary; If no, the occupied memory of the data dictionary is released, and then the target metadata is saved in the data dictionary as stored metadata, and the method further comprises the following steps: If it is determined that the first memory is greater than or equal to the second memory, it is determined that there is a need to release the occupied memory of the data dictionary; The target metadata is saved in the data dictionary after determining the to-be-released metadata from the stored metadata in the data dictionary and releasing the to-be-released metadata; The to-be-released metadata is determined from the stored metadata in the data dictionary, which comprises the following steps: The reference count of the stored metadata is traversed from the tail of the double-linked list of the data dictionary; If it is determined that the reference count is first data, the stored metadata corresponding to the first data is taken as to-be-released data; The method further comprises the following steps: If it is determined that the reference count is second data, the stored metadata corresponding to the second data is moved to the head of the double-linked list; the reference count of the first data is 0, and the reference count of the second data is non-0.

2. The method of claim 1, wherein, If yes, the target metadata is saved in the data dictionary as stored metadata, which comprises the following steps: If it is determined that the first memory is less than the second memory, the target metadata is saved in the data dictionary.

3. The method according to any of claims 1-2, characterized in that, The method further comprises the following steps: If the target metadata is saved in the data dictionary, the required memory for saving the target metadata is added to the occupied memory of the stored metadata in the data dictionary before the target metadata is saved in the data dictionary, so as to update the occupied memory of the stored metadata. If there is a demand for releasing the memory occupied by the data dictionary and the metadata to be released is released, the stored metadata memory occupied by the data dictionary is updated by subtracting the memory occupied by the metadata to be released from the stored metadata memory occupied by the data dictionary.

4. A data dictionary management apparatus of a database, characterized by comprising: The method comprises the following steps: The count modification module is configured to increase the reference count of the stored metadata in the data dictionary by a preset value if the stored metadata is indexed, and decrease the reference count of the stored metadata by the preset value if the indexing of the stored metadata ends; The data retention module is configured to retain the stored metadata in the data dictionary if the reference count of the stored metadata is reduced to zero and there is no demand for releasing the memory occupied by the data dictionary. The device further comprises: If it is determined that the stored metadata does not match the target metadata in the data dictionary, it is determined whether the memory of the data dictionary meets the storage condition for storing the target metadata; If yes, the target metadata is saved into the data dictionary as stored metadata; If no, the memory occupied by the data dictionary is released, and then the target metadata is saved into the data dictionary as stored metadata; If it is determined that the stored metadata does not match the target metadata in the data dictionary, the demand memory required for storing the target metadata is determined; The demand memory is added to the stored metadata memory of the data dictionary to obtain first memory; The first memory is compared with second memory, which is a preset memory threshold of the data dictionary; If no, the memory occupied by the data dictionary is released, and then the target metadata is saved into the data dictionary as stored metadata, and the device further comprises: If it is determined that the first memory is greater than or equal to the second memory, it is determined that there is a demand for releasing the memory occupied by the data dictionary; The metadata to be released is determined from the stored metadata of the data dictionary, the metadata to be released is released, and the target metadata is saved into the data dictionary; The metadata to be released is determined from the stored metadata of the data dictionary, and the device further comprises: The reference count of the stored metadata is traversed from the tail of the double-linked list of the data dictionary; If it is determined that the reference count is first data, the stored metadata corresponding to the first data is determined as metadata to be released; If it is determined that the reference count is second data, the stored metadata corresponding to the second data is moved to the head of the double-linked list; the reference count of the first data is 0, and the reference count of the second data is non-0. The processor executes the program to implement the database data dictionary management method according to any one of claims 1-3. The processor executes the program to implement the database data dictionary management method according to any one of claims 1-3.

5. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, ​ 6. A storage medium storing computer-executable instructions, wherein: The computer executable instructions, when executed by the computer processor, serve to perform the data dictionary management method of the database as claimed in any one of claims 1-3.

Citation Information

Patent Citations

  • Metadata access method and device, equipment and storage medium

    CN116821058A