Partition table primary key indexing method and system supporting secondary positioning

Through the partition table keyword ID bitwise division and jump positioning technology, the problem of low retrieval efficiency of traditional partition table primary key index under large data volume is solved, efficient keyword query is realized, and real-time needs of the power scheduling system are met.

CN120371832APending Publication Date: 2025-07-25STATE GRID ELECTRIC POWER RES INST +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510424292.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-07
Publication Date
2025-07-25

AI Technical Summary

Technical Problem

The retrieval efficiency of the primary key index of the traditional partition table is significantly reduced under the large amount of data, and cannot meet the sub-second response requirements of the power scheduling system, especially in key scenarios such as fault processing and load analysis.

Method used

The partition table keyword ID is divided into table number, field number, area number and device number segments by bit, and quickly positioned through bit operation analysis, combined with the partition record array dynamically maintaining the number of records, and using the continuous distribution characteristics of the device number for jump positioning, narrowing the search range, and degrading into binary search when necessary, forming a hybrid query strategy.

Benefits of technology

It significantly reduces the number of primary key searches and improves the speed of keyword query. It is suitable for large-scale data scenarios with high-frequency updates, taking into account efficiency and robustness, and meeting the real-time needs of the power scheduling system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120371832A_ABST
    Figure CN120371832A_ABST
Patent Text Reader

Abstract

The invention discloses a partition table primary key indexing method and system supporting secondary positioning, and the method comprises the steps: dividing a keyword ID of a partition table into a table number section, a field number section, a region number section and an equipment number section according to bits, and analyzing each field through bit operation; establishing a partition record array to dynamically maintain a regional record number; calculating and recording starting and ending positions according to the area number of the query keyword ID, and narrowing the search range; carrying out jump positioning through difference offset by utilizing the linear characteristic of the equipment number in the range; if not, adjusting the position or degenerating to binary search; according to the method, through the partition secondary positioning and jump retrieval technology, the primary key retrieval frequency is remarkably reduced, and the real-time library query efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of database technology applications, and particularly relates to a partitioned table primary key index method and system supporting secondary positioning. Background Art

[0002] In the power dispatching automation system, the provincial / regional and regional / county integrated architecture has become the mainstream trend to achieve centralized monitoring and management of cross-regional power grid data. With the rapid development of smart grids, the amount of device data that the real-time database needs to process has increased exponentially, covering multi-dimensional information of various devices such as transformers, circuit breakers, and lines. The industry generally faces challenges in storing and efficiently retrieving massive real-time data. Especially in key scenarios such as fault handling and load analysis, the real-time requirement for data access is extremely high, and the traditional data management method has been difficult to meet the business needs.

[0003] In the current system, the partitioned table primary key index usually adopts a global index or a local index structure and relies on the binary search algorithm to achieve fast retrieval. The global index covers all table data through a single B-tree or hash table, while the local index establishes an independent index for each partition.

[0004] However, the efficiency of the primary key index of binary search decreases significantly with the increase in the amount of data. When the data in a single partition exceeds one million, the depth of the index level increases sharply, resulting in an increase in query latency and being unable to meet the real-time requirement of sub-second response in the dispatching system. Summary of the Invention

[0005] Object of the Invention: The object of the present invention is to provide a partitioned table primary key index method supporting secondary positioning that can reduce the number of retrievals and improve the keyword query speed; on the other hand, to provide a partitioned table primary key index system supporting secondary positioning.

[0006] Technical Solution: A partitioned table primary key index method supporting secondary positioning according to the present invention includes:

[0007] Dividing the keyword ID of the partitioned table into a table number section, a field number section, a region number section, and a device number section by bits, and configuring bit operation parsing rules corresponding to the table number section, the field number section, the region number section, and the device number section to achieve fast extraction of keyword fields, avoiding string parsing or complex calculations. At the same time, directly operating on binary data through bit operations, reducing memory occupancy and CPU overhead, and laying a foundation for subsequent partition positioning;

[0008] Establishing and maintaining a partition record array to dynamically record the number of records in each region, where the index of the array corresponds to the region number, and statistically analyzing the partition data distribution in real time to obtain the number of records in any region with an O(1) time complexity, providing an accurate basis for subsequent calculation of the storage range. At the same time, the array structure is simple and efficient, suitable for large-scale data scenarios with high-frequency updates;

