Get started
Overview PostgreSQL MySQL SQLite Manage schema
Overview Column types Indexes & Constraints Sequences Migrations Views Schemas Extensions Access your data
Query Select Insert Update Delete Filters Joins Magic sql`` operator Performance
Queries Serverless Advanced
Set Operations Generated Columns Transactions Batch Dynamic query building Read Replicas Custom types Goodies Extensions
Prisma ESLint Plugin drizzle-zod drizzle-typebox drizzle-valibot drizzle-graphql Query performance
When it comes to Drizzle — we’re a thin TypeScript layer on top of SQL with almost 0 overhead and to make it actual 0, you can utilise our prepared statements API.
When you run query to the database there’re several things that happens:
- all the configurations of the query builder got concatenated to the SQL string
- that string and params are sent to the database driver
- driver compiles SQL query to the binary SQL executable format and sends it to the database
With prepared statements you do SQL concatenation once on the Drizzle ORM side and then database driver is able to reuse precompiled binary SQL instead of parsing query all the time. It has extreme performance benefits on large SQL queries.
Different database drivers support prepared statements in different ways and sometimes Drizzle ORM you can go faster than better-sqlite3 driver.
Prepared statement
PostgreSQL
MySQL
SQLite
Placeholder
Whenever you need to embed a dynamic runtime value - you can use the sql.placeholder(...)
api
PostgreSQL
MySQL
SQLite