Sam
Explore posts from serversDTDrizzle Team
•Created by Sam on 10/12/2024 in #help
How to achieve a returning insert with relations
Hey so I noticed this is not currently possible, any advice on how I might be able to do this with the sql api?
https://github.com/drizzle-team/drizzle-orm/issues/2325
1 replies
DTDrizzle Team
•Created by Sam on 1/31/2024 in #help
Performance advice
So I have some queries that are taking over 15 seconds to run on vercel serverless with postgres supabase and brevo emails.
This is an example
https://gist.github.com/samducker/15c3c8e2e70cd86d0721cc584da0901b
So I already went ahead and created relevant indexes on the tables, and the parts of the request that can be parallelised are. However I wonder why this might still be so slow?
I did console time to check the email request is quite slow at 3 seconds. But it still doesnt plain why the request takes 15 secs in total.
Can I log the SQL that is generated somehow? Any advice on how best to investigate further what is the cause? Should I put the email part in a queue?
p.s. many of my other requests are much more performant.
11 replies
DTDrizzle Team
•Created by Sam on 12/11/2023 in #help
Running concurrent queries
Hi so maybe this is more of a SQL question sorry if so.
So I understand the benefit of transaction is to do all of those queries as a unit and you can roll back all the changes if one fails for example.
I also understand you can add await inside the transaction requests if you need them to be dependant on each other.
If I want to just send a bunch of non-dependant queries that get executed in parallel in one request to my DB for example updating a users name in the user table and there bio in the profiles table in one go, would it be best just to promise.all a bunch of normal queries or should I use transaction or batch in this case (I use supabase so not sure if batch is supported with drizzle for me)
Essentially just wondering about what the best methods for scenarios like the above is performance wise. I'm also using serverless so I prefer to limit my number of connections to db where possible.
And I assume promise.all approach might make multiple requests albeit in parallel?
p.s. I also found this question unanswered before making this post
https://discord.com/channels/1043890932593987624/1183316306552954960/1183316306552954960
5 replies
DTDrizzle Team
•Created by Sam on 11/16/2023 in #help
Explaining the differences between .references() and relations function
Hi I'm a bit unclear in the example why the comments table in this example does not use the .references() function on the author id field. Is this because the .relations() method and relations({one}) are achieveing the same thing but two different approaches?
https://orm.drizzle.team/docs/rqb#one-to-many
5 replies