Skip to main content
ENGINEERING BLOG

Real-world
engineering.

Production notes on Python, FastAPI, React, security architecture and AI-augmented development. No tutorials — actual patterns from deployed systems.

RSS
AI Site Search
Filter:
4
#PostgreSQL#SaaS Billing#Multi-tenancy#Database Design#Financial Data

PostgreSQL Generated Columns for Tenant Cost Attribution: Computing Per-User AI Inference Spend Without Application-Layer ETL

Use PostgreSQL's generated columns to automatically calculate tenant billing amounts based on AI feature usage (tokens consumed × feature tier × region multiplier), keeping your billing logic in the database schema rather than scattered across FastAPI services, eliminating data drift and making audits trivial.

5 June 2026
5 min read Read