pub struct PlanCost {
pub rows: u64,
pub cpu_cost: f64,
pub gpu_mem: u64,
pub transfers: u32,
}Expand description
Cost estimate for a query plan node.
Captures the multi-dimensional cost of executing a plan node, enabling the optimizer to make informed decisions based on available resources.
Fields§
§rows: u64Estimated number of output rows.
cpu_cost: f64Estimated CPU cost (arbitrary units, relative comparisons only).
This represents processing overhead that cannot be parallelized on the GPU, such as coordination, scheduling, and result materialization.
gpu_mem: u64Estimated GPU memory usage in bytes.
Includes both input buffers and intermediate storage required for the operation.
transfers: u32Number of GPU-to-host or host-to-GPU data transfers.
Transfers are typically the most expensive operations in GPU computing and should be minimized.
Implementations§
Source§impl PlanCost
impl PlanCost
Sourcepub fn total_cost(&self, transfer_weight: f64) -> f64
pub fn total_cost(&self, transfer_weight: f64) -> f64
Computes a scalar cost value for comparison purposes.
The formula weights different cost components:
- CPU cost is taken directly
- GPU memory is scaled by 0.001 (1GB = 1M cost units)
- Transfers are heavily weighted due to their high latency
§Arguments
transfer_weight- Weight multiplier for transfer costs