Skip to content

Commit 98797fc

Browse files
authored
feat: improved disk size insights (supabase#30827)
1 parent 7ca43d8 commit 98797fc

File tree

10 files changed

+260
-112
lines changed

10 files changed

+260
-112
lines changed

apps/docs/content/guides/platform/compute-and-disk.mdx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,13 +108,14 @@ Be aware that increasing IOPS or throughput incurs additional charges.
108108

109109
When selecting your disk, it's essential to focus on the performance needs of your workload. Here's a comparison of our available disk types:
110110

111-
| | General Purpose SSD (gp3) | High Performance SSD (io2) |
112-
| ----------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
113-
| **Use Case** | General workloads, development environments, small to medium databases | High-performance needs, large-scale databases, mission-critical applications |
114-
| **Max Disk Size** | 16 TB | 60 TB |
115-
| **Max IOPS** | 16,000 IOPS (at 32 GB disk size) | 80,000 IOPS (at 80 GB disk size) |
116-
| **Throughput** | 125 MiB/s (default) to 1,000 MiB/s (maximum) | Automatically scales with IOPS |
117-
| **Best For** | Great value for most use cases | Low latency and very high IOPS requirements |
111+
| | General Purpose SSD (gp3) | High Performance SSD (io2) |
112+
| ----------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
113+
| **Use Case** | General workloads, development environments, small to medium databases | High-performance needs, large-scale databases, mission-critical applications |
114+
| **Max Disk Size** | 16 TB | 60 TB |
115+
| **Max IOPS** | 16,000 IOPS (at 32 GB disk size) | 80,000 IOPS (at 80 GB disk size) |
116+
| **Throughput** | 125 MiB/s (default) to 1,000 MiB/s (maximum) | Automatically scales with IOPS |
117+
| **Best For** | Great value for most use cases | Low latency and very high IOPS requirements |
118+
| **Pricing** | Disk: 8 GB included, then $0.125 per GB<br/>IOPS: 3,000 included, then $0.024 per IOPS<br/>Throughput: 125 Mbps included, then $0.95 per Mbps | Disk: $0.195 per GB<br/>IOPS: $0.119 per IOPS<br/>Throughput: Scales with IOPS at no additional cost |
118119

119120
For general, day-to-day operations, gp3 should be more than enough. If you need high throughput and IOPS for critical systems, io2 will provide the performance required.
120121

apps/docs/content/guides/platform/database-size.mdx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,22 @@ Once you have reclaimed space, you can run the following to disable [read-only](
139139
set default_transaction_read_only = 'off';
140140
```
141141

142+
### Disk Size Distribution
143+
144+
You can check the distribution of your disk size on your [project's compute and disk page](/dashboard/_/settings/compute-and-disk).
145+
146+
![Disk Size Distribution](/docs/img/guides/platform/database-size/disk-size-distribution.png)
147+
148+
Your disk size usage falls in three categories:
149+
150+
- **Database** - Disk usage by the database. This includes the actual data, indexes, materialized views, ...
151+
- **WAL** - Disk usage by the write-ahead log. The usage depends on your WAL settings and the amount of data being written to the database.
152+
- **System** - Disk usage reserved by the system to ensure the database can operate smoothly. Users cannot modify this and it should only take very little space.
153+
142154
### Reducing disk size
143155

144156
Disks don't automatically downsize during normal operation. Once you have [reduced your database size](/docs/guides/platform/database-size#database-size), they _will_ automatically "right-size" during a [project upgrade](/docs/guides/platform/upgrading). The final disk size after the upgrade is 1.2x the size of the database with a minimum of 8 GB. For example, if your database size is 100GB, and you have a 200GB disk, the size after a project upgrade will be 120 GB.
145157

158+
In case you have a large WAL directory, you may [modify WAL settings](/docs/guides/database/custom-postgres-config) such as `max_wal_size`. Use at your own risk as changing these settings can have side effects. To query your current WAL size, use `SELECT SUM(size) FROM pg_ls_waldir()`.
159+
146160
In the event that your project is already on the latest version of Postgres and cannot be upgraded, a new version of Postgres will be released approximately every week which you can then upgrade to once it becomes available.
64 KB
Loading

apps/studio/components/interfaces/DiskManagement/fields/ComputeSizeField.tsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { BillingChangeBadge } from '../ui/BillingChangeBadge'
2323
import FormMessage from '../ui/FormMessage'
2424
import { NoticeBar } from '../ui/NoticeBar'
2525
import { InstanceSpecs } from 'lib/constants'
26+
import { DocsButton } from 'components/ui/DocsButton'
2627

2728
/**
2829
* to do: this could be a type from api-types
@@ -137,6 +138,14 @@ export function ComputeSizeField({ form, disabled }: ComputeSizeFieldProps) {
137138
<p className="text-foreground-lighter">
138139
Hardware resources allocated to your Postgres database
139140
</p>
141+
142+
<div className="mt-3">
143+
<DocsButton
144+
abbrev={false}
145+
href="https://supabase.com/docs/guides/platform/compute-and-disk"
146+
/>
147+
</div>
148+
140149
<NoticeBar
141150
showIcon={false}
142151
type="default"

apps/studio/components/interfaces/DiskManagement/fields/DiskSizeField.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ import { DiskTypeRecommendationSection } from '../ui/DiskTypeRecommendationSecti
1919
import FormMessage from '../ui/FormMessage'
2020
import { InputPostTab } from '../ui/InputPostTab'
2121
import { InputResetButton } from '../ui/InputResetButton'
22+
import { Admonition } from 'ui-patterns'
23+
import Markdown from 'markdown-to-jsx'
24+
import { DocsButton } from 'components/ui/DocsButton'
2225

2326
type DiskSizeFieldProps = {
2427
form: UseFormReturn<DiskStorageSchemaType>
@@ -148,6 +151,13 @@ export function DiskSizeField({
148151
{includedDiskGB > 0 &&
149152
subscription?.plan.id &&
150153
`Your plan includes ${includedDiskGB} GB of disk size for ${watchedStorageType}.`}
154+
155+
<div className="mt-3">
156+
<DocsButton
157+
abbrev={false}
158+
href="https://supabase.com/docs/guides/platform/database-size"
159+
/>
160+
</div>
151161
</span>
152162
<DiskTypeRecommendationSection
153163
form={form}

0 commit comments

Comments
 (0)