BACK TO BLOG
GoORMPerformancePostgreSQL

Building a High-Performance ORM in Go: Lessons from Flash ORM

How we built an ORM that outperforms Prisma and Drizzle by 3-12x — architecture decisions, SQLC integration, and the tradeoffs we made.

March 15, 20268 min read

Why We Built Flash ORM

Most Go developers reach for GORM, but GORM has a well-known performance problem: it uses reflection heavily, which adds overhead on every query. We wanted something that felt like Prisma (schema-first, type-safe) but ran at Go's native speed.

The Architecture

Flash ORM is built on top of SQLC — a tool that generates type-safe Go code from raw SQL. Instead of building a runtime query builder, we generate code at schema-definition time. This means zero reflection at runtime.

// Define your schema
model User {
  id    Int    @id @default(autoincrement())
  email String @unique
  name  String
}

// Flash generates this for you
func (q *Queries) GetUser(ctx context.Context, id int32) (User, error) {
  return q.db.QueryRowContext(ctx, getUser, id).Scan(...)
}

Benchmark Results

We ran benchmarks against Prisma (Node.js) and Drizzle on identical hardware with PostgreSQL:

OperationFlash ORMDrizzlePrisma
Single read0.8ms4.2ms9.6ms
Bulk insert (1000)12ms48ms97ms
Complex join2.1ms8.7ms19ms

The 3-12x improvement comes from two things: no reflection, and connection pooling baked in by default.

Safe Migrations

One thing we're proud of is transaction-based migrations. Every migration runs inside a transaction — if any step fails, the entire migration rolls back. No more half-applied schema changes in production.

flash migrate up   // applies pending migrations
flash migrate down // rolls back last migration
flash migrate status // shows current state

Flash Studio

We also built a visual database manager (Flash Studio) that lets you browse tables, run queries, and export data in JSON, CSV, or SQLite format — all from a local web UI that spins up with flash studio.

What's Next

Multi-database transactions across PostgreSQL and MySQL, and a VS Code extension for schema autocomplete. The project is open source at github.com/Lumos-Labs-HQ/flash — contributions welcome.

All PostsRana Dolui