Docs · Postgres

Supported extensions

OnScalable Postgres databases come with the extensions below installed. Enable the one you need with a single command as your database user; no extra setup or support ticket required.

Enabling an extension

Run the command from psql, a database tool or your app’s migrations (Flyway, Prisma, Alembic, Rails…). Once per database is enough.

CREATE EXTENSION IF NOT EXISTS vector;

Bundled extensions

ExtensionWhat it does
vectorpgvector: store embeddings and run similarity search (HNSW, IVFFlat).
postgisPostGIS: geographic types, distance and area queries.
postgis_topologyPostGIS topology support.
hypopgHypothetical indexes: see their effect with EXPLAIN before creating them.
pg_stat_statementsQuery statistics. Preloaded on the server; just enable it.

PostgreSQL contrib extensions

ExtensionWhat it does
pgcryptoHashing, encryption and gen_random_uuid().
uuid-osspUUID generation functions (uuid_generate_v4()).
pg_trgmTrigram similarity; speeds up LIKE/ILIKE searches with an index.
unaccentAccent-insensitive search (e.g. "café" → "cafe").
citextCase-insensitive text type (handy for email columns).
hstoreKey/value column type.
ltreeTree structures and hierarchical paths.
btree_ginGIN indexes for scalar types.
btree_gistGiST indexes for scalar types (e.g. exclusion constraints).
fuzzystrmatchFuzzy matching such as Levenshtein and soundex.
intarrayOperators and indexes for integer arrays.
tablefuncPivot tables with crosstab.
cube, earthdistanceSimple latitude/longitude distance calculations.
pg_buffercache, pgstattuple, amcheckPerformance and consistency inspection.
postgres_fdw, dblinkConnect to another Postgres database.

All extensions are available on PostgreSQL 15, 16, 17 and 18.

Example: similarity search with pgvector

CREATE EXTENSION IF NOT EXISTS vector;

CREATE TABLE documents (
  id        bigserial PRIMARY KEY,
  content   text,
  embedding vector(1536)
);

CREATE INDEX ON documents USING hnsw (embedding vector_cosine_ops);

SELECT id, content
FROM documents
ORDER BY embedding <=> $1   -- sorgu embedding'i / query embedding
LIMIT 5;

Example: distance with PostGIS

CREATE EXTENSION IF NOT EXISTS postgis;

SELECT ST_Distance(
  'SRID=4326;POINT(28.9784 41.0082)'::geography,  -- İstanbul
  'SRID=4326;POINT(32.8597 39.9334)'::geography   -- Ankara
) / 1000 AS km;

Example: slowest queries

CREATE EXTENSION IF NOT EXISTS pg_stat_statements;

SELECT calls, round(mean_exec_time::numeric, 1) AS avg_ms, query
FROM pg_stat_statements
ORDER BY mean_exec_time DESC
LIMIT 10;

Need an extension that is not listed? Contact us