Prisma 5: Faster By Default | Prime Reacts

  Рет қаралды 38,556

ThePrimeTime

ThePrimeTime

10 ай бұрын

Recorded live on twitch, GET IN
/ theprimeagen
Article: www.prisma.io/blog/prisma-5-f....
Author: Alex Ruheni | Twitter: @ / ruheni_alex
MY MAIN YT CHANNEL: Has well edited engineering videos
/ theprimeagen
Discord
/ discord
Have something for me to read or react to?: / theprimeagenreact

Пікірлер: 93
@beni69
@beni69 10 ай бұрын
pris'MA NUTS
@ThePrimeTimeagen
@ThePrimeTimeagen 10 ай бұрын
Yes pls
@austincodes
@austincodes 10 ай бұрын
😂😂😂
@Philopater-Phoneix
@Philopater-Phoneix 10 ай бұрын
XD
@iliassglitch
@iliassglitch 10 ай бұрын
Hilarity 😂
@AlohaBrent
@AlohaBrent 10 ай бұрын
Gottem
@Cyber_Lanka
@Cyber_Lanka 10 ай бұрын
Clarification about that previous article. That relationship issue only happens when you specify relationMode = "prisma" in the schema file. This tells Prisma to emulate foreign keys because the underlying DBMS doesn't support that. In other cases, Prisma works the same way. It will do all the joins using the DBMS/SQL, not using their Rust engine thing.
@darshandev1754
@darshandev1754 8 ай бұрын
thats great to hear
@user-mm6op9sz7t
@user-mm6op9sz7t 5 ай бұрын
This doesn't seem to be true in my case. I have no relationMode setting in my schema file and I see individual select statements on all tables when fetching with joins. In other words of you want to join table a and b prisma will do two individual select statements on each table. I am using postgres so it is not because prisma is defaulting to its 'prisma' relationMode
@alsjourney
@alsjourney 10 ай бұрын
Love these videos. Even though you just react but the input you provide is so valuable
@mathijsfrank9268
@mathijsfrank9268 10 ай бұрын
"Most of what youll be doing is basic sql." Tell that to my work where we write almost all business logic in stored procedures that are hundreds of lines long and have existed for over 20 years....
@SergiobgEngineer
@SergiobgEngineer 10 ай бұрын
holy fuck, do we work n the same company? I don't get why my company uses a fucking repository pattern if the chances of us moving to another database are 0% since half of the company's business logic is written in PL SQL right now. Might as well just start calling the database procedures from the Core layer. 😅
@dacam29
@dacam29 10 ай бұрын
You work for the government or in a big insurance/bank cie!? 😂
@Adelphos0653
@Adelphos0653 10 ай бұрын
Lol, we use prisma, but we refuse to use stored procedures. We want business logic in our primary code
@travishatch6246
@travishatch6246 10 ай бұрын
Lol just had to troubleshoot a 2000+ line stored procedure that generates its own dynamic SQL statements and inserts them into a temp table from a cursor nested in a cursor Then it begins a transaction and opens a cursor to execute the previous generated SQL statements💀
@travishatch6246
@travishatch6246 10 ай бұрын
​@@Adelphos0653we use an database schema from pre Y2K and up until a year ago all logic was done in the database. Mainly table triggers, dynamic SQL compiling and executing during runtime (to allow for the installed app to be independent of form field additions) and stored procedures.
@blenderpanzi
@blenderpanzi 10 ай бұрын
The whole separate process and IPC thing is a big WTF to me. For an ORM? There is a library option where a native library is loaded and no separate process is started. That option was broken for a while because of wrong flags for dlopen() that caused a segmentation fault because Prisma links a different OpenSSL version than NodeJS does.
@IzioRomain
@IzioRomain 10 ай бұрын
Really great to have commentary after the reading with the community 👍 Was adding more context
@frosty2912
@frosty2912 10 ай бұрын
The GraphQL like way transmitted the entire schema to the DB each time, the new way just transmits the bits you need.
@oscarmugambi
@oscarmugambi 10 ай бұрын
Is there an archive for full length streams? Can't seem to find any on twitch
@guidobit
@guidobit 10 ай бұрын
I have a feeling Prisma is the Mongo for ORMs: traction trough marketing budget.
@night23412
@night23412 10 ай бұрын
yeah..
@zzzyyyxxx
@zzzyyyxxx 10 ай бұрын
Unlike Mongo, Prisma is actually good.
@Alex-kb2ws
@Alex-kb2ws 10 ай бұрын
​@@zzzyyyxxxif it's so good, write a computed field query in prisma
@HalfMonty11
@HalfMonty11 10 ай бұрын
Have you used it? It's not trying to be the fastest ORM in the world. If you want absolute max performance all the time, you don't want an ORM. Hand rolled optimized SQL queries is going to win every time. However, what Prisma is amazing at is great support of the most common relational db types and great tooling that allows you to either work with code first or db first approach, generating your models and client and types for you, reducing how much code you have to write and speeding up your code delivery. 3 cli commands and it'll set up your project for you, and you can just start using the client. It gets you off the ground so easy and the docs are great, usage is intuitive. Stop trying to fit it into what it's not trying to be and you might then appreciate it for what it is. If you are going to take the time to include a dependency, it should bring something to the table and what prisma brings is a massive elimination of code and effort on the developers part. That's worth something.
@zzzyyyxxx
@zzzyyyxxx 10 ай бұрын
@@Alex-kb2ws I've literally never had to do that in either Prisma or SQL. If your argument is just, why can't it do something I need in 0.1% of scenarios, then, that's the exception that proves the rule.
@wchorski
@wchorski 10 ай бұрын
wondering about anyone's experience with KeystoneJS. Ive started using it for a year, I think it has a great DX but have a feeling it might turn into a big foot gun
@jaymartinez311
@jaymartinez311 10 ай бұрын
Can somebody tell me how i can just use postgres. No orm’s no abstraction just postgres. Then maybe a package to handle migrations. I know rds for aws maybe with postgres but nothing else?
@Xe054
@Xe054 10 ай бұрын
What does Prime mean when he says he prefers query builders? What are some good examples of them? Does Drizzle fall into that category?
@dima1478
@dima1478 10 ай бұрын
Drizzle is still ORM. ORM interface with the database so that you can OOP instead of writing SQL. Query builders just make writing SQL easier, but there is no abstraction between.
@spamviking8591
@spamviking8591 10 ай бұрын
Is this considered good performance? I was working with a bunch of scrubs on a project written in PHP back in 2017. Since none of them could be trusted to do things properly, I wrote an entire query string based query builder that interpreted db relationships based off of foreign keys that could build a complex query with multi layer joins and apply the permissions before executing the query and still managed to return almost every response in less than 150ms on a MariaDB database.
@nikhiljugdan724
@nikhiljugdan724 10 ай бұрын
And how much time did you spend developing it ?
@spamviking8591
@spamviking8591 10 ай бұрын
@@nikhiljugdan724 a weekend.
@jdal21
@jdal21 10 ай бұрын
Sticking with Drizzle though
@johnychinese
@johnychinese 10 ай бұрын
What a name Got me there😂
@renatocron
@renatocron 10 ай бұрын
so, i'm here, 15:05, din't watch no further (and i didn't had a chance to watch the previous episode you talked about), and I'm also interested in how prisma will deal with join and/or competition (hi drizzle). I like the ideia that some queries can be optimized with joins (most of then can, indeed), the real issue is, how to break down the queries into smaller queries without the database feedback, because, if you follow perl/DBIC way to remap/change the query order by to met the query spec, then you potentially get back many many rows, wasting CPU (and in the AWS, bad yet, bandwidth!). So, over simple queries this is already solved by current prisma engine (eg: load all posts with created by (author name+date), updated by(author name+date), if the author repeat in many, the author only get retured once). Exploring more into the more specialized queries, trying new solutions, that depends heavily in the use case, you can change joins by JSON queires or functions that return stable objects (so can be cache inside one transaction in read committed, assuming that this is the most used tx mode) also can lead to moving the load from the process (nodejs:rust-prisma-bind/distributed) to the (most of the time much more expensive aurora/rds) database. So. it's not simple. Prisma can be better, but's not an easy or clear solution to go towards
@lilililliilil
@lilililliilil 10 ай бұрын
still it takes about 3~5 seconds at start. so annoying. thinking to move to Drizzle
@SuperDevastetor
@SuperDevastetor 10 ай бұрын
Where's the "yesterday's seething article" at?
@MegaMech
@MegaMech 10 ай бұрын
I had this on 1.75 speed by default when the video started. Would have been funny if the editor had edited like that as a joke.
@TurtleKwitty
@TurtleKwitty 10 ай бұрын
Prisma half works with postgres, if they did properly there would be 0 reasons to use mongo, post handles json internally and a TON of features on top of everything mongo has but prisma hides it. The number of fucking times ive had my backend/DB engineer say postgres sucks cause it doesnt handle XYZ but its just prisma hiding that it does is wild
@huge_letters
@huge_letters 10 ай бұрын
is it prisma's fault a lotta people jump to MongoDB as their first option when they need a db instead of postres or mysql?
@TurtleKwitty
@TurtleKwitty 10 ай бұрын
​@@huge_letters Prismas fault people go to mongo first? no. Prismas fualt that people don't see there is so much strong tooling in other DBs because prisma is pushed so hard as /the/ single way to access a DB? yes.
@huge_letters
@huge_letters 10 ай бұрын
@@TurtleKwitty I guess but isn't orm supposed to be for dummies? I'm a dummy and use an orm cause it's easy for me - if you're a db engineer you should know SQL and it's tooling. At least that's the way I see it
@TurtleKwitty
@TurtleKwitty 10 ай бұрын
@@huge_letters you'd think so but so often people just get comfortable in a specific tool/library and don't want to branch out. Orm in and of itself isn't for dummies just better DX, some are more simple some are more complex, some have a simple initial interface but still give access to the full complexity when you need it; that last point (that Prisma doesn't do) is exactly the problem I have with Prisma, they went with simple then became the defacto tool so now people are kinda stuck with surface level tooling. It would be a fairly easy solve, just learn to use the db directly but (personal theory) react is pushed so hard as the defacto webdev framework and is unusable without a ton of wrappers and libraries that webdevs engrained in react especially are hard stuck thinking that is there isn't a wrapper to make things usable you just can't use it at all.
@yojou3695
@yojou3695 10 ай бұрын
it's amazing how people in javascript world STILL havent figured out a half decent orm
@zaneearldufour
@zaneearldufour 10 ай бұрын
There's a third party python client for Prisma that is awesome. That's all I know
@kubre
@kubre 10 ай бұрын
I don't know I hate kinda bcz it keeps me making restart typescript lsp
@FunctionGermany
@FunctionGermany 10 ай бұрын
pin the generated client file in your IDE. it's annoying and a workaround, but it helps.
@CamembertDave
@CamembertDave 10 ай бұрын
Graph Queel, omg I'm dying
@blenderpanzi
@blenderpanzi 10 ай бұрын
I don't know what other article this video refers to about the joins (don't see a video from yesterday about the topic) and I don't actually know how Prisma is actually doing it. But if it happens to refer to the include mechanism, of course these are two queries? Like if you query all users born after a certain date and all their files: prisma.user.findMany({ where: { birthdate: { ge: date } }, include: { files: true } }) I assume it will do these SQL queries (like many other ORMs do too): SELECT * FROM user WHERE birthdate >= ?; SELECT * FROM file WHERE user_id IN (?); Where the ? in the second query is the list of user IDs returned in the first query. If it would do this instead: SELECT * FROM user LEFT JOIN file ON user.id = file.user_id WHERE birthdate >= ?; Yes, it would be one query, but it would duplicate all fields of user for each file. That might explode the size of the returned result. If you then have even more includes it would explode the result size exponentially. Don't think that would be good. Don't think that would be what you would write by hand (except when you know the involved joins still keep the result set small, like there are one 3 columns in user and you only have one join). I guess one could have an optimization for when there are only very few columns of user selected and not too many includes, than it could use joins. Again, I haven't checked how Prisma actually does this, but I would assume it happens that way for these reasons. Would you use join in any case?
@BattleMercy-uf2zy
@BattleMercy-uf2zy 8 ай бұрын
15:44 Based.
@devmesh5340
@devmesh5340 10 ай бұрын
Dungeon what?😂😂
@Yupppi
@Yupppi 4 ай бұрын
Talking about lazy load, why does C++ endlessly yap about "no cost abstractions, you only pay for what you use" and then #include for some single method like printing or one algorithm blasts your code with every single feature from the standard library. You need like a single method from 10 different libraries and suddenly you have 10 full libraries in your short code.
@unersame8253
@unersame8253 10 ай бұрын
I've been using Prisma since about 2 years ago. I hate it. I'll keep on using it since I hate all ORMs, and it's mainly a skill issue.
@therealestsnake
@therealestsnake 10 ай бұрын
Yeah, I don't think I'm going to ever look at Prisma. These graphs look cool and all, but let's just keep it simple, with a simple DB. Why use json? Weird protocol...
@austincodes
@austincodes 10 ай бұрын
Everyone knows Jason is super fast
@UGPepe
@UGPepe 10 ай бұрын
these web "technologies" are from the future when the plot of Idiocracy takes place
@andresgutgon
@andresgutgon 10 ай бұрын
The thing with not doing joins is a good reason to try Drizzel
@ChillAutos
@ChillAutos 10 ай бұрын
Try drizzle with more than 10 tables lol. Shit is painfully slow right now, ts lang server 5-10s to catch up and even crashes.
@Xe054
@Xe054 10 ай бұрын
​@@ChillAutosthanks, this is the kind of thing that people never mention when a hot new technology comes out.
@xBiggs
@xBiggs 10 ай бұрын
I use Prisma a lot and have never had any problems
@Dev-Siri
@Dev-Siri 10 ай бұрын
"Ru$t"
@Nickname863
@Nickname863 10 ай бұрын
As having tried to build (and failed to do so) many c++ projects that use vcpkg in the last few days. I now understand why c++ isn't the dependency hell that javascript can be at times. Every single dependency in c++ is a big pain factor. Not that relevant to the video but i heard the word dependency and needed to vent my frustration.
@misterchief5378
@misterchief5378 10 ай бұрын
So, by making the integration of each package something that takes attention and lots of effort, c++ without package managers avoids dependency hell?
@Nickname863
@Nickname863 10 ай бұрын
@@misterchief5378 It is a different kind of hell. But there is no left pad :P
@indiesigi7807
@indiesigi7807 7 ай бұрын
I mostly just need ssl and mariadb the rest is usually up to me to implement and if i need anything else i can build and link it cause everything is a c lib anyway. Those libs are almost always in my systems package manager. I'm not waiting on some proprietary package manager to get locked into.
@SimonBuchanNz
@SimonBuchanNz 10 ай бұрын
JSON wire protocol is probably about avoiding JIT time? AWS lambda has spectacularly terrible CPU, to the point that i could absolutely expect 1MB of source could take 1s to start.
@bartek...
@bartek... 10 ай бұрын
Is that another first comment?
@ThePrimeTimeagen
@ThePrimeTimeagen 10 ай бұрын
Probably
@MahbuburRahman-uc7np
@MahbuburRahman-uc7np 10 ай бұрын
Used Prisma on an internal project at work with SQL server that had about 100,000 records. Table Schema looked something like this: 1. Table A -> Table B -> Table C (arrow means one two many realtionship) One of the queries required that with Select * From Table A we load all realted Table B and Table C rows as well. Its a three table join. Running a simple FindMany to get all Table A rows that was created in the last month would simply fail with too many parameter exception. Our FIX: Moved to .Net Core and never had to look back. All the queries ran just fine, though not fast just becasue how many rows we were pulling in a single query. TLDR, Prisma is only good for small projects not production ready IMO.
@Pandazaar
@Pandazaar 10 ай бұрын
prisma is production ready for years already lol
@electrolyteorb
@electrolyteorb 6 ай бұрын
​@@Pandazaarproduction ready without JOINs
@khazixfangirl6087
@khazixfangirl6087 10 ай бұрын
Hi I'm a comment
@wilsonwilson137
@wilsonwilson137 10 ай бұрын
😢
@Dev-Siri
@Dev-Siri 10 ай бұрын
aren't you json?
@thundergabriel
@thundergabriel 10 ай бұрын
MORTALS: 🔱Use Graph DB like Neo4j and SHUT UP 🤫
@electrolyteorb
@electrolyteorb 10 ай бұрын
Prisma is Sht
@raghavgohil2004
@raghavgohil2004 10 ай бұрын
FIrst
@CuteTechGuy
@CuteTechGuy 10 ай бұрын
Third...
@KhauTek
@KhauTek 10 ай бұрын
first comment
@jesper.ordrup
@jesper.ordrup 10 ай бұрын
Prisma needs to solve the lack of true join. I suggest they open source the specific database drivers to allow more eyes/more experts/use communities knowledge.
@greendsnow
@greendsnow 10 ай бұрын
Drizzle is still better.
@FeLiNe418
@FeLiNe418 10 ай бұрын
Just use spring boot
@dacam29
@dacam29 10 ай бұрын
Spring Bootstrap?
Migration Lesson: Don't Use Prisma | Prime Reacts
29:16
ThePrimeTime
Рет қаралды 142 М.
CSS as Backend????? | Prime Reacts
20:16
ThePrimeTime
Рет қаралды 78 М.
ONE MORE SUBSCRIBER FOR 6 MILLION!
00:38
Horror Skunx
Рет қаралды 13 МЛН
[柴犬ASMR]曼玉Manyu&小白Bai 毛发护理Spa asmr
01:00
是曼玉不是鳗鱼
Рет қаралды 46 МЛН
Did I Pick The Right Database???
1:07:48
Theo - t3․gg
Рет қаралды 205 М.
The Truth About HTMX
12:27
Theo - t3․gg
Рет қаралды 164 М.
Creator of Go on Software Complexity | Rob Pike | Prime Reacts
42:45
Prisma VS Drizzle in NextJS
7:27
Karthik Nooli
Рет қаралды 3,5 М.
How To Avoid Software Complexity | From Grug
8:20
ThePrimeTime
Рет қаралды 68 М.
Picking an ORM is Getting Harder...
5:18
Ben Davis - Tech
Рет қаралды 9 М.
The Only Database Abstraction You Need | Prime Reacts
21:42
ThePrimeTime
Рет қаралды 181 М.
Hardest Part of Software | Prime Reacts
22:21
ThePrimeTime
Рет қаралды 55 М.
Обзор игрового компьютера Макса 2в1
23:34
3D printed Nintendo Switch Game Carousel
0:14
Bambu Lab
Рет қаралды 4,7 МЛН
A Comprehensive Guide to Using Zoyya Tools for Photo Editing
0:50