mirror of
https://github.com/supabase/supabase.git
synced 2026-10-09 03:15:06 +03:00
Closes DOCS-1057 Contributes to DOCS-1052 ## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## Problem We have hundreds of MDX lint warnings in our docs going against style best practices. ## Solution Remove and replace in context the following: - PostgreSQL. There was only one. There was concern about exceptions, but I found none. - Just - Quickly - Actually ### What changed Edits follow the [Google developer documentation style guide](https://developers.google.com/style): concise, direct, active voice. The flagged words were removed when the sentence still read well, or replaced when meaning needed to be preserved. ### Common patterns | Flagged word | Approach | Example | |---|---|---| | **just** (filler) | Removed | "you just installed" → "you installed" | | **just** (limiting) | **only** | "just one row" → "only one row" | | **just like** | **like** / **the same as** | "function just like regular users" → "function like regular users" | | **not just** | **not only** | "not just errors" → "not only errors" | | **quickly** (performance) | **efficiently** or removed | "find rows quickly" → "find rows efficiently" | | **quickly** (time) | **soon** / **rapidly** / removed | "expires too quickly" → "expires too soon" | | **actually** (filler) | Removed | "actually execute" → "execute"; "is actually the most common" → "is the most common" | ## Tophatting 1. See the diff. 2. See that content continues to make sense in context. 3. Locally, `cd apps/docs` and run `pnpm run lint:mdx`. 4. Search for "just," "actually," "quickly", and "PostgreSQL" and see there are 0 warnings. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Updated wording across quickstarts, guides, and troubleshooting articles for grammar, clarity, and consistent step-by-step phrasing. * Clarified key concepts including Row Level Security policy evaluation across Supabase products, deferred foreign key constraint behavior, and when `EXPLAIN ANALYZE` executes queries (and related side effects). * Refined several troubleshooting instructions and added guidance to cap log payload size to reduce billed Logs Ingest volume. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Nik Richers <nrichers@gmail.com> Co-authored-by: Chris Chinchilla <chris.ward@supabase.io>
142 lines
7.1 KiB
Plaintext
142 lines
7.1 KiB
Plaintext
---
|
|
id: 'orioledb'
|
|
title: 'OrioleDB Overview'
|
|
description: "A storage extension for Postgres which uses Postgres's pluggable storage system"
|
|
---
|
|
|
|
The [OrioleDB](https://www.orioledb.com/) Postgres extension provides a drop-in replacement storage engine for the default heap storage method. It is designed to improve Postgres' scalability and performance.
|
|
|
|
OrioleDB addresses Postgres's scalability limitations by removing bottlenecks in the shared memory cache under high concurrency. It also optimizes write-ahead-log (WAL) insertion through row-level WAL logging. These changes lead to significant improvements in the industry standard TPC-C benchmark, which approximates a real-world transactional workload. The following benchmark was performed on a c7g.metal instance and shows OrioleDB's performance outperforming the default Postgres heap method with a 3.3x speedup.
|
|
|
|
<Image
|
|
alt="TPC-C (warehouses = 500)"
|
|
src="/docs/img/database/orioledb-tpc-c-500-warehouse.png"
|
|
className="max-w-[550px] mx-auto! border rounded-md"
|
|
width={1000}
|
|
height={609}
|
|
|
|
/>
|
|
|
|
<Admonition type="note">
|
|
|
|
OrioleDB is in active development and currently has [certain limitations](https://www.orioledb.com/docs/usage/getting-started#current-limitations). Currently, only B-tree indexes are supported, so features like pg_vector's HNSW indexes are not yet available. An Index Access Method bridge to unlock support for all index types used with heap storage is under active development. In the Supabase OrioleDB image the default storage method has been updated to use OrioleDB, granting better performance out of the box.
|
|
|
|
</Admonition>
|
|
|
|
## Concepts
|
|
|
|
### Index-organized tables
|
|
|
|
OrioleDB uses index-organized tables, where table data is stored in the index structure. This design eliminates the need for separate heap storage, reduces overhead and improves lookup performance for primary key queries.
|
|
|
|
### No buffer mapping
|
|
|
|
In-memory pages are connected to the storage pages using direct links. This allows OrioleDB to bypass Postgres's shared buffer pool and eliminate the associated complexity and contention in buffer mapping.
|
|
|
|
### Undo log
|
|
|
|
Multi-Version Concurrency Control (MVCC) is implemented using an undo log. The undo log stores previous row versions and transaction information, which enables consistent reads while removing the need for table vacuuming completely.
|
|
|
|
### Copy-on-write checkpoints
|
|
|
|
OrioleDB implements copy-on-write checkpoints to persist data efficiently. This approach writes only modified data during a checkpoint, reducing the I/O overhead compared to traditional Postgres checkpointing and allowing row-level WAL logging.
|
|
|
|
## Usage
|
|
|
|
### Creating OrioleDB project
|
|
|
|
You can get started with OrioleDB by enabling the extension in your Supabase dashboard.
|
|
To get started with OrioleDB you need to [create a new Supabase project](/dashboard/new/_) and choose `OrioleDB Public Alpha` Postgres version.
|
|
|
|
<Image
|
|
alt="Creating OrioleDB project"
|
|
src={{
|
|
light: '/docs/img/database/orioledb-creating-project--light.png',
|
|
dark: '/docs/img/database/orioledb-creating-project.png',
|
|
}}
|
|
className="max-w-[550px] mx-auto! border rounded-md"
|
|
|
|
width={1376}
|
|
height={2034}
|
|
/>
|
|
|
|
### Creating tables
|
|
|
|
To create a table using the OrioleDB storage engine, execute the standard `CREATE TABLE` statement. By default it will create a table using OrioleDB storage engine. For example:
|
|
|
|
```sql
|
|
-- Create a table
|
|
create table blog_post (
|
|
id int8 not null,
|
|
title text not null,
|
|
body text not null,
|
|
author text not null,
|
|
published_at timestamptz not null default CURRENT_TIMESTAMP,
|
|
views bigint not null,
|
|
primary key (id)
|
|
);
|
|
```
|
|
|
|
### Creating indexes
|
|
|
|
OrioleDB tables always have a primary key. If it wasn't defined explicitly, a hidden primary key is created using the `ctid` column.
|
|
Additionally you can create secondary indexes.
|
|
|
|
<Admonition type="note">
|
|
|
|
Currently, only B-tree indexes are supported, so features like pg_vector's HNSW indexes are not yet available.
|
|
|
|
</Admonition>
|
|
|
|
```sql
|
|
-- Create an index
|
|
create index blog_post_published_at on blog_post (published_at);
|
|
|
|
create index blog_post_views on blog_post (views) where (views > 1000);
|
|
```
|
|
|
|
### Data manipulation
|
|
|
|
You can query and modify data in OrioleDB tables using standard SQL statements, including `SELECT`, `INSERT`, `UPDATE`, `DELETE` and `INSERT ... ON CONFLICT`.
|
|
|
|
```sql
|
|
INSERT INTO blog_post (id, title, body, author, views)
|
|
VALUES (1, 'Hello, World!', 'This is my first blog post.', 'John Doe', 1000);
|
|
|
|
SELECT * FROM blog_post ORDER BY published_at DESC LIMIT 10;
|
|
id │ title │ body │ author │ published_at │ views
|
|
────┼───────────────┼─────────────────────────────┼──────────┼───────────────────────────────┼───────
|
|
1 │ Hello, World! │ This is my first blog post. │ John Doe │ 2024-11-15 12:04:18.756824+01 │ 1000
|
|
```
|
|
|
|
### Viewing query plans
|
|
|
|
You can see the execution plan using standard `EXPLAIN` statement.
|
|
|
|
```sql
|
|
EXPLAIN SELECT * FROM blog_post ORDER BY published_at DESC LIMIT 10;
|
|
QUERY PLAN
|
|
────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
Limit (cost=0.15..1.67 rows=10 width=120)
|
|
-> Index Scan Backward using blog_post_published_at on blog_post (cost=0.15..48.95 rows=320 width=120)
|
|
|
|
EXPLAIN SELECT * FROM blog_post WHERE id = 1;
|
|
QUERY PLAN
|
|
──────────────────────────────────────────────────────────────────────────────────
|
|
Index Scan using blog_post_pkey on blog_post (cost=0.15..8.17 rows=1 width=120)
|
|
Index Cond: (id = 1)
|
|
|
|
EXPLAIN (ANALYZE, BUFFERS) SELECT * FROM blog_post ORDER BY published_at DESC LIMIT 10;
|
|
QUERY PLAN
|
|
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
|
|
Limit (cost=0.15..1.67 rows=10 width=120) (actual time=0.052..0.054 rows=1 loops=1)
|
|
-> Index Scan Backward using blog_post_published_at on blog_post (cost=0.15..48.95 rows=320 width=120) (actual time=0.050..0.052 rows=1 loops=1)
|
|
Planning Time: 0.186 ms
|
|
Execution Time: 0.088 ms
|
|
```
|
|
|
|
## Resources
|
|
|
|
- [Official OrioleDB documentation](https://www.orioledb.com/docs)
|
|
- [OrioleDB GitHub repository](https://github.com/orioledb/orioledb)
|