Database Speed Showdown: SQL, NoSQL vs. PostgreSQL Performance Comparison

Sdílet
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. :^)

Komentáře • 43

  • @DaveMacpherson
    @DaveMacpherson Před rokem +47

    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.

  • @afcz4300
    @afcz4300 Před rokem +35

    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

    • @joshtriedcoding
      @joshtriedcoding  Před rokem +3

      "Let's compare the speeds of these three very different database types using unsubstantiated pseudo-science!" hehe

    • @well.8395
      @well.8395 Před rokem +21

      @@joshtriedcoding What do you mean unsubstantiated pseudo-science? Your benchmarks don't even make any sense.

  • @princebhanwra11
    @princebhanwra11 Před rokem +50

    Comparison is not fair. All databases should be on installed on same hardware, and possibly on local machine or on intranet

  • @fractal-tess
    @fractal-tess Před rokem +10

    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)

  • @rumplstiltztinkerstein
    @rumplstiltztinkerstein Před rokem +35

    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.

    • @daheck81
      @daheck81 Před rokem +8

      Yea, this isn't a db performance but rather a hosting performance (even if they're all in the same region)

    • @denissorn
      @denissorn Před rokem +7

      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.

    • @joshtriedcoding
      @joshtriedcoding  Před rokem +2

      Yeah interesting point with the batch request

    • @sguploads9601
      @sguploads9601 Před rokem

      you are wong - second - third writes just in 15 ms - it should be sever next to him

    • @RJ-sw7zv
      @RJ-sw7zv Před 9 měsíci +1

      He didn’t even get to cold starts and connection pooling this is click bait from a “developer” that knows nothing…

  • @daniellombardi3670
    @daniellombardi3670 Před rokem +8

    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

  • @janisbasisbasovsdev7147
    @janisbasisbasovsdev7147 Před rokem +15

    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. :)

    • @HelmutIsaacPadillaChavarria
      @HelmutIsaacPadillaChavarria Před rokem +3

      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?

    • @Miles-co5xm
      @Miles-co5xm Před rokem +3

      Indexing

  • @yangdongjun
    @yangdongjun Před rokem +6

    I could not trust the PRISMA for the comparison. Better to use the mysql2, pg, mongoose.

    • @well.8395
      @well.8395 Před rokem +1

      why use mongoose, when you can use native mongodb driver? Mongoose is 3-5x slower thna the native driver.

    • @yangdongjun
      @yangdongjun Před rokem

      @@well.8395 oh i see thanks!

  • @lyrixs4u
    @lyrixs4u Před 3 měsíci +1

    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!

  • @mohamedhamada8330
    @mohamedhamada8330 Před rokem +5

    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.

  • @anonymous_anonymity
    @anonymous_anonymity Před rokem +9

    "I expected Mongo DB to be on top due to the NoSQL infrastructure" -- 🤣🤣🤣.. developers oh my fellow developers 🤣🤣

  • @mahaddev
    @mahaddev Před 3 měsíci

    You are comparing cloud servers not databases

  • @botobeni
    @botobeni Před 3 měsíci

    bro you compared clouds not databases

  • @jordanh9210
    @jordanh9210 Před 6 měsíci

    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.

  • @sachinrawat4539
    @sachinrawat4539 Před 11 měsíci +1

    You are benchmarking using single threaded programming language, seriously

  • @rj7855
    @rj7855 Před 8 měsíci

    "Benchmarking" databases with only a couple of records in a database, most useless excercise I've seen in in a long time 😂

  • @vaibhavpathak6721
    @vaibhavpathak6721 Před rokem +2

    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)

  • @EdJanuskis
    @EdJanuskis Před 8 měsíci

    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.

  • @TeamGalaxyGaze
    @TeamGalaxyGaze Před 3 měsíci

    One of the worst performance comparisons ever... Nothing optimized for performance and you expect anything from this? Total bullshit.

  • @TheShorterboy
    @TheShorterboy Před 10 měsíci

    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.

  • @pietraderdetective8953
    @pietraderdetective8953 Před 9 měsíci +1

    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?

  • @jeremycoleman3282
    @jeremycoleman3282 Před rokem +3

    noob