Skip to main content
Architecture10 min read

なぜ私は(ほとんどの場合)ORMではなく生SQLを使うのか

ORMは便利ですが、限界もあります。185テーブルのデータベースで生成されたクエリのデバッグに30秒かかった経験から、ホットパスでは生SQLに切り替えました。それぞれの適切な使いどころをご紹介します。

Part ofProduct Systems->
By Jason TeixeiraJanuary 18, 2026
SQLPostgreSQLORMPrismaDatabasePerformance
Share:
On this page

これは議論を呼ぶ内容でしょう。まずは免責事項から:ORMは悪くありません。Prisma、SQLAlchemy、Drizzle — いずれも優秀な人々が作った優れたツールです。私も使っています。

しかし、Nexuralプラットフォーム — 185のテーブル、複雑な結合、マテリアライズドビュー、行レベルセキュリティ — において、クリティカルなパスでは生SQLが正しい選択でした。その理由をお話しします。

切り替えた瞬間

私はPrismaを使っていました。ダッシュボードはローカルでは200msで読み込まれました。本番環境で実データを使うと、4.2秒かかりました。

私は\\

Reader route

article -> proof -> offer

ReadClusterProofScope

cluster

Product Systems

intent

Architecture

route

next step

What to do with this

Turn the note into a build path.

If this topic maps to a real business problem, keep reading the cluster, study the academy path, or route the work into a scoped engagement.

Jason Teixeira
Written by
Jason Teixeira
Founder, Sage Ideas Studio · Principal Engineer
livebuild 5d6c8652026-08-05 06:00Z
// solo studio// no analytics resold// every commit human-reviewed