A Deep Dive in How Slow SELECT * is

แชร์
ฝัง
  • เผยแพร่เมื่อ 23 ธ.ค. 2024

ความคิดเห็น •

  • @hnasr
    @hnasr  ปีที่แล้ว +4

    Fundamentals of Database Engineering udemy course (link redirects to udemy with coupon)
    database.husseinnasser.com

  • @Rettou74
    @Rettou74 ปีที่แล้ว +20

    What would be nice is to have some numbers to see the real impact on performance and to know which of this factors are more crucial

  • @farzadmf
    @farzadmf ปีที่แล้ว +2

    Thanks for another great video!

  • @Epistemer
    @Epistemer ปีที่แล้ว +20

    Hussein I truly look up to you ❤

  • @HarshKapadia
    @HarshKapadia ปีที่แล้ว +1

    Kids these day will not call you cringe. They will call you 'an amazing person who teaches us so much and gets us interested in learning the fundamentals'.

  • @jswlprtk
    @jswlprtk ปีที่แล้ว +16

    You Sir, are an inspiration for me ❤

  • @dyto2287
    @dyto2287 ปีที่แล้ว +5

    Bigger problem than it being slow is that it could cause issues with your code when you rollback failed deployments after db migrations because db migrations could add new columns that your older version of the code does not recognise and fail to scan.

  • @stevez5134
    @stevez5134 ปีที่แล้ว +5

    The man’s a hero

  • @shiewhun1772
    @shiewhun1772 ปีที่แล้ว +1

    35 seconds in. Noticed the background is less noisy - love that it's just three books. And the lighting is softer. This is nice. I thought the sword was gone till I googled the word Musashi and realized the spirit of the Samurai is still very much here. This is nice too.
    Back to SELECT * . Hopefully this is the video where it finally sinks in for me what your *fetish* for "SELECT *" is. I'm a big fan, Hussein, I can say you played a big part in my having the career and approach to learning that I have now. But as anybody who's watched numerous videos you've made on databases would notice, you have a thing for SELECT * :)

  • @pceimpulsive
    @pceimpulsive 3 หลายเดือนก่อน

    Thank you for going into the fine details! I love it, so much learning on how DB's actually work! keep it up!

  • @eulerpi7042
    @eulerpi7042 ปีที่แล้ว +7

    Hi Hussein, what you think about ORM? is it worth to used? the pros and cons? any video about it? I would love to watch it thanks :))

  • @dasten123
    @dasten123 ปีที่แล้ว +8

    But if you actually need everything, SELECT * is not slower than selecting every column explicitly, right?
    So SELECT * isn't slow. Selecting in general is slow.

    • @xNaii1
      @xNaii1 ปีที่แล้ว +2

      You never use * . Unless you want to get hacked and show all nice customer data that should be hidden :) . As well, in many cases you not need all columns as it increases the time you get the data

    • @Mohamedrasvi
      @Mohamedrasvi ปีที่แล้ว +5

      This is exactly my thinking. Select * is not slower than selecting explicitly by specifying all columns. The video is talking about selection unnecessary columns.

  • @ayushpandey1148
    @ayushpandey1148 ปีที่แล้ว +1

    Would love to have the video reg File block and byte. How Read operation is done and its underlying logic

  • @hemant_pande
    @hemant_pande ปีที่แล้ว +4

    Hi Hussein, what would be the impact of using an guid as primary key column vs using an autoincrememt as a primary key column?

    • @ayaanqui
      @ayaanqui ปีที่แล้ว

      I'd like to know this too

    • @drpstar
      @drpstar ปีที่แล้ว +2

      Read his blog on postgresql vs mysql. There he has mentioned some details on this topic.

  • @codinggavin
    @codinggavin ปีที่แล้ว

    Hussein you are such an inspiration ❤️

  • @damjandjordjevic1994
    @damjandjordjevic1994 ปีที่แล้ว +1

    I enjoy the details you get into.

  • @Pranav-pl7eg
    @Pranav-pl7eg ปีที่แล้ว +1

    Best CHANNEL

  • @bashardlaleh2110
    @bashardlaleh2110 ปีที่แล้ว +1

    thank you for sharing these valuable info

  • @AparnaBushan
    @AparnaBushan ปีที่แล้ว +1

    Hey Hussein, I have one question-
    How is select * different from select col1, col2, col3,col4 where id =1? - say I have 100 columns in my DB or some very high number of columns
    At the end it has to still figure out the page where col1,col2,col3,col4 are , right ?
    The only part that would be less is- deserialisation cost, n/w cost . But the main part of searching the remaining the columns from heap still lies there even if we are selecting few columns as opposed to *.
    Is my understanding correct ?
    can you shed some light ?

  • @apoorvgupta2039
    @apoorvgupta2039 ปีที่แล้ว +1

    I listen to your shows when going for a walk and damn so much info i gain during that 40 mins.

  • @RahulAhire
    @RahulAhire ปีที่แล้ว

    I'd love to if you can review Citus postgres distribution

  • @mtnrabi
    @mtnrabi ปีที่แล้ว +1

    Question: if I do “select *” and in the where clause I put a indexed column - what’s even the benefit of using the index if eventually the db will have to do a table scan?

    • @pixaim69
      @pixaim69 ปีที่แล้ว +2

      The dB will do a seek and not a scan.

  • @שלומיטובול
    @שלומיטובול ปีที่แล้ว

    Thanks you for providing such high quality vids 🙏

  • @sriteja2510
    @sriteja2510 ปีที่แล้ว +1

    Hi Hussein, Even the queries selecting few columns like select a,b,c from t1 where grade>90 still needs to fetch the pages from Disk Randomly
    how is it greatly different from select *

    • @drpstar
      @drpstar ปีที่แล้ว

      But there is still that unnecessary IO cost of large columns ( text, blob), serialization and de serialization cost, CPU cost for compression and not to mention networking one.

    • @saikatduttaece50
      @saikatduttaece50 ปีที่แล้ว

      @@drpstar What is we actually need that large column too.

  • @BabakKeyvani0
    @BabakKeyvani0 ปีที่แล้ว

    "Next time you do a 'select * ...' think about the suffering you're causing to all this equipments" 😂😅 26:06

  • @_dnL
    @_dnL ปีที่แล้ว +3

    "A page is.. and a block.. is the most overloaded term in SE." 😅

  • @pnworks9186
    @pnworks9186 ปีที่แล้ว

    Thank you very much sir. This is a very detailed explanation.

  • @hunter_-ur5mn
    @hunter_-ur5mn ปีที่แล้ว

    great and informative watch..

  • @mariumbegum7325
    @mariumbegum7325 ปีที่แล้ว

    Great video 😀

  • @dariusdoku4320
    @dariusdoku4320 ปีที่แล้ว

    Great video sir, you teach the good stuff

  • @satwikburman6841
    @satwikburman6841 ปีที่แล้ว

    The guilt trip whenever I am gonna do a select * from now on 😂

  • @haythamasalama0
    @haythamasalama0 ปีที่แล้ว +1

    Great video ✨

  • @abdirahmann
    @abdirahmann ปีที่แล้ว +2

    at this point hussein is a DBA or even better cause he can build scalable backends too, change my mind 😆

  • @gokukakarot6323
    @gokukakarot6323 ปีที่แล้ว

    The videos are kind of good, but man I feel so bad for not being able to sit through this dramatic explanation of things.
    It’s either my ADHD or just that my grandfather just gets to the point much faster than this.
    It’s like if buffering had a modern look

  • @mhcbon4606
    @mhcbon4606 ปีที่แล้ว

    title is confusing. Star operator is not the suspect here.. but the deep dive is interesting nevertheless, although, a bit chatty imho.

  • @peppybocan
    @peppybocan ปีที่แล้ว +1

    Deserialisation is not a problem.

  • @squirrel1620
    @squirrel1620 ปีที่แล้ว +1

    Its slowww... Looking at you Entity Framework, or pretty much any ORM 😅

    • @NathanHedglin
      @NathanHedglin ปีที่แล้ว +1

      Haha Entity Frameworks Core is MUCH faster.

    • @wolfVFXmc
      @wolfVFXmc ปีที่แล้ว +1

      You can select what data you wanna return from the database in EF core

  • @vmarzein
    @vmarzein ปีที่แล้ว

    test