floatfile
floatfile
floatfile : Simple file storage for arrays of floats
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 4280 | floatfile | floatfile | 1.3.1 | UTIL | MIT | C |
| Attribute | Has Binary | Has Library | Need Load | Has DDL | Relocatable | Trusted |
|---|---|---|---|---|---|---|
--s-d-r | No | Yes | No | Yes | yes | no |
| Relationships | |
|---|---|
| See Also | pg_ivm pg_bulkload gzip bzip zstd http pg_net pg_curl |
Packages
| Type | Repo | Version | PG Major Compatibility | Package Pattern | Dependencies |
|---|---|---|---|---|---|
| EXT | PIGSTY | 1.3.1 | 18 17 16 15 14 | floatfile | - |
| RPM | PIGSTY | 1.3.1 | 18 17 16 15 14 | floatfile_$v | - |
| DEB | PIGSTY | 1.3.1 | 18 17 16 15 14 | postgresql-$v-floatfile | - |
| Linux / PG | PG18 | PG17 | PG16 | PG15 | PG14 |
|---|---|---|---|---|---|
el8.x86_64 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 |
el8.aarch64 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 |
el9.x86_64 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 |
el9.aarch64 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 |
el10.x86_64 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 |
el10.aarch64 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 |
d12.x86_64 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 |
d12.aarch64 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 |
d13.x86_64 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 |
d13.aarch64 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 |
u22.x86_64 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 |
u22.aarch64 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 |
u24.x86_64 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 |
u24.aarch64 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 | PIGSTY 1.3.1 |
Source
pig build pkg floatfile; # build debInstall
Make sure PGDG and PIGSTY repo available:
pig repo add pgsql -u # add both repo and update cacheInstall this extension with pig:
pig install floatfile; # install via package name, for the active PG version
pig install floatfile -v 18; # install for PG 18
pig install floatfile -v 17; # install for PG 17
pig install floatfile -v 16; # install for PG 16
pig install floatfile -v 15; # install for PG 15
pig install floatfile -v 14; # install for PG 14Create this extension with:
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[] histogramConcurrency
Functions use PostgreSQL advisory locks: load_floatfile takes a shared lock; save, extend, and drop take exclusive locks.
Last updated on