How databases store and transmit integers efficiently using varint encoding

Поделиться
HTML-код
  • Опубликовано: 28 ноя 2024

Комментарии • 16

  • @tiyabansal9568
    @tiyabansal9568 10 месяцев назад +2

    Definitely an underrated one! This was a great learning. Thanks so much, Arpit for explaining + implementing it in a very thorough yet highly understandable way. Great watch!

  • @harshildoshi3299
    @harshildoshi3299 9 месяцев назад

    This was a great learning. One question I have is that, who actually does this Encoding/Decoding? Is it performed by Query optimizer?

  • @backendengineering007
    @backendengineering007 9 месяцев назад

    (Thinking out loud)If we know that an int is max of some bytes like 8 bytes in this video case. Don’t check for the continuation bit in the last byte by that in case where all bits are 1s we can suffice in 9 bytes as opposed to one extra byte for the overflowing 1bit in the last?? Am I missing something here?

  • @adityakumarsingh648
    @adityakumarsingh648 10 месяцев назад

    Hi Arpit,
    The explanation was quite thorough, got to understand a new thing that dbs transmit varint data using byte array.
    BTW, which VS Code theme extension you use?

  • @aanurraj
    @aanurraj 10 месяцев назад

    Thanks for the video Arpit, now I am having a strong urge to implement it :P

    • @AsliEngineering
      @AsliEngineering  10 месяцев назад

      Go for it. It is worth the time. Plus I have linked the repo for reference.

  • @vivekdhir77
    @vivekdhir77 10 месяцев назад +2

    Could you please explain why did you take an array of 11?

    • @AsliEngineering
      @AsliEngineering  10 месяцев назад +6

      Because that's the max number of bytes we can have for an 8 byte long integer when encoded as varint.

    • @KunalKumar-kc1bw
      @KunalKumar-kc1bw 10 месяцев назад +4

      64 bits number = ( 7 bits of number + 1 continuation bits) x 9 + ( (1+6) bits of number + 1 continuation bits ) = 80 bits or 10 bytes
      Is it correct?

    • @jasvinjames5773
      @jasvinjames5773 10 месяцев назад

      ​@@KunalKumar-kc1bwthanks for the explanation Kunal

    • @uzairshaikh6733
      @uzairshaikh6733 10 месяцев назад +1

      So does it mean, varint is not space efficient if an integer completely occupies the required space?
      i.e. for a 64/32 bit integer if all bits are used then varint will require 10 bytes/5 bytes, were as if varint encoding was not used space required will be 8/4 bytes

    • @AsliEngineering
      @AsliEngineering  10 месяцев назад +2

      @@uzairshaikh6733 for large values it is not. But how often do you use large integers?

  • @KaushalKumar087
    @KaushalKumar087 10 месяцев назад

    Which app do you use write all the text?

  • @da5m0n
    @da5m0n 10 месяцев назад +1

    Database folks taking internal fragmentation quite seriously