Implementing a Kalman Filter in Postgres
5 hours ago
- #GPS
- #Postgres
- #Kalman Filter
- Modern GPS datasets are noisy due to satellite drift, signal scattering, and device errors.
- The Kalman Filter is a standard technique for smoothing noisy GPS data.
- Traditionally applied outside databases, filtering inside Postgres offers advantages like immediate SQL results and scalability.
- Kalman Filter combines prediction and update steps, modeling uncertainty to refine estimates.
- Used in navigation, robotics, and finance for turning noisy data into realistic paths.
- Implementing Kalman Filter in Postgres is challenging due to SQL's lack of state tracking.
- Key requirements: state storage, transition function, and strict time-order processing.
- Online filtering updates data in real-time but increases insert latency.
- Offline filtering can use recursive CTEs or custom aggregates, with the latter being more efficient.
- Benchmarks show custom aggregates outperform recursive CTEs for large datasets.