[0009] The area number parsed according to the keyword ID to be queried. By accumulating the number of previous area records in the partition record array, calculate the starting and ending positions of the record storage in the current area, form a reduced search range, greatly narrow the search range, optimize the global query to a local area scan, avoid full table traversal, and is especially suitable for distributed or sharded database environments, reducing unnecessary I / O and computational consumption;

[0010] Within the said search range, calculate the numerical difference between the target keyword and the keyword at the starting position. Based on the continuous distribution characteristic of the device number, use the said difference as the offset to directly jump to the estimated position for positioning. It is a fast approximation with an approximate O(1) complexity. Compared with traditional traversal or index search, the number of comparisons is greatly reduced, and it is especially suitable for data storage where the primary key is ordered or approximately continuous (such as time series data, log records, etc.);

[0011] Compare the keyword at the estimated position with the target keyword. If they match, return the result. If they do not match, calculate the new difference between the keyword at the estimated position and the target keyword, and recalculate the offset according to the new difference for position adjustment, enhancing the fault tolerance of the positioning. Even when the data is locally discontinuous, it can still efficiently narrow the search range and improve the query success rate;

[0012] When the jump positioning fails to match after a preset number of times, enable the binary search algorithm for final positioning within the current search range to ensure accurate positioning with a time complexity of O(log n) in the worst case, forming a hybrid query strategy that combines fast approximation and stable retrieval, taking into account both efficiency and robustness.

[0013] Preferably, the keyword ID is a 64-bit long integer, where: the table number section occupies the high 16 bits and is used to store the sequence number of the table; the field number section occupies the middle 16 bits and is used to store the sequence number of the field; the area number section occupies the second lowest 8 bits and is used to store the partition number of the area where the device belongs; the device number section occupies the low 32 bits and is used to store the sequence number of the device; it realizes efficient multi-dimensional information encoding and storage. By the high 16-bit table number section, it clearly identifies the belonging of the data table, supporting the system to quickly locate the physical storage table; the middle 16-bit field number section accurately points to the fields in the table, realizing field-level data addressing; the 8-bit area number section provides geographical partition identification, facilitating regional data sharding management; the low 32-bit device number section can accommodate a large number of device identifiers, and a single partition can support the expansion of 4.2 billion-level devices. This structured bit field design embeds four-level addressing information of table, field, area, and device in a single long integer variable, which not only ensures the efficiency of data association query but also significantly reduces the storage overhead and index complexity through bit operations.

[0014] Preferably, the bit operation parsing rules include: the table number calculation method is keyword ID >> 48; the field number calculation method is keyword ID & 0x00FF; the area number calculation method is keyword ID >> 32 & 0x00FF; the device number calculation method is keyword ID & 0x0000FFFF, which can fully utilize the extremely fast performance of bit operations (only 1-3 CPU cycles per single operation), and at the same time rely on the atomic operations of masks and displacements to ensure thread safety, and is applicable to real-time data routing and index construction in high-concurrency scenarios.

[0015] Preferably, the maintenance partition record array includes:

[0016] When adding a new record, parse the area number of its keyword ID, increment the count value in the corresponding partition record array by 1, and keep the records inserted in an orderly manner according to the keyword ID;

[0017] When deleting a record, decrement the count value of the corresponding partition, and maintain the logical deletion status through marking to ensure the consistency between the partition record array and the physical storage.

[0018] Quickly locate the partition by the area number and increment or decrement the counter (O(1) complexity), and reflect the change of the partition data volume in real time; when adding a new record, store it in order according to the keyword ID, taking into account both the write performance and the subsequent range query efficiency; use marked deletion instead of physical removal to avoid the overhead of data relocation, and at the same time ensure transaction visibility control through the cooperation of the count value and the status mark (such as soft deletion bit or version number); through the joint maintenance of the counter and the logical status, the partition record array in memory is always synchronized with the persistent storage, providing an accurate basis for batch cleaning and compression operations. This design balances the performance and consistency requirements in high-frequency addition and deletion scenarios.

[0019] Preferably, calculating the starting position and ending position of the record storage in the current area includes: the starting position is equal to the total number of records in the previous n - 1 areas plus 1; the ending position is equal to the total number of records in the previous n areas; where n is the current area number; directly derive the physical offset range of the current partition by using the cumulative value of the counters in the previous n - 1 partitions, and the starting and ending positions can be determined in O(1) time without full-scale scanning. This method strictly follows the arithmetic relationship between the area number order and the counter, ensuring the continuous distribution of records in the same partition on physical storage, which not only improves the sequential read and write efficiency but also supports dynamic expansion - when adding a new partition, only need to append the counter to respond to the position change in real time. This design optimizes the traditional O(N) complexity position calculation to a constant level through a space-for-time strategy, while maintaining the compactness of the storage structure, and is especially suitable for large-scale data storage scenarios that require frequent partition queries and dynamic scaling.

[0020] Preferably, the calculation of the offset also includes boundary correction processing:

[0021] If the calculated offset exceeds the lower or upper bound of the current search range, the estimated position is forced to be corrected to the start or end position of the search range, which can prevent invalid memory access and ensure query stability;

[0022] When there is a discontinuous distribution in the device number section, the jump step is automatically adjusted to half of the difference to achieve progressive approximation, which not only avoids the inefficiency of linear scanning but also overcomes the strong dependence of traditional binary search on continuous distribution;

[0023] While ensuring a worst-case time complexity of O(log n), this composite algorithm significantly optimizes the query performance in non-ideal data distribution scenarios (such as the existence of holes or clusters), enabling the system to adaptively process various actual storage forms and effectively improving the robustness and efficiency of data search.

[0024] Preferably, the position adjustment by recalculating the offset according to the new difference includes: if the difference is positive, the target keyword is greater than the upper bound and the search fails, avoiding unnecessary scanning; if the difference is negative, the current candidate position + the difference is used as the new candidate position, and it jumps backward to the new candidate position, and then reads the keyword at this position to match with the target keyword again; this feedback adjustment mechanism based on numerical comparison optimizes the traditional sequential comparison into directional jumping, which can not only quickly jump out when the match fails (saving about 50% of invalid comparisons), but also achieve one-step position correction through the guidance of the difference when approaching the target, reducing the average search complexity from O(n) to nearly O(1), especially suitable for large-scale device number query scenarios with ordered but non-uniform distribution.

[0025] A partition table primary key index system supporting secondary positioning according to the present invention includes:

[0026] A keyword parsing module, configured to divide the keyword ID of the partition table into a table number section, a field number section, a region number section, and a device number section bit by bit, and configure bit operation parsing rules corresponding to the table number section, the field number section, the region number section, and the device number section;

[0027] A partition record management module, configured to establish and maintain a partition record array, dynamically record the record quantity of each region, and the index of the array corresponds to the region number;

[0028] A range positioning module, configured to calculate the start position and end position of the record storage in the current region by accumulating the record quantities of the previous regions in the partition record array according to the region number parsed from the keyword ID to be queried, and form a search range;

[0029] A jump search module, which is used to calculate the numerical difference between the target keyword and the keyword at the starting position within the search range, and based on the continuous distribution characteristic of the device number, directly jump to the estimated position with the difference as the offset;

[0030] A position adjustment module, which is used to compare the keyword at the estimated position with the target keyword. If they match, the result is returned. If they do not match, the new difference between the keyword at the estimated position and the target keyword is calculated, and the offset is recalculated according to the new difference for position adjustment;

[0031] A binary search module, which is used to enable the binary search algorithm for final positioning within the current search range when the jump positioning fails to match after a preset number of times.

[0032] Preferably, the partition table primary key index system further includes a query interface module, which is used to provide a primary key query interface. The input parameter of the interface is a 64-bit long integer keyword ID, and the output parameter is the corresponding record or field value. It supports single-record query, batch-record query, local library query, and remote library query. By providing multiple overloaded types, the technical effect of flexibly adapting to different application scenarios is achieved.

[0033] Preferably, the partition table primary key index system further includes:

[0034] A data storage module, which is used to store records in partition order to ensure the ordered distribution of keyword IDs;

[0035] A dynamic maintenance module, which is used to synchronously update the count value in the partition record array when adding or deleting records, and keep the physical storage and logical state of the records consistent.

[0036] A non-transitory computer-readable storage medium stores program codes of a power system data fusion processing method, wherein the program codes include instructions for executing the method according to any one of claims 1 to 7.

[0037] A computer device includes a memory and a processor, and a computer program capable of being loaded and executed by the processor for the above-mentioned virtual power plant flexible resource dynamic aggregation method is stored on the memory.

[0038] Advantageous effects: Compared with the prior art, the present invention has the following remarkable advantages: 1. By performing secondary positioning within the partition, the search times for retrieving the primary key of the real-time library partition table are reduced, and the keyword query speed is improved; 2. Provide interfaces with multiple overloaded types, which are suitable for the needs of various applications; 3. High portability, suitable for various operating system platforms. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 It is a flow schematic diagram of the present invention;

[0040] Figure 2 Schematic diagram of the partition table keyword ID composition of the present invention;

[0041] Figure 3 Schematic diagram of the partition table storage of the present invention;

[0042] Figure 4 Flowchart of the partition table primary key index of the present invention. Detailed implementation manners

[0043] The technical solution of the present invention will be further described below with reference to the accompanying drawings.

[0044] This embodiment provides a partition table primary key index method supporting secondary positioning. By managing the partition table keywords by section, secondary positioning within the partition is realized, and the upper and lower bounds of the search are narrowed; by calculating the offset of the target position from the starting position keyword for jump positioning, the number of binary search retrievals is reduced, and the keyword query speed is improved.

[0045] As Figure 1 shown, the steps of this method are as follows:

[0046] (1) Each partition table in the database defines a unique keyword ID number; each field in the table defines a field number; the keyword type of the partition table is a 64-bit long integer, which is divided into four parts: table number section, field number area, area number section, and device number section.

[0047] Figure 2 is the schematic diagram of the partition table keyword ID composition of the real-time library of the present invention. The table number section is the 49-64 bits of the keyword ID, storing the sequence number of the table; the field number area is the 33-48 bits of the keyword ID, storing the sequence number of the fields in the table; the area number section is the 25-32 bits of the keyword ID, storing the partition number of the area where the device belongs; the device number section is the 0-31 bits of the keyword ID, storing the sequence number of the device. The device sequence number increases continuously in the order of commissioning time, showing a nearly linear distribution. The parsing method for each section of the keyword ID of the partition table is: perform bit operations on the incoming keyword ID to obtain the values of different sections. The table number calculation method is keyword ID >> 48, the field number calculation method is keyword ID & 0x00FF, the area number calculation method is keyword ID >> 32 & 0x00FF, and the device number calculation method is keyword ID & 0x0000FFFF.

[0048] (2) Maintain an integer array in the partition table to record the number of records in each area (hereinafter referred to as the partition record array), and the array subscript is the area number. For each added record, increment the record count of the corresponding partition in the partition record array; for each deleted record, decrement the record count of the corresponding partition in the partition record array.

[0049] Figure 3 It is a schematic diagram of the storage of the real-time library partition table. Each partition table is divided into two parts: the metadata area and the data area. In addition to storing the basic information of the table and the basic information of the fields, the metadata area also stores the number of records in each area through an array of partition records; the data area stores the records of different areas, and these records are closely arranged in the order of the keyword ID. Since the records in the same area have the same area number, the records can be distributed in an orderly manner between different partitions and within the same partition in the order of the keyword ID. When inserting or deleting a record, the number of records in the corresponding partition in the partition record array will be increased or decreased synchronously.

[0050] (3) When performing a primary key retrieval on the partition table using the binary search method, first parse the area number n based on the keyword ID, and then calculate the sum m of the number of records in the first n areas by traversing the array of partition records. At this time, the starting position of the records in the (n + 1)-th area can be obtained as m + 1, and the ending position of the records is m + the number of records in the (n + 1)-th area. Finally, the calculated starting and ending positions are used as the upper and lower bounds as the new search range.

[0051] (4) When searching within the reduced search range, since the devices are stored in the order of the operation time when the device is put into operation and will be set to the retired state and no longer used when retired, they will not be easily deleted. Therefore, the device numbers in the partition table generally increase continuously, and their distribution is close to linear. The jump positioning can be performed by calculating the offset between the target position and the keyword of the starting position, so as to accelerate approaching the search position.

[0052] Specifically, based on the difference between the target keyword and the keyword of the starting position, estimate the initial candidate position: if the difference is 0, it is a direct hit; if the difference is negative, the target keyword is less than the lower bound keyword, and the search fails; if the difference is positive, the estimated initial position is the lower bound of the search range + the difference, and if the difference exceeds the boundary of the data set, it is corrected to the maximum upper limit position.

[0053] (5) Read the keyword at the estimated position and recalculate the difference with the target keyword. If the difference is zero, the target is hit; if the difference is positive, the target keyword is greater than the upper bound, and the search fails; if the difference is negative, use the current candidate position + the difference as the new candidate position, and jump backward to the new candidate position, and then read the keyword at this position and match it with the target keyword again.

[0054] (6) When the jump positioning fails to match successfully after the preset number of times, it degrades to the traditional binary search algorithm within the reduced interval.

[0055] Figure 4It is the primary key index flowchart of the method. According to the keyword ID to be queried, the corresponding area number n is parsed, and the upper and lower bounds of the record position of the area number n in the table are calculated; within the reduced upper bound range, first perform jump positioning by calculating the offset of the target position and the keyword at the starting position. If there is no match, then use the traditional binary search algorithm for positioning.

[0056] This example also provides a partitioned table primary key index system that supports secondary positioning. The system includes:

[0057] A keyword parsing module, which is used to divide the keyword ID of the partitioned table into a table number section, a field number section, an area number section, and a device number section by bit, and extract the values of each field based on the bit operation parsing rules;

[0058] A partition record management module, which is used to establish and maintain a partition record array, dynamically record the number of records in each area, and the index of the array corresponds to the area number;

[0059] A range positioning module, which is used to calculate the starting position and the ending position of the record storage in the current area by accumulating the number of records in the previous areas according to the area number parsed from the keyword ID to be queried, and form a reduced search range;

[0060] A jump retrieval module, which is used to calculate the numerical difference between the target keyword and the keyword at the starting position within the search range, and based on the continuous distribution characteristic of the device number, use the difference as an offset to directly jump to the estimated position for positioning;

[0061] A position adjustment module, which is used to compare the keyword at the estimated position with the target keyword. If they match, the result is returned. If they do not match, the offset is recalculated according to the new difference for position adjustment;

[0062] A binary search module, which is used to enable the binary search algorithm for final positioning within the current search range when the jump positioning fails after a preset number of times;

[0063] A data storage module, which is used to store records in partition order to ensure the ordered distribution of keyword IDs;

[0064] A dynamic maintenance module, which is used to synchronously update the count value in the partition record array when adding or deleting records, and keep the physical storage and the logical state of the records consistent;

[0065] The query interface module is used to provide a primary key query interface. The input parameter of the interface is a 64-bit long integer keyword ID, and the output parameter is the corresponding record or field value. It has multiple overloaded forms, supporting the query and retrieval of complete records, as well as the query and retrieval of specified fields; supporting the query and retrieval of a single record, as well as the query and retrieval of multiple records; supporting the query and value retrieval from the local real-time library by keyword, and also supporting the query and value retrieval from the specified network real-time library by keyword.

[0066] To better illustrate the present invention, the following is explained with a specific example.

[0067] There is a partitioned table in the database: the telemetry definition table, which is used to store telemetry definition information of different regions. Its structure is: table number 431, there are 100 regions, and 10,000 records are stored in each region. Therefore, this table has a total of 1 million records. The first record is the first record of region 1, and the last record is the last record of region 100. Its record distribution is as follows:

[0068] ID Telemetry Name …… 121315714979069953 Area 1 - Telemetry Point No. 1 …… …… 121315714979079952 Area 1 - Telemetry Point No. 10000 121315714995847169 Area 2 - Telemetry Point No. 1 …… …… 121315714995857168 Area 2 - Telemetry Point No. 10000 …… …… 121315715801153537 Area 50 - Telemetry Point No. 1 …… …… 121315715801154536 Area 50 - Telemetry Point No. 1000 …… …… 121315715801163536 Area 50 - Telemetry Point No. 10000 …… …… 121315716640014337 Area 100 - Telemetry Point No. 1 …… …… 121315716640024336 Area 100 - Telemetry Point No. 10000

[0069] If querying for the record with keyword ID 121315715801154536, first parse the section of this record keyword ID through bitwise operation as: table number 431, field number 0, region number 50, device number 1000. Then traverse the partition record array in the metadata area of the telemetry definition table, and calculate that the number of records in regions 1 - 49 is 490,000. Therefore, the storage position of the first record in region 50 in the table is 490,001, and the storage position of the last record in region 50 in the table is 500,000. That is, using 490,001 and 500,000 as the upper and lower bounds respectively, search for the record with device ID 491,000.

[0070] (1) Assume that the device records in partition 50 have not been deleted after being put into operation. Therefore, the device IDs in this partition increase continuously with a step size of 1. Its distribution is as follows:

[0071]

[0072] At this time, the difference between the target keyword 491,000 and the starting position keyword 490,001 is 999. Therefore, the estimated initial candidate position is the lower bound of the search range + the difference, that is, 490,001 + 999 = 491,000, and the difference from the target value keyword position is 0, so it hits directly. At this time, the time complexity of the query is O(1).

[0073] (2) Assume that after the first 1000 devices in partition 50 are put into operation, some records are accidentally deleted. Therefore, although the device IDs in this partition increase with a step size of 1, some device IDs are not continuous. Its distribution is as follows:

[0074]

[0075] At this time, the difference between the target keyword 491000 and the starting position keyword 490001 is 999. Since 3 values are missing in this interval, the estimated actual value of the initial candidate position is 491003. Therefore, the difference between the initial candidate position and the target keyword position is recalculated as 491000 - 49103 = -3. Since the difference is negative, the current candidate position plus the difference is used as the offset of the new candidate position, that is, 999 - 3 = 996. And the value 490996 at this position is read, which does not match the target keyword 491000. Therefore, it degrades to use the traditional binary search in partition No. 50. Since the search range is reduced, the number of queries is log210000 ≈ 14 times.

[0076] The maximum time complexity of the traditional binary search is O(logn). When directly performing binary search within the entire partition table range, the number of queries to retrieve the keyword ID 121315715801154536 is log21000000 ≈ 20 times.

[0077] It can be seen that compared with performing binary search on the entire partition table, by reducing the upper and lower bounds of the binary search through secondary positioning and calculating the offset between the target position and the starting position keyword for jump positioning, the number of queries is significantly reduced and the query speed is improved.

[0078] The present invention is implemented in combination with a self-developed real-time library operating at the application layer, does not depend on a specific operating system, and is applicable to various operating systems. The real-time library partition table primary key index method supporting secondary positioning involved in the present invention ensures portability and can operate safely and stably with the real-time library system on operating system platforms such as IBM AIX, Sun Solaris, AlphaTru64, HPUX, Linux, Windows, etc.; the system programming languages adopt ANSI C / C++, JAVA, and comply with the IEEE POSIX.2 standard.

[0079] The embodiment of the present invention also discloses a computer-readable storage medium.

[0080] Specifically, the computer-readable storage medium is used to store a computer program. When the computer program is executed by a processor, the methods in the above method embodiments are implemented. Those skilled in the art can understand that to implement all or part of the processes in the above method embodiments of the present application, it can be completed by instructing relevant hardware through a computer program. This program can be stored in a computer-readable storage medium. When this program is executed, it can include the processes of the above method embodiments. Among them, the storage medium can be a magnetic disk, an optical disc, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk drive (HDD), or a solid-state drive (SSD), etc.; the storage medium can also include a combination of the above types of memories.

[0081] An embodiment of the present invention also discloses a computer device.

[0082] Specifically, the computer device can be a desktop computer, a laptop computer, a handheld computer, a cloud server, or other computer devices. The computer device can include, but is not limited to, a processor and a memory. Among them, the processor and the memory can be connected through a bus or other means. Among them, the processor can be a central processing unit (CPU). The processor can also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, graphics processing units (GPUs), embedded neural network processors (NPUs), or other dedicated deep learning coprocessors, discrete gate or transistor logic devices, discrete hardware components, etc. chips, or a combination of the above types of chips.

[0083] As a non-transitory computer-readable storage medium, the memory can be used to store non-transitory software programs, non-transitory computer-executable programs, and modules, such as the program instructions / modules corresponding to the methods in the above embodiments of the present application. By running the non-transitory software programs, instructions, and modules stored in the memory, the processor can execute various functional applications and data processing of the processor, that is, implement the methods in the above method embodiments. The memory may include a program storage area and a data storage area. Among them, the program storage area can store control units and application programs required for at least one function; the data storage area can store data created by the processor and the like. In addition, the memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state storage devices. In some embodiments, the memory may optionally include memories remotely disposed relative to the processor, and these remote memories can be connected to the processor through a network. Examples of the above networks include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

Claims

1. A method for partitioning table primary key index supporting secondary positioning, characterized in that including: Dividing the keyword ID of the partition table bit by bit into a table number section, a field number section, a region number section, and a device number section, and configuring bit operation parsing rules corresponding to the table number section, the field number section, the region number section, and the device number section; Establishing and maintaining a partition record array to dynamically record the number of records in each region, where the index of the array corresponds to the region number; Based on the region number parsed from the keyword ID to be queried, calculating the starting position and ending position of the record storage in the current region by accumulating the number of records in the previous regions in the partition record array, forming a search range; Within the search range, calculating the numerical difference between the target keyword and the keyword at the starting position, and using the difference as an offset to jump to the estimated position; Comparing the keyword at the estimated position with the target keyword. If they match, return the result. If they don't match, calculate the new difference between the keyword at the estimated position and the target keyword, and recalculate the offset according to the new difference to adjust the position; When the jump positioning fails to match successfully after a preset number of times, enable the binary search algorithm for final positioning within the current search range.

2. The partition table primary key index method according to claim 1, wherein The keyword ID is a 64-bit long integer, where: the table number section occupies the high 16 bits and is used to store the sequence number of the table; the field number section occupies the middle 16 bits and is used to store the sequence number of the field; the region number section occupies the second lowest 8 bits and is used to store the partition number of the area where the device belongs; the device number section occupies the low 32 bits and is used to store the sequence number of the device.

3. The partition table primary key index method according to claim 1, wherein The bit operation parsing rules include: the table number calculation method is keyword ID >> 48; the field number calculation method is keyword ID & 0x00FF; the region number calculation method is keyword ID >> 32 & 0x00FF; the device number calculation method is keyword ID & 0x0000FFFF.

4. The partition table primary key indexing method according to claim 1, characterized in that, The maintaining the partition record array includes: When a new record is added, parsing the region number of its keyword ID, incrementing the count value in the corresponding partition record array by 1, and keeping the records inserted in order according to the keyword ID; When a record is deleted, decrementing the count value of the corresponding partition, and maintaining the logical deletion status by marking to ensure the consistency between the partition record array and the physical storage.

5. The partition table primary key index method according to claim 1, characterized in that, The calculating the starting position and ending position of the record storage in the current region includes: the starting position is equal to the total number of records in the previous n - 1 regions plus 1; the ending position is equal to the total number of records in the previous n regions; where n is the current region number.

6. The partition table primary key index method according to claim 1, wherein The calculation of the offset also includes boundary correction processing: If the calculated offset exceeds the lower or upper bound of the current search range, force the estimated position to be corrected to the starting position or ending position of the search range; When there is a discontinuous distribution in the device number section, automatically adjust the jump step size to half of the difference.

7. The partition table primary key index method according to claim 1, wherein The recalculating the offset according to the new difference to adjust the position includes: if the difference is positive, the target keyword is greater than the upper bound and the search fails; if the difference is negative, use the current candidate position + the difference as the new candidate position, and jump backward to the new candidate position, and read the keyword at this position again to match with the target keyword.

8. A partitioned table primary key index system supporting secondary positioning, characterized in that, including: A keyword parsing module, which is used to divide the keyword ID of the partition table into a table number section, a field number section, a region number section, and a device number section bit by bit, and configure bit operation parsing rules corresponding to the table number section, the field number section, the region number section, and the device number section; A partition record management module, which is used to establish and maintain a partition record array, dynamically record the record quantity of each region, and the index of the array corresponds to the region number; A range positioning module, which is used to calculate the starting position and the ending position of the record storage of the current region by accumulating the record quantities of the previous regions in the partition record array according to the region number parsed from the keyword ID to be queried, so as to form a search range; A jump retrieval module, which is used to calculate the numerical difference between the target keyword and the keyword at the starting position within the search range, and directly jump to the estimated position by using the difference as an offset based on the continuous distribution characteristic of the device number; A position adjustment module, which is used to compare the keyword at the estimated position with the target keyword. If they match, the result is returned. If they do not match, the new difference between the keyword at the estimated position and the target keyword is calculated, and the offset is recalculated according to the new difference for position adjustment; A binary search module, which is used to enable the binary search algorithm for final positioning within the current search range when the jump positioning fails to match after a preset number of times; 9. The partition table primary key index system according to claim 8, wherein, It further includes: A query interface module, which is used to provide a primary key query interface. The input parameter of the interface is a 64-bit long integer keyword ID, and the output parameter is the corresponding record or field value, supporting single-record query, batch-record query, local library query, and remote library query; A data storage module, which is used to store records in the partition order to ensure the ordered distribution of the keyword ID; A dynamic maintenance module, which is used to synchronously update the count value in the partition record array when a record is added or deleted, and keep the physical storage and the logical state of the record consistent; 10. A non-transitory computer-readable storage medium stores program codes of a power system data fusion processing method, characterized in that, The program code includes instructions for executing the method according to any one of claims 1 to 7.