---
id: w1/m25/t003
title: "`sizes` endpoint: database/table sizes via `pg_database_size`/`pg_total_relation_size`"
worker: worker1
status: todo
estimate: 30m
depends_on: []
---

## Objective

Expose Render's `GET /postgres/{id}/sizes` equivalent across REST/GraphQL/MCP.

## Context

- `lego/backend/internal/postgres/` existing query path (see t001).

## Steps

1. Add a `Sizes` verb: total database size (`pg_database_size`) plus per-table sizes (`pg_total_relation_size` over `pg_catalog`/`information_schema` enumeration).
2. Wire into REST (`GET /v1/postgres/{id}/sizes`), GraphQL, MCP.

## Files

- `lego/backend/internal/postgres/` observability verb + REST/GraphQL/MCP adapters

## Acceptance criteria

- [ ] Endpoint returns real database + per-table sizes from a live CNPG cluster on all three surfaces.

## Out of scope

- Historical size trending — this is a live snapshot only, matching Render.
