Skip to main content

Module analysis

Module analysis 

Source
Expand description

Plan Analysis Module

Provides an analysis of query plans, supporting decision-making processes related to optimization. Quote Count Analysis: Identifying Sub-plans That Are Cited Multiple Times Expression analysis: Examining the characteristics of an expression (such as determinacy, complexity, etc.) Fingerprint calculation: Calculating the structural fingerprint of the planning nodes

§Explanation of the module locations

This module is located in src/query/optimizer/analysis/ and is at the same level as the cost module. Reason for placing it in the optimizer rather than the planner: Separation of responsibilities: The planner is responsible for generating plans, while the optimizer is responsible for optimizing these plans. 2. Calculation on demand: Analysis is only performed during the optimization phase, as and when necessary. 3. Dependency relationships: The optimizer already depends on the planner; therefore, no circular dependencies will be introduced.

§Usage Examples

use linkrs_query::optimizer::analysis::{
    ExpressionAnalyzer,
    ReferenceCountAnalyzer,
};

let ref_analyzer = ReferenceCountAnalyzer::new();
let expr_analyzer = ExpressionAnalyzer::new();

// Count how many times sub-plans are referenced (needs a full plan):
// let ref_analysis = ref_analyzer.analyze(plan.root());
// Analyze an expression's characteristics (determinism, complexity, etc.):
// let expr_analysis = expr_analyzer.analyze(condition);

Re-exports§

pub use batch::AggregatedExpressionAnalysis;
pub use batch::BatchPlanAnalysis;
pub use batch::BatchPlanAnalyzer;
pub use expression::AnalysisMode;
pub use expression::AnalysisOptions;
pub use expression::ExpressionAnalysis;
pub use expression::ExpressionAnalyzer;
pub use expression::NondeterministicChecker;
pub use fingerprint::FingerprintCalculator;
pub use fingerprint::PlanFingerprint;
pub use reference_count::ReferenceCountAnalysis;
pub use reference_count::ReferenceCountAnalyzer;
pub use reference_count::SubplanId;
pub use reference_count::SubplanReferenceInfo;
pub use required_properties::binding_var;
pub use required_properties::PropertyRequirement;
pub use required_properties::RequiredPropertiesMap;
pub use required_properties::RequiredPropertyAnalyzer;

Modules§

batch
Batch Plan Analyzer Module
expression
Expression Analysis Module
fingerprint
Plan Node Fingerprint Calculation Module
reference_count
Reference Count Analysis Module
required_properties
Required-property demand analysis (typed property pruning)