Skip to main content

vecdb/variants/compressed/pco/
mod.rs

1use crate::{Format, ReadOnlyCompressedVec, ReadWriteCompressedVec, impl_vec_wrapper};
2
3mod strategy;
4mod r#trait;
5mod value;
6
7pub use strategy::*;
8pub use r#trait::*;
9pub use value::*;
10
11/// Compressed storage using Pcodec for optimal numeric data compression.
12///
13/// Pcodec (Pco) provides the best compression ratios for numerical sequences
14/// through specialized quantization and encoding. Ideal for time-series, scientific
15/// data, and any workload dominated by numeric values.
16///
17/// # Performance Characteristics
18/// - Best-in-class compression for numeric types (often 2-10x better than LZ4/Zstd)
19/// - Sequential access optimized (values compressed in pages)
20/// - Random access possible but slower than raw formats
21///
22/// # When to Use
23/// - Numeric data dominates (integers, floats)
24/// - Storage space is critical
25/// - Sequential access patterns are common
26#[derive(Debug)]
27#[must_use = "Vector should be stored to keep data accessible"]
28pub struct PcoVec<I, T>(ReadWriteCompressedVec<I, T, PcodecStrategy<T>>);
29
30impl_vec_wrapper!(
31    PcoVec,
32    ReadWriteCompressedVec<I, T, PcodecStrategy<T>>,
33    PcoVecValue,
34    Format::Pco,
35    ReadOnlyCompressedVec<I, T, PcodecStrategy<T>>
36);