Skip to content

Postgres Extension for Answering Approximate Aggregate Queries on Time Series Data

License

Notifications You must be signed in to change notification settings

USC-InfoLab/fft_approximate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fft_approximate

About

fft_approximate is an open-source PostgreSQL extension that enables users to quickly answer aggregate range queries on time series data, using an approximate approach. Our approach leverages the power of the Fast Fourier Transform (FFT) to store a condensed representation of each time series. By selectively storing only the top-k coefficients, we're able to compute aggregate range queries quickly and efficiently, with a small sacrifice of accuracy.

Users are encouraged to use this extension when working with large volumes of time series data but require rapid query processing times.

Usage

-- create an extension
CREATE EXTENSION fft_approximate;

-- create a regular SQL table
CREATE TABLE intraday_activity (
  id BIGINT PRIMARY KEY,
  date_calories INT NOT NULL,
  calories DOUBLE PRECISION NOT NULL,
  mets INT NOT NULL,
  activity_level INT NOT NULL,
  timestamp DATE NOT NULL
);

-- create a table approximation
SELECT create_approximation('intraday_activity', 'calories');
-- query data
SELECT AVG_APROX(calories) 
FROM intraday_activity
WHERE timestamp < '01-01-2022' AND timestamp > '03-01-2022';

About

Postgres Extension for Answering Approximate Aggregate Queries on Time Series Data

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published