Primary Key Determination Using Column Structural Relationships
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing methods for determining a primary key in a database table are inefficient, especially when the table data changes, as they often require exhaustive searches of all possible column combinations, leading to exponential time and memory complexity, making them unsuitable for large or dynamically changing datasets.
Innovation Solution
The use of dataset statistics, such as column cardinality and structural relationships, to incrementally and efficiently determine a primary key, reducing complexity from exponential to polynomial time and memory usage, allowing for scalable primary key identification regardless of the table size.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If the primary key is defined as the combination of all columns in the table, then the primary key remains valid even when table data changes, but resource consumption for calculations/transactions using the primary key increases exponentially
Solution Approach 1:
The patent extracts and removes unnecessary columns from the primary key combination, keeping only the essential columns that are required to uniquely identify each record. This reduces the primary key from potentially all columns to a minimal subset, thereby reducing resource consumption while maintaining validity.
Solution Approach 2:
The patent segments the table columns into different groups based on their necessity for primary key identification. By analyzing column dependencies and relationships, it identifies which column segments are essential and which can be excluded, creating an optimized primary key structure.
2Measurement precision
If all possible single- and multi-column keys are generated to determine the primary key, then the correct primary key can be identified, but time and memory complexity become unacceptable for most database tables
Solution Approach 1:
The patent performs preliminary analysis of column statistics, relationships, and dependencies before attempting to identify the primary key. By pre-processing the data to understand column characteristics and relationships, it avoids the need to exhaustively test all possible column combinations, significantly reducing determination time.
Solution Approach 2:
Instead of performing exhaustive analysis of all possible column combinations, the patent applies partial analysis by focusing on the most promising column subsets based on statistical indicators and relationship patterns. This partial approach achieves sufficient accuracy without the full computational cost of exhaustive search.
3Measurement precision
If manual execution of count queries is used to determine the primary key, then the primary key can be identified based on domain knowledge and experience, but the process is time-consuming and not scalable
Solution Approach 1:
The patent enables the system to automatically determine the primary key by analyzing column statistics and relationships without requiring manual intervention. The system self-services by gathering necessary information from metadata and data samples, applying analysis algorithms, and producing the primary key identification result autonomously.
Solution Approach 2:
The patent uses feedback from column statistics, data distribution patterns, and relationship analysis to iteratively refine the primary key candidate identification. By continuously gathering feedback from the data characteristics and adjusting the analysis accordingly, the system efficiently converges on the correct primary key without manual trial and error.
Data Source
AI summary
A database system includes a first table comprising a plurality of columns and a plurality of column values associated with each of the plurality of columns. For each of the plurality of columns, a structural relationship is determined with each other of the plurality of columns based on the plurality of column values associated with each of the plurality of columns. One or more of the plurality of columns comprising a primary key of the first table are determined based on the structural relationships.


