floatfile
Overview
| Package | Version | Category | License | Language |
|---|---|---|---|---|
floatfile | 1.3.1 | UTIL | MIT | C |
| ID | Extension | Bin | Lib | Load | Create | Trust | Reloc | Schema |
|---|---|---|---|---|---|---|---|---|
| 4280 | floatfile | No | Yes | No | Yes | No | Yes | - |
| Related | pg_ivm pg_bulkload gzip bzip zstd http pg_net pg_curl |
|---|
Version
| Type | Repo | Version | PG Ver | Package | Deps |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.3.1 | 1817161514 | floatfile | - |
| RPM | PIGSTY | 1.3.1 | 1817161514 | floatfile_$v | - |
| DEB | PIGSTY | 1.3.1 | 1817161514 | postgresql-$v-floatfile | - |
Build
You can build the DEB packages for floatfile using pig build:
pig build pkg floatfile # build DEB packages
Install
You can install floatfile directly. First, make sure the PGDG and PIGSTY repositories are added and enabled:
pig repo add pgsql -u # Add repo and update cache
Install the extension using pig or apt/yum/dnf:
pig install floatfile; # Install for current active PG version
pig ext install -y floatfile -v 18 # PG 18
pig ext install -y floatfile -v 17 # PG 17
pig ext install -y floatfile -v 16 # PG 16
pig ext install -y floatfile -v 15 # PG 15
pig ext install -y floatfile -v 14 # PG 14
dnf install -y floatfile_18 # PG 18
dnf install -y floatfile_17 # PG 17
dnf install -y floatfile_16 # PG 16
dnf install -y floatfile_15 # PG 15
dnf install -y floatfile_14 # PG 14
apt install -y postgresql-18-floatfile # PG 18
apt install -y postgresql-17-floatfile # PG 17
apt install -y postgresql-16-floatfile # PG 16
apt install -y postgresql-15-floatfile # PG 15
apt install -y postgresql-14-floatfile # PG 14
Create Extension:
CREATE EXTENSION floatfile;
Usage
Store float arrays in individual files for very fast querying without MVCC overhead. Ideal for time series data requiring low-latency reads and low-cost appends.
Functions
Save a float array to a file
SELECT save_floatfile('my_data', ARRAY[1.0, 2.0, 3.0, 4.0]::float[]);
Load a float array from a file
SELECT load_floatfile('my_data');
-- {1,2,3,4}
Append values to an existing file
SELECT extend_floatfile('my_data', ARRAY[5.0, 6.0]::float[]);
Delete a floatfile
SELECT drop_floatfile('my_data');
Tablespace Variants
All functions accept an optional tablespace name as first argument:
SELECT save_floatfile('my_ts', 'my_data', ARRAY[1.0, 2.0]::float[]);
SELECT load_floatfile('my_ts', 'my_data');
SELECT extend_floatfile('my_ts', 'my_data', ARRAY[3.0]::float[]);
SELECT drop_floatfile('my_ts', 'my_data');
Histogram Functions
Compute histograms directly from floatfiles (useful when arrays exceed the 1GB Postgres limit):
SELECT floatfile_to_hist('my_data', 0.0, 1.0, 10);
-- Returns int[] with histogram counts
SELECT floatfile_to_hist2d('xs_file', 'ys_file', 0.0, 0.0, 1.0, 1.0, 10, 10);
-- Returns 2D int[] histogram
Concurrency
Functions use PostgreSQL advisory locks: load_floatfile takes a shared lock; save, extend, and drop take exclusive locks.
Feedback
Was this page helpful?
Thanks for the feedback! Please let us know how we can improve.
Sorry to hear that. Please let us know how we can improve.