Skip to content

Commit c1cf292

Browse files
authored
Create supported-postgresql-extensions.md
Adding documentation for extensions support with Serverless SQL Database
1 parent 83b04ad commit c1cf292

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
---
2+
meta:
3+
title: Supported PostgreSQL extensions
4+
description: This page describes how to use PostgreSQL extensions with Serverless SQL Databases
5+
content:
6+
h1: Supported PostgreSQL extensions
7+
paragraph: This page describes how to use PostgreSQL extensions with Serverless SQL Databases
8+
tags: sql-databases serverless database extensions postgresql pgvector postgis timescaledb
9+
dates:
10+
validation: 2024-10-08
11+
posted: 2024-10-08
12+
categories:
13+
- serverless
14+
---
15+
16+
Serverless SQL Database supports most popular [PostgreSQL extensions](#install-an-extension). Due to autoscaling and built-in connection pooling, some [advanced features of extensions might be limited or require workarounds](#supported-extensions).
17+
18+
<Macro id="requirements" />
19+
20+
- A Scaleway account logged into the [console](https://console.scaleway.com)
21+
- [Owner](/identity-and-access-management/iam/concepts/#owner) status or [IAM permissions](/identity-and-access-management/iam/concepts/#permission) allowing you to perform actions in the intended Organization
22+
- [Created a Serverless SQL Database](/serverless/sql-databases/how-to/create-a-database/)
23+
24+
## Install an extension
25+
26+
1. [Connect to your Serverless SQL Database](https://www.scaleway.com/en/docs/serverless/sql-databases/quickstart/#how-to-connect-to-a-database) with a PostgreSQL client. For instance with psql:
27+
```bash
28+
psql "postgres://[user-or-application-id]:[api-secret-key]@[database-hostname]:5432/[database-name]?sslmode=require"
29+
```
30+
31+
2. Create extension using SQL:
32+
```sql
33+
CREATE EXTENSION extension_name;
34+
```
35+
36+
3. Use extension with its supported features. Assuming you installed `pgvector` with `CREATE EXTENSION vector`, you can for instance create a vector and query it:
37+
```sql
38+
CREATE TABLE songs (id bigserial PRIMARY KEY, embedding vector(3));
39+
INSERT INTO songs (embedding) VALUES ('[1,1,1]'), ('[2,2,2]'), ('[0,1,2]');
40+
SELECT * FROM songs ORDER BY embedding <-> '[3,3,3]' LIMIT 5;
41+
```
42+
This example will find the nearest vectors (using L2 distance) from '[3,3,3]':
43+
```bash
44+
id | embedding
45+
----+-----------
46+
2 | [2,2,2]
47+
1 | [1,1,1]
48+
3 | [0,1,2]
49+
```
50+
51+
## Supported extensions
52+
53+
The following PostgreSQL extensions are available with Serverless SQL Databases:
54+
55+
56+
| Extension | Description and known limitations |
57+
|------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|
58+
| address_standardizer | Parses addresses into their constituent elements, typically used in the geocoding normalization process. |
59+
| address_standardizer_data_us | Provides a dataset example for the US Address Standardizer extension. |
60+
| bloom | Implements a Bloom filter-based index, ideal for situations where space efficiency is crucial. |
61+
| btree_gin | Adds support for indexing common data types using the GIN (Generalized Inverted Index) method. |
62+
| btree_gist | Adds support for indexing common data types using the GiST (Generalized Search Tree) method. |
63+
| citext | Provides a case-insensitive character string data type for easier text comparison. |
64+
| cube | Defines a data type for representing multidimensional cubes, useful in mathematical and geometrical computations. |
65+
| dict_int | Offers a text search dictionary template optimized for integer values. |
66+
| dict_xsyn | Provides a text search dictionary template for advanced synonym processing, improving search accuracy. Features requiring direct access to the filesystem will not be supported (eg. custom synonym lists) |
67+
| earthdistance | Calculates great-circle distances between points on Earth, useful in geographical applications. |
68+
| fuzzystrmatch | Determines similarities and differences between strings, helpful for tasks like data deduplication. |
69+
| hstore | Stores sets of key-value pairs in a single value, enabling a flexible schema for semi-structured data. |
70+
| intagg | Aggregates and enumerates integer values, though it is considered obsolete since PG 8.4 and official support has been integrated in PostgreSQL directly |
71+
| intarray | Provides functions, operators, and indexing support for one-dimensional arrays of integers, enhancing array processing. |
72+
| isn | Supports data types for international product numbering standards, such as ISBN and EAN. |
73+
| ltree | Defines a data type for representing tree-like structures in a hierarchical manner, facilitating complex data modeling. |
74+
| pg_cron | Schedules jobs within PostgreSQL using a cron-like syntax, automating routine database tasks. `pg_cron` requires the database to be in active state permanently and thus that you setup a minimum vCPU above 1 to properly work. |
75+
| pg_prewarm | Preloads relation data into memory to reduce initial disk I/O latency and improve performance. |
76+
| pg_stat_statements | Tracks planning and execution statistics for all SQL statements, aiding in performance tuning. |
77+
| pg_trgm | Measures text similarity and provides index searching based on trigrams, enhancing text search capabilities. |
78+
| pgcrypto | Provides cryptographic functions for data encryption, decryption, and hashing, essential for secure data storage. |
79+
| pgrouting | Extends PostgreSQL and PostGIS with geospatial routing capabilities, enabling the calculation of shortest paths and other routing operations. |
80+
| pgrowlocks | Displays information about row-level locking, helping in the diagnosis of concurrency issues. |
81+
| pgvector | Supports vector similarity search, often used for storing and searching embeddings in machine learning applications. [Query options](https://github.com/pgvector/pgvector?tab=readme-ov-file#query-options) using `SET` command require [to be used in a single transaction](https://www.scaleway.com/en/docs/serverless/sql-databases/reference-content/known-differences/#unsupported-configuration-commands) (ie. between `BEGIN; (...) COMMIT;`) |
82+
| plpgsql | Enables the use of PL/pgSQL, a procedural language for PostgreSQL that allows complex control structures and query manipulation. |
83+
| postgis | Adds support for geographic objects, allowing location queries to be run in SQL, and is the foundation of geographic information system (GIS) functionality in PostgreSQL. |
84+
| postgis_raster | Implements raster data support in PostGIS, enabling analysis and storage of raster images alongside vector data. |
85+
| postgis_sfcgal | Adds advanced 3D geometry functions to PostGIS, leveraging the SFCGAL library for complex spatial operations. |
86+
| postgis_tiger_geocoder | Provides geocoding and reverse geocoding capabilities based on the US Census TIGER data within PostGIS. |
87+
| postgis_topology | Supports topological data models in PostGIS, allowing for advanced spatial relationships and analyses. |
88+
| tablefunc | Offers functions for manipulating entire tables, including crosstab operations for pivot tables. |
89+
| timescaledb | Enables efficient handling and analysis of time-series data, extending PostgreSQL with specialized time-series functions. |
90+
| tsm_system_rows | Implements a TABLESAMPLE method that limits the number of rows returned, useful for sampling large datasets. |
91+
| tsm_system_time | Implements a TABLESAMPLE method that limits rows based on a time duration, useful for time-based sampling. |
92+
| unaccent | Provides a text search dictionary that removes accents from characters, improving text search accuracy. |
93+
| uuid-ossp | Generates universally unique identifiers (UUIDs), essential for ensuring data uniqueness across distributed systems. |

0 commit comments

Comments
 (0)