floatfile

Simple file storage for arrays of floats

Overview

PackageVersionCategoryLicenseLanguage
floatfile1.3.1UTILMITC
IDExtensionBinLibLoadCreateTrustRelocSchema
4280floatfileNoYesNoYesNoYes-
Relatedpg_ivm pg_bulkload gzip bzip zstd http pg_net pg_curl

Version

TypeRepoVersionPG VerPackageDeps
EXTPIGSTY1.3.11817161514floatfile-
RPMPIGSTY1.3.11817161514floatfile_$v-
DEBPIGSTY1.3.11817161514postgresql-$v-floatfile-
OS / PGPG18PG17PG16PG15PG14
el8.x86_64
el8.aarch64
el9.x86_64
el9.aarch64
el10.x86_64
el10.aarch64
d12.x86_64
d12.aarch64
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
u26.x86_64
u26.aarch64

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

floatfile: Float array file I/O for PostgreSQL

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.


Last Modified 2026-05-01: update extension data (aaef844)