© 2026 Hedgehog Software, LLC
Twitter
GitHub
Discord
System
Light
Dark
More
Communities
Docs
About
Terms
Privacy
Search
Star
Feedback
Setup for Free
How to check if a row exists in Drizzle? - Drizzle Team
DT
Drizzle Team
•
3y ago
•
5 replies
Zamiel
How to check if a row exists in Drizzle?
According to this StackOverflow post
:
https://stackoverflow.com/questions/7471625/fastest-check-if-row-exists-in-postgresql
The most performant way to check if a row exists is as follows
:
SELECT
EXISTS
(
SELECT
1
FROM
foo
WHERE
id
=
123
)
SELECT
EXISTS
(
SELECT
1
FROM
foo
WHERE
id
=
123
)
How do you accomplish this in Drizzle
?
Drizzle Team
Join
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,959
Members
View on Discord
Resources
ModelContextProtocol
ModelContextProtocol
MCP Server
Similar Threads
Was this page helpful?
Yes
No
Recent Announcements
Similar Threads
How to get a plain row schema using drizzle-zod?
DT
Drizzle Team / help
13mo ago
how can i delete if row exists (where eq(xxx)), otherwise insert, in one query?
DT
Drizzle Team / help
3y ago
Insert row, on conflict do nothing, and "return the conflicted row if it exists" - in 1 query?
DT
Drizzle Team / help
17mo ago
Is it normal for drizzle to generate SQLs without "IF NOT EXISTS"?
DT
Drizzle Team / help
2y ago