Global Secondary Index Logical Value Pre-storage for Query Efficiency
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
The TABLE ACCESS BY INDEX ROWID query method in distributed databases experiences low query efficiency due to the need for calculating the logical value of the distribution key of base table data, which increases processing time and resource demands.
Innovation Solution
The method involves a data node directly determining the location of base table data using the logical value of the distribution key stored in the global secondary index, omitting the calculation of the distribution key's logical value, thereby reducing processing costs and improving query efficiency.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If the TABLE ACCESS BY INDEX ROWID query method is used to query data in a distributed database, then data can be queried using a global secondary index, but query efficiency is low due to the need for calculating the logical value of the distribution key
Solution Approach 1:
The patent applies preliminary action by pre-storing the logical value of the distribution key in the global secondary index data structure. This allows the data node to directly retrieve the logical value during query processing without performing calculation, thereby reducing processing time and improving query efficiency. The logical value is prepared in advance as part of the index data, eliminating the need for real-time computation.
2Reliability
If the distribution key's logical value is calculated during query processing, then the correct data node can be identified, but processing costs and resource demands increase
Solution Approach 1:
The patent applies copying by storing a copy of the logical value of the distribution key within the global secondary index data structure itself. This copied logical value is then directly used during query processing to identify the correct data node, eliminating the need for real-time calculation and reducing processing complexity while maintaining identification accuracy.
3Productivity
If GSI data includes the distribution key value, then data can be located, but storage space requirements increase
Solution Approach 1:
The patent applies extraction by separating the distribution key value from the GSI data structure and replacing it with only the necessary logical value component. This extracted and simplified approach retains the essential data location capability while reducing storage space requirements, as only the logical value is stored rather than the complete distribution key information.
Data Source
Figure 1~2
Figure 3
Figure 4
AI summary
This application provides a data query method and a related apparatus, to resolve a problem that efficiency of a TABLE ACCESS BY INDEX ROWID query based on a global secondary index is low in conventional technologies. In a technical solution provided in this application, GSI data stored on a first data node includes a logical value of a distribution key of base table data. When performing a TABLE ACCESS BY INDEX ROWID query operation, the first data node may directly determine a second data node based on the logical value of the distribution key of the base table data. The second data node is a data node, in a distributed system, that stores base table data meeting a query condition. In the method, a process of calculating the logical value of the distribution key of the base table data in the conventional technologies can be omitted, which improves query efficiency.