Database Speed Showdown: SQL, NoSQL vs. PostgreSQL Performance Comparison
Vložit
- čas přidán 22. 08. 2024
- Let's compare the speeds of these three very different database types using unsubstantiated pseudo-science! The results were actually not what I was expecting, still I refuse to write something like *SHOCKING RESULTS* in the title :D Hope you enjoy the comparison!
⭐ Our startup: wordful.ai
⭐ My GitHub: github.com/jos...
The stuff I use to make my videos
Camera: amzn.to/3XcqRKO
Light: amzn.to/3Xc1yIE
Keyboard: amzn.to/3CKxnAi
Mouse: amzn.to/3CNcfcm
Microphone: amzn.to/3iybVHC
Headphones: amzn.to/3IHTTgH
thats pretty much it. Those are affiliate links so I might earn a commission if you purchase after clicking them. :^)
Not sure why you refer to the MySQL database as a "SQL" database, and the Postgres database as something different, when in fact both MySQL and Postgres are both SQL databases.
Dude, this is not how you perform a comparison between databases.
Run this in local, also do over a large dataset and remember, DON'T USE NEXT OR PRISMA FOR THIS
I know this requires effort, but I know you can do better
"Let's compare the speeds of these three very different database types using unsubstantiated pseudo-science!" hehe
@@joshtriedcoding What do you mean unsubstantiated pseudo-science? Your benchmarks don't even make any sense.
Comparison is not fair. All databases should be on installed on same hardware, and possibly on local machine or on intranet
Very true
Year true.
Day true
Bad benchmark:
1: prisma has a lot of overhead - bindings, graphql, rust engine parsing/joining and so on....
2: should benchmark databases on local machine where network latency is not a factor.
3: should have some kind of data inside ( you would be surprised how much different the results will be then)
Each of the databases will be in different physical locations. So maybe it would better to ping the urls to see how long it takes for each response to return. Also, I think it would be better to see how long it would take to process a large batch of request instead of just one.
Yea, this isn't a db performance but rather a hosting performance (even if they're all in the same region)
Or maybe it would be better to run it locally, use larger data sample. Do tests with similarly structured data, then with what would be typical for particular use case and the database type.
Yeah interesting point with the batch request
you are wong - second - third writes just in 15 ms - it should be sever next to him
He didn’t even get to cold starts and connection pooling this is click bait from a “developer” that knows nothing…
the fact that this video exists makes me scared. You cant compare databases like that, there must be a substancial amount of reads/writes for any true comparison to be made. All dbs must be running on same hardware and at least in the same network as to mitigate connection delays. By doing such small amounts you even get affected by the OS scheduler dude, wtf
When does noSQL shines? - Its when u have thousends on entities in the DB and you need to get only one specific. in noSQL the entity is saved in a hashed value, thtas a value which is known by the database immediatelly. However in SQL databses you need to iterate throught the whole or some part of the database till you find the entity you r searching for. Thats why SQL request time grows with your databse size, but in noSQL the request time will not be affected by the size of the database it self. :)
One can use hash indexes to have the same functionality, in general I will say that if you have a well-structured data, use PostgreSQL, in general PostgreSQL is between two and five times faster specially in a well-tuned DB. However, if you don't have well defined models/schemas, it is better to use Mongo or another document-based DB, otherwise you will have a lot of Null fields/columns. If you know that you will store a lot of data, I think it will be simpler to maintain performance with Mongo, otherwise I think you will need to use something like Citus. If you have a lot of transactions and complex models use PostgreSQL. I am curious about what is better if someone uses only an ORM like prisma?
Indexing
I could not trust the PRISMA for the comparison. Better to use the mysql2, pg, mongoose.
why use mongoose, when you can use native mongodb driver? Mongoose is 3-5x slower thna the native driver.
@@well.8395 oh i see thanks!
Please give the guy a break, he was just trying a simple experiment, it's clearly not a full-scale database benchmarking or comparative analysis. I bet he's not a database expert or maybe a data scientist. So, why expect so much from him about the accuracy of his tests.
Like he said,
"Let's compare the speeds of these three very different database types using unsubstantiated pseudoscience"
Unsubstantiated:
Not supported or proven by evidence.
Pseudoscience:
Consists of statements, beliefs, or practices that claim to be both scientific and factual but are incompatible with the scientific method.
Any help, even how small it is must be appreciated, not quantified. Thank you very much Josh!
Benchmarking require some really challenging amount of data not just one object, the few ms's is pointless and maybe caused by many reasons and we can't end up with a final decision which one is better.
Exactly!
"I expected Mongo DB to be on top due to the NoSQL infrastructure" -- 🤣🤣🤣.. developers oh my fellow developers 🤣🤣
You are comparing cloud servers not databases
bro you compared clouds not databases
The slow initial speeds are likely due to opening a connection and authenticating it, also you should really have the db's locally installed so you can rule out network delays and you should also try small requests as well as large and filtered requests.
Using mongodb I got down to 15ms average (after code optimizations like not closing the session) from the cloud and 5ms for small requests if memory serves, this is an old vid but i hope you do another larger one in the future.
You are benchmarking using single threaded programming language, seriously
"Benchmarking" databases with only a couple of records in a database, most useless excercise I've seen in in a long time 😂
Ok, first of all I'll just clear out something very important, performance test with an ORM like PRISMA is probably the worst decision. Second of all you can't just compare these things like just making few simple insertions.
SQL databases are very good for strong consistency and MongoDB has is too but it's not that fast.
Same with the relations, relations are not as fast as RDMS.
If you are building with MongoDB it is very important to shift your thinking from RDMS to NoSQL and very specifically to Document stores like MongoDB.
MongoDB is amazing for large scales applications and SQL is also very good for these kind of apps but most important thing which I always consider is:
Speed
ACID (how good it is)
Dataset size (after ingestion)
Scale (MongoDB shines here but it's not like you can't scale RDMS)
I assume that test was
not done on the same hardware. Also, you have to consider that data set is very small as well. I real world data sets are a lot bigger. But this test is almost true. Mongo dB is not consistent at all in comparison with Oracle (DB king) or any other dB. That is explained in dB architecture. Mongo dB gets worse when you start charting dB and have multi cluster environment with billion records in it also keep in mind that Mongo dB is very bad at creating indexes it simply will not perform due to the fact that all indexes must be cashed in RAM. this is not the case with any other SQL DB. Conclusion Mongo dB can not be applied just because it is easier for developers. It has very specific use.
One of the worst performance comparisons ever... Nothing optimized for performance and you expect anything from this? Total bullshit.
Stuff is getting cached in memory dude do a few hundred million transactions and try again, not sure why people think NoSql is some faster thing it's just more javascript friendly thing they all have to do sorts indexes there is no free lunch.
It's a common misconception / myth that NoSQL is faster than SQL...and I can see you got a lot of heat coz of this 😂
Anyway great content and highly entertaining video. Can you please do similar thing between Redis vs memcached?
noob