Get started
Overview PostgreSQL MySQL SQLite Manage schema
Overview Column types Indexes & Constraints Migrations Views Schemas Access your data
Query Select Insert Update Delete Filters Joins Magic sql`` operator Performance
Queries Serverless Advanced
Set Operations Transactions Batch Dynamic query building Read Replicas Custom types Goodies Extensions
ESLint Plugin drizzle-zod drizzle-typebox drizzle-valibot Drizzle Serverless performance
You can get immense benefits with serverless functions
like AWS Lamba or Vercel Server Functions (they’re AWS Lamba based),
since they can live up to 15mins and reuse both database connections and prepared statements.
On the other, hand edge functions
tend to clean up straight after they’re invoked which leads to little to no performance benefits.
To reuse your database connection and prepared statements you just have to declare them outside of handler scope:
const databaseConnection = ...;
const db = drizzle(databaseConnection);
const prepared = db.select().from(...).prepare();
// AWS handler
export const handler = async (event: APIGatewayProxyEvent) => {
return prepared.execute();
}