MrIzzat
MrIzzat
DTDrizzle Team
Created by MrIzzat on 3/18/2025 in #help
Does the normal query use inner join under the hood?
What does the db.query() function use under the hood? Is it better to use innerJoin() for complex queries rather than the normal query(), findMany() and with:?
1 replies
DTDrizzle Team
Created by MrIzzat on 2/23/2025 in #help
Which JavaScript library that works alongside Drizzle ORM is better for pooling, pg.js or postgresjs
I'm working on a JavaScript/TypeScript backend project using drizzle and PostgreSQL where I came across pooling for the first time. I found there are several ways to integrate pooling with drizzle ORM but they each rely on different libraries. There is the pg/node-postgres method which goes like this:
import { drizzle } from 'drizzle-orm/node-postgres';
import { Pool } from 'pg';

const pool = new Pool({
connectionString: process.env.DATABASE_URL as string,
max: 10
})

export const db = drizzle(pool, {
schema: schema,
logger: true,
});
import { drizzle } from 'drizzle-orm/node-postgres';
import { Pool } from 'pg';

const pool = new Pool({
connectionString: process.env.DATABASE_URL as string,
max: 10
})

export const db = drizzle(pool, {
schema: schema,
logger: true,
});
And the Postgres.js version which goes like this:
import postgres from 'postgres';
import { drizzle } from 'drizzle-orm/postgres-js';

const pool = postgres(process.env.DATABASE_URL as string, { max: 10 });
export const db = drizzle(pool, {
schema: schema,
logger: true,
});
import postgres from 'postgres';
import { drizzle } from 'drizzle-orm/postgres-js';

const pool = postgres(process.env.DATABASE_URL as string, { max: 10 });
export const db = drizzle(pool, {
schema: schema,
logger: true,
});
Is there a difference in performance between these two methods? If so, which one is the better option? Note the project uses TypeScript
2 replies