PGlite Extensions
PGlite supports both Postgres extensions, and has a plugin API to enable extensions to extend the public API of the PGlite interface.
Below is a list of available extensions.
live
A reactive, or "live", query extension for PGlite that enables you to subscribe to a query and receive updated results when the underlying tables change.
live
is included in the main PGlite package.
import { live } from '@electric-sql/pglite/live';
const pg = new PGlite({
extensions: { live }
});
pgvector
Open-source vector similarity search for Postgres.
Store your vectors with the rest of your data. Supports:
- exact and approximate nearest neighbor search
- single-precision, half-precision, binary, and sparse vectors
- L2 distance, inner product, cosine distance, L1 distance, Hamming distance, and Jaccard distance
pgvector
is included in the main PGlite package.
import { vector } from '@electric-sql/pglite/vector';
const pg = new PGlite({
extensions: { vector }
});
adminpack
adminpack provides a number of support functions which pgAdmin and other administration and management tools can use to provide additional functionality
adminpack
is included in the main PGlite package.
import { adminpack } from '@electric-sql/pglite/contrib/adminpack';
const pg = new PGlite({
extensions: { adminpack }
});
amcheck
The amcheck module provides functions that allow you to verify the logical consistency of the structure of relations.
amcheck
is included in the main PGlite package.
import { amcheck } from '@electric-sql/pglite/contrib/amcheck';
const pg = new PGlite({
extensions: { amcheck }
});
auto_explain
The auto_explain module provides a means for logging execution plans of slow statements automatically, without having to run EXPLAIN by hand.
auto_explain
is included in the main PGlite package.
import { auto_explain } from '@electric-sql/pglite/contrib/auto_explain';
const pg = new PGlite({
extensions: { auto_explain }
});
bloom
bloom provides an index access method based on Bloom filters. A Bloom filter is a space-efficient data structure that is used to test whether an element is a member of a set. In the case of an index access method, it allows fast exclusion of non-matching tuples via signatures whose size is determined at index creation.
bloom
is included in the main PGlite package.
import { bloom } from '@electric-sql/pglite/contrib/bloom';
const pg = new PGlite({
extensions: { bloom }
});
btree_gin
btree_gin provides GIN operator classes that implement B-tree equivalent behavior for many built in data types.
btree_gin
is included in the main PGlite package.
import { btree_gin } from '@electric-sql/pglite/contrib/btree_gin';
const pg = new PGlite({
extensions: { btree_gin }
});
btree_gist
btree_gist provides GiST operator classes that implement B-tree equivalent behavior for many built in data types.
btree_gist
is included in the main PGlite package.
import { btree_gist } from '@electric-sql/pglite/contrib/btree_gist';
const pg = new PGlite({
extensions: { btree_gist }
});
citext
citext provides a case-insensitive character string type, citext. Essentially, it internally calls lower when comparing values. Otherwise, it behaves almost the same as text.
citext
is included in the main PGlite package.
import { citext } from '@electric-sql/pglite/contrib/citext';
const pg = new PGlite({
extensions: { citext }
});
cube
cube provides a data type cube for representing multidimensional cubes.
cube
is included in the main PGlite package.
import { cube } from '@electric-sql/pglite/contrib/cube';
const pg = new PGlite({
extensions: { cube }
});
earthdistance
The earthdistance module provides tools for calculating great circle distances on the surface of the Earth.
earthdistance
is included in the main PGlite package.
import { earthdistance } from '@electric-sql/pglite/contrib/earthdistance';
const pg = new PGlite({
extensions: { earthdistance }
});
fuzzystrmatch
fuzzystrmatch provides functions to determine similarities and distance between strings.
fuzzystrmatch
is included in the main PGlite package.
import { fuzzystrmatch } from '@electric-sql/pglite/contrib/fuzzystrmatch';
const pg = new PGlite({
extensions: { fuzzystrmatch }
});
hstore
This module implements the hstore data type for storing sets of key/value pairs within a single PostgreSQL value. This can be useful in various scenarios, such as rows with many attributes that are rarely examined, or semi-structured data. Keys and values are simply text strings.
hstore
is included in the main PGlite package.
import { hstore } from '@electric-sql/pglite/contrib/hstore';
const pg = new PGlite({
extensions: { hstore }
});
isn
The isn module provides data types for the following international product numbering standards: EAN13, UPC, ISBN (books), ISMN (music), and ISSN (serials).
isn
is included in the main PGlite package.
import { isn } from '@electric-sql/pglite/contrib/isn';
const pg = new PGlite({
extensions: { isn }
});
lo
The lo module provides support for managing Large Objects (also called LOs or BLOBs). This includes a data type lo and a trigger lo_manage.
lo
is included in the main PGlite package.
import { lo } from '@electric-sql/pglite/contrib/lo';
const pg = new PGlite({
extensions: { lo }
});
ltree
This module implements a data type ltree for representing labels of data stored in a hierarchical tree-like structure. Extensive facilities for searching through label trees are provided.
ltree
is included in the main PGlite package.
import { ltree } from '@electric-sql/pglite/contrib/ltree';
const pg = new PGlite({
extensions: { ltree }
});
pg_trgm
The pg_trgm module provides functions and operators for determining the similarity of alphanumeric text based on trigram matching, as well as index operator classes that support fast searching for similar strings.
pg_trgm
is included in the main PGlite package.
import { pg_trgm } from '@electric-sql/pglite/contrib/pg_trgm';
const pg = new PGlite({
extensions: { pg_trgm }
});
seg
This module implements a data type seg for representing line segments, or floating point intervals. seg can represent uncertainty in the interval endpoints, making it especially useful for representing laboratory measurements.
seg
is included in the main PGlite package.
import { seg } from '@electric-sql/pglite/contrib/seg';
const pg = new PGlite({
extensions: { seg }
});
tablefunc
The tablefunc module includes various functions that return tables (that is, multiple rows). These functions are useful both in their own right and as examples of how to write C functions that return multiple rows.
tablefunc
is included in the main PGlite package.
import { tablefunc } from '@electric-sql/pglite/contrib/tablefunc';
const pg = new PGlite({
extensions: { tablefunc }
});
tcn
The tcn module provides a trigger function that notifies listeners of changes to any table on which it is attached. It must be used as an AFTER trigger FOR EACH ROW.
tcn
is included in the main PGlite package.
import { tcn } from '@electric-sql/pglite/contrib/tcn';
const pg = new PGlite({
extensions: { tcn }
});
tsm_system_rows
The tsm_system_rows module provides the table sampling method SYSTEM_ROWS, which can be used in the TABLESAMPLE clause of a SELECT command.
tsm_system_rows
is included in the main PGlite package.
import { tsm_system_rows } from '@electric-sql/pglite/contrib/tsm_system_rows';
const pg = new PGlite({
extensions: { tsm_system_rows }
});
tsm_system_time
The tsm_system_time module provides the table sampling method SYSTEM_TIME, which can be used in the TABLESAMPLE clause of a SELECT command.
import { tsm_system_time } from '@electric-sql/pglite/contrib/tsm_system_time';
const pg = new PGlite({
extensions: { tsm_system_time }
});
uuid-ossp
The uuid-ossp module provides functions to generate universally unique identifiers (UUIDs) using one of several standard algorithms. There are also functions to produce certain special UUID constants. This module is only necessary for special requirements beyond what is available in core PostgreSQL.
import { uuid_ossp } from '@electric-sql/pglite/contrib/uuid_ossp';
const pg = new PGlite({
extensions: { uuid_ossp }
});