Files
Ali WaseemandJordi Enric 01d12e83c1 docs: migrate logs queries to ClickHouse and link to the SQL Editor (#49273)
The 47 BigQuery-era logs queries across these 20 pages error on the
ClickHouse-backed logs engine ("Backend error! Retry your query."). This
converts them per the rules in `apps/studio/lib/ai/clickhouse-logs.ts`
and repoints every Logs Explorer link at the SQL Editor with the query
source set to **Logs**, since the Logs Explorer is being retired. Also
fixes two stale PostgreSQL 12 links in the tables guide.

Each of the 14 prefilled links was verified to decode back to exactly
the SQL shown on its page. One caveat for review:
`response.headers.proxy_status` in `postgrest-error-codes.mdx` is
unverified — it isn't in the published field reference, and the test
project had no `edge_logs` traffic to confirm against.

Fixes DOCS-1331

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **Documentation**
- Updated database, storage, API, and Edge Function logging guides to
use the SQL Editor and current Logs interface.
- Replaced legacy Log Explorer and BigQuery examples with current query
syntax and structured log fields.
- Refreshed troubleshooting queries for error diagnosis, filtering,
aggregation, and performance analysis.
- Improved examples with clearer source filters, status handling,
request details, joins, and result limits.
- Updated PostgreSQL documentation links and clarified how API error
codes appear in responses.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Jordi Enric <jordi.err@gmail.com>
2026-08-20 17:07:25 +02:00

79 lines
2.5 KiB
Plaintext

---
id: 'storage-bandwidth'
title: 'Bandwidth & Storage Egress'
description: 'How to calculate the Bandwidth and Storage Egress'
subtitle: 'Bandwidth & Storage Egress'
sidebar_label: 'Bandwidth & Storage Egress'
---
## Bandwidth & Storage egress
Free Plan Organizations in Supabase have a limit of 10 GB of bandwidth (5 GB cached + 5 GB uncached). This limit is calculated by the sum of all the data transferred from the Supabase servers to the client. This includes all the data transferred from the database, storage, and functions.
### Checking Storage egress requests in the SQL Editor
You can use the following query to get the number of requests for each object. Run it in the [SQL Editor](/dashboard/project/_/sql/new?skip=true&source=logs) with the query source set to **Logs**.
```sql
select
log_attributes['request.method'] as http_verb,
log_attributes['request.path'] as filepath,
(log_attributes['response.headers.cf_cache_status'] = 'HIT') as cached,
count() as num_requests
from logs
where source = 'edge_logs'
and (
log_attributes['request.path'] like '%storage/v1/object/%'
or log_attributes['request.path'] like '%storage/v1/render/%'
)
and log_attributes['request.method'] = 'GET'
group by http_verb, filepath, cached
order by num_requests desc
limit 100;
```
Example of the output:
```json
[
{
"filepath": "/storage/v1/object/sign/large%20bucket/20230902_200037.gif",
"http_verb": "GET",
"cached": 1,
"num_requests": 100
},
{
"filepath": "/storage/v1/object/public/demob/Sports/volleyball.png",
"http_verb": "GET",
"cached": 0,
"num_requests": 168
}
]
```
### Calculating egress
If you already know the size of those files, you can calculate the egress by multiplying the number of requests by the size of the file.
You can also get the size of the file with the following cURL:
```bash
curl -s -w "%{size_download}\n" -o /dev/null "https://my_project.supabase.co/storage/v1/object/large%20bucket/20230902_200037.gif"
```
This will return the size of the file in bytes.
For this example, assume that `20230902_200037.gif` has a file size of 3 megabytes and `volleyball.png` has a file size of 570 kilobytes.
Now, we have to sum all the egress for all the files to get the total egress:
```
100 * 3MB = 300MB
168 * 570KB = 95.76MB
Total Egress = 395.76MB
```
You can see that these values can get quite large, so it's important to keep track of the egress and optimize the files.
### Optimizing egress
See our [scaling tips for egress](/docs/guides/storage/production/scaling#egress).