Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d65331c
Remove `queue_` prefix from api endpoints (#30745)
olirice Nov 30, 2024
a4243f4
Add restrictions for orioledb technical preview (#30410)
joshenlim Nov 30, 2024
141a8b5
smol fix (#30749)
joshenlim Nov 30, 2024
009b3f8
docs: reorder global nav slightly (#30746)
charislam Nov 30, 2024
1818806
fix: update orioledb selection copy (#30754)
w3b6x9 Dec 1, 2024
2de1784
Add OrioleDB extension documentation (#30489)
za-arthur Dec 1, 2024
573743c
Add Orioledb Alpha Blog Post (#30740)
olirice Dec 1, 2024
bcd71a6
Add tooltip for queue settings (#30761)
joshenlim Dec 2, 2024
fcfc1cf
Assistant refinements (#30759)
SaxonF Dec 2, 2024
16e002d
Update queue permissions roles (#30774)
joshenlim Dec 2, 2024
1b2d50c
Feat/ai landing page (#30559)
SaxonF Dec 2, 2024
f1615f6
chore: update self-hosted image versions (#30777)
kiwicopple Dec 2, 2024
d8cf4b9
chore: update cli reference doc (#30778)
kiwicopple Dec 2, 2024
a732f4f
Remove oriole realtime callout (#30758)
joshenlim Dec 2, 2024
71e5240
fix: Add missing dependency to fix the docker build (#30782)
ivasilov Dec 2, 2024
07a2219
feat: calendly wrapper (#30733)
alaister Dec 2, 2024
f524e73
Whitelist string_agg in ai assistant (#30780)
joshenlim Dec 2, 2024
a0cf2af
Change preview to alpha (#30783)
joshenlim Dec 2, 2024
398b3ee
fix: oid types in text editor (#30784)
alaister Dec 2, 2024
7c1a435
Prevent disabling orioledb extension if project is orioledb (#30787)
joshenlim Dec 2, 2024
c836ed0
Swap vault to alpha (#30788)
joshenlim Dec 2, 2024
4348aa7
chore: simpler storage and ai config examples (#30781)
sweatybridge Dec 2, 2024
ccb2624
let the assistant decide when to run (#30789)
SaxonF Dec 2, 2024
24630bf
refine assistant page (#30776)
SaxonF Dec 2, 2024
a92e34d
dont send current table or schema if not opted in (#30793)
SaxonF Dec 2, 2024
6d2c6cf
More oriole preview to alpha updates (#30790)
joshenlim Dec 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ export const GLOBAL_MENU_ITEMS: GlobalMenuItems = [
href: '/guides/local-development',
level: 'local_development',
},
{
label: 'Deployment',
icon: 'deployment',
href: '/guides/deployment',
level: 'deployment',
},
{
label: 'Self-Hosting',
icon: 'self-hosting',
Expand All @@ -82,12 +88,6 @@ export const GLOBAL_MENU_ITEMS: GlobalMenuItems = [
href: '/guides/integrations',
level: 'integrations',
},
{
label: 'Deployment',
icon: 'deployment',
href: '/guides/deployment',
level: 'deployment',
},
],
],
},
Expand Down Expand Up @@ -828,6 +828,16 @@ export const database: NavMenuConstant = {
},
],
},
{
name: 'OrioleDB',
url: undefined,
items: [
{
name: 'Overview',
url: '/guides/database/orioledb',
},
],
},
{
name: 'Access and security',
url: undefined,
Expand Down
137 changes: 137 additions & 0 deletions apps/docs/content/guides/database/orioledb.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
---
id: 'orioledb'
title: 'OrioleDB Overview'
description: "A storage extension for PostgreSQL which uses PostgreSQL'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 PostgreSQL'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 PostgreSQL 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"
zoomable
/>

<Admonition type="info">

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 PostgreSQL'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 PostgreSQL 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](https://supabase.com/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"
zoomable
/>

### Creating tables

To create a table using the OrioleDB storage engine just 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="info">

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)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions apps/docs/spec/cli_v1_commands.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
clispec: '001'
info:
id: cli
version: 1.223.10
version: 1.226.3
title: Supabase CLI
language: sh
source: https://github.com/supabase/cli
Expand Down Expand Up @@ -2907,7 +2907,7 @@ commands:

Recreates the local Postgres container and applies all local migrations found in `supabase/migrations` directory. If test data is defined in `supabase/seed.sql`, it will be seeded after the migrations are run. Any other data or schema changes made during local development will be discarded.

Note that since Postgres roles are cluster level entities, those changes will persist between resets. In order to reset custom roles, you need to restart the local development stack.
When running db reset with `--linked` or `--db-url` flag, a SQL script is executed to identify and drop all user created entities in the remote database. Since Postgres roles are cluster level entities, any custom roles created through the dashboard or `supabase/roles.sql` will not be deleted by remote reset.
examples:
- id: basic-usage
name: Basic usage
Expand Down
3 changes: 2 additions & 1 deletion apps/studio/components/grid/components/editor/TextEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ export const TextEditor = <TRow, TSummaryRow = unknown>({
})

const gridColumn = state.gridColumns.find((x) => x.name == column.key)
const initialValue = row[column.key as keyof TRow] as unknown as string
const rawValue = row[column.key as keyof TRow] as unknown
const initialValue = rawValue ? String(rawValue) : null
const [isPopoverOpen, setIsPopoverOpen] = useState(true)
const [value, setValue] = useState<string | null>(initialValue)
const [isConfirmNextModalOpen, setIsConfirmNextModalOpen] = useState(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ import {
Modal,
WarningIcon,
} from 'ui'
import { Admonition } from 'ui-patterns'
import { DocsButton } from 'components/ui/DocsButton'
import { useIsOrioleDb } from 'hooks/misc/useSelectedProject'

const orioleExtCallOuts = ['vector', 'postgis']

interface EnableExtensionModalProps {
visible: boolean
Expand All @@ -28,6 +33,7 @@ interface EnableExtensionModalProps {

const EnableExtensionModal = ({ visible, extension, onCancel }: EnableExtensionModalProps) => {
const { project } = useProjectContext()
const isOrioleDb = useIsOrioleDb()
const [defaultSchema, setDefaultSchema] = useState()
const [fetchingSchemaInfo, setFetchingSchemaInfo] = useState(false)

Expand Down Expand Up @@ -129,7 +135,17 @@ const EnableExtensionModal = ({ visible, extension, onCancel }: EnableExtensionM
{({ values }: any) => {
return (
<>
<Modal.Content>
<Modal.Content className="flex flex-col gap-y-2">
{isOrioleDb && orioleExtCallOuts.includes(extension.name) && (
<Admonition type="default" title="Extension is limited by OrioleDB">
<span className="block">
{extension.name} cannot be accelerated by indexes on tables that are using the
OrioleDB access method
</span>
<DocsButton abbrev={false} className="mt-2" href="https://supabase.com/docs" />
</Admonition>
)}

{fetchingSchemaInfo || isSchemasLoading ? (
<div className="space-y-2">
<ShimmeringLoader />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,16 @@ import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectConte
import { useDatabaseExtensionDisableMutation } from 'data/database-extensions/database-extension-disable-mutation'
import { DatabaseExtension } from 'data/database-extensions/database-extensions-query'
import { useCheckPermissions } from 'hooks/misc/useCheckPermissions'
import { useIsOrioleDb } from 'hooks/misc/useSelectedProject'
import { extensions } from 'shared-data'
import { Button, cn, Switch } from 'ui'
import {
Button,
cn,
Switch,
Tooltip_Shadcn_,
TooltipContent_Shadcn_,
TooltipTrigger_Shadcn_,
} from 'ui'
import { Admonition } from 'ui-patterns'
import ConfirmationModal from 'ui-patterns/Dialogs/ConfirmationModal'
import EnableExtensionModal from './EnableExtensionModal'
Expand All @@ -23,6 +31,7 @@ const ExtensionCard = ({ extension }: ExtensionCardProps) => {
const { project } = useProjectContext()
const siteUrl = process.env.NEXT_PUBLIC_SITE_URL || ''
const isOn = extension.installed_version !== null
const isOrioleDb = useIsOrioleDb()

const [isDisableModalOpen, setIsDisableModalOpen] = useState(false)
const [showConfirmEnableModal, setShowConfirmEnableModal] = useState(false)
Expand All @@ -31,6 +40,8 @@ const ExtensionCard = ({ extension }: ExtensionCardProps) => {
PermissionAction.TENANT_SQL_ADMIN_WRITE,
'extensions'
)
const orioleDbCheck = isOrioleDb && extension.name === 'orioledb'
const disabled = !canUpdateExtensions || orioleDbCheck

const X_PADDING = 'px-5'
const extensionMeta = extensions.find((item: any) => item.name === extension.name)
Expand Down Expand Up @@ -76,13 +87,26 @@ const ExtensionCard = ({ extension }: ExtensionCardProps) => {
{isDisabling ? (
<Loader2 className="animate-spin" size={16} />
) : (
<Switch
disabled={!canUpdateExtensions}
checked={isOn}
onCheckedChange={() =>
isOn ? setIsDisableModalOpen(true) : setShowConfirmEnableModal(true)
}
/>
<Tooltip_Shadcn_>
<TooltipTrigger_Shadcn_>
<Switch
disabled={disabled}
checked={isOn}
onCheckedChange={() =>
isOn ? setIsDisableModalOpen(true) : setShowConfirmEnableModal(true)
}
/>
</TooltipTrigger_Shadcn_>
{disabled && (
<TooltipContent_Shadcn_ side="bottom">
{!canUpdateExtensions
? 'You need additional permissions to toggle extensions'
: orioleDbCheck
? 'Project is using OrioleDB and cannot be disabled'
: null}
</TooltipContent_Shadcn_>
)}
</Tooltip_Shadcn_>
)}
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ import { MultiSelectOption } from 'ui-patterns/MultiSelectDeprecated'
import { MultiSelectV2 } from 'ui-patterns/MultiSelectDeprecated/MultiSelectV2'
import { FormItemLayout } from 'ui-patterns/form/FormItemLayout/FormItemLayout'
import { INDEX_TYPES } from './Indexes.constants'
import { useIsOrioleDb } from 'hooks/misc/useSelectedProject'
import { Admonition } from 'ui-patterns'
import { DocsButton } from 'components/ui/DocsButton'

interface CreateIndexSidePanelProps {
visible: boolean
Expand All @@ -46,6 +49,8 @@ interface CreateIndexSidePanelProps {
const CreateIndexSidePanel = ({ visible, onClose }: CreateIndexSidePanelProps) => {
const queryClient = useQueryClient()
const { project } = useProjectContext()
const isOrioleDb = useIsOrioleDb()

const [selectedSchema, setSelectedSchema] = useState('public')
const [selectedEntity, setSelectedEntity] = useState<string | undefined>(undefined)
const [selectedColumns, setSelectedColumns] = useState<string[]>([])
Expand Down Expand Up @@ -336,6 +341,7 @@ CREATE INDEX ON "${selectedSchema}"."${selectedEntity}" USING ${selectedIndexTyp
isReactForm={false}
>
<Select_Shadcn_
disabled={isOrioleDb}
value={selectedIndexType}
onValueChange={setSelectedIndexType}
name="selected-index-type"
Expand Down Expand Up @@ -367,6 +373,17 @@ CREATE INDEX ON "${selectedSchema}"."${selectedEntity}" USING ${selectedIndexTyp
</SelectContent_Shadcn_>
</Select_Shadcn_>
</FormItemLayout>
{isOrioleDb && (
<Admonition
type="default"
className="!mt-2"
title="OrioleDB currently only supports the B-tree index type"
description="More index types may be supported when OrioleDB is no longer in preview"
>
{/* [Joshen Oriole] Hook up proper docs URL */}
<DocsButton className="mt-2" abbrev={false} href="https://supabase.com/docs" />
</Admonition>
)}
</SidePanel.Content>
<SidePanel.Separator />
<SidePanel.Content>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export function ComputeSizeField({ form, disabled }: ComputeSizeFieldProps) {
free={showUpgradeBadge && form.watch('computeSize') === 'ci_micro' ? true : false}
/>
<p className="text-foreground-lighter">
Hardware resources allocated to your postgres database
Hardware resources allocated to your Postgres database
</p>
<NoticeBar
showIcon={false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import { BillingChangeBadge } from '../ui/BillingChangeBadge'
import { ComputeSizeRecommendationSection } from '../ui/ComputeSizeRecommendationSection'
import {
COMPUTE_BASELINE_IOPS,
DISK_LIMITS,
DiskType,
RESTRICTED_COMPUTE_FOR_IOPS_ON_GP3,
} from '../ui/DiskManagement.constants'
Expand Down
Loading
Loading