kratious
DTDrizzle Team
•Created by sakura on 10/6/2023 in #help
[Error] Using Drizzle with Neon DB
Sorry didn't see that you were using @Neondatabase/serverless. Drizzle doesn't use prepared statements for all requests internally
Just wondering, what are the names of the prepared statements that don't exist?
12 replies
DTDrizzle Team
•Created by sakura on 10/6/2023 in #help
[Error] Using Drizzle with Neon DB
postgresjs auto generates prepared statements by default if you're using that
https://github.com/porsager/postgres#prepared-statements
12 replies
DTDrizzle Team
•Created by saM69420 on 10/5/2023 in #help
Creating a Case-Insensitive Unique Index
Ah OK, then that's a bug with drizzle-kit
I think the indexing approach is perfectly reasonable as long as you follow this
The database can use a function-based index if the exact expression of the index definition appears in an SQL statementSee: https://use-the-index-luke.com/sql/where-clause/functions/case-insensitive-search
8 replies
DTDrizzle Team
•Created by saM69420 on 10/5/2023 in #help
Creating a Case-Insensitive Unique Index
You're adding a unique constraint which doesn't have the flexibility of lowercasing
Could try it with this
https://orm.drizzle.team/docs/indexes-constraints#indexes
8 replies
DTDrizzle Team
•Created by zerokelvin on 9/18/2023 in #help
Why is my query so much slower when filter by all four latitude/longitude bounds than just three?
What you could try is finding the facility you need first and then doing the joins in a separate query
11 replies
DTDrizzle Team
•Created by zerokelvin on 9/18/2023 in #help
Why is my query so much slower when filter by all four latitude/longitude bounds than just three?
In prisma the
include
/in
queries are split up into separate queries.
See here: https://www.prisma.io/docs/guides/performance-and-optimization/query-optimization-performance#solving-n1-with-include
As you've seen in the logs, drizzle keeps these queries in one huge query, this leaves the responsibility on the DB planner on how the queries are ran, sometimes the planner is not smart enough to optimize such cases.
Looking and thinking about the query, my intuition on how it would run fast would follow something like the following steps:
1. Filter out all facility rows based on the clauses in the section
2. Work on left joining the other tables from filtered facility rows
In your case the planner is probably optimizing incorrectly and does it in this way:
1. Work on left joining all the other tables from the unfiltered facility rows
2. Filter out rows from previous step based on the where clauses11 replies
DTDrizzle Team
•Created by msu on 10/2/2023 in #help
Does Drizzle autogenerate prepared statements under the hood?
pg doesn't. You can turn off the autogenerating with
prepare: false
for postgres.js too9 replies
DTDrizzle Team
•Created by msu on 10/2/2023 in #help
Does Drizzle autogenerate prepared statements under the hood?
PostgresJS does autogenerate, if you're using that
https://github.com/porsager/postgres#prepared-statements
9 replies
DTDrizzle Team
•Created by delight on 10/2/2023 in #help
Attempting to get a Joined Subquery query into drizzle crud api
I think the issue is with converting the Select into a Subquery. Append an
.as
at the end of sq
, this mirrors exactly what you have in the native SQL
36 replies