Tony Saro
Tony Saro
  • 30
  • 339 990
The Most Complicated Algorithm I've Ever Written: SQLite B-Tree Balancing
In this video we visualize how the SQLite 2.X.X B-Tree balancing algorithm works. Technically it's not exactly the algorithm from SQLite but my own version which I implemented for MKDB. My version is almost a 1:1 Rust copy of the original algorithm implemented in C which you can find linked below.
🌐 LINKS
Algorithm Implementation:
github.com/antoniosarosi/mkdb/blob/bf1341bc4da70971fc6c340f3a5e9c6bbc55da37/src/storage/btree.rs#L1627
Original SQLite Implementation:
github.com/antoniosarosi/sqlite2-btree-visualizer/blob/e6d1786a878e0497289d208f7302802b6bd4a9a1/src/btree.c#L2171
✉️ CONTACT INFO
Business Email: business@antoniosarosi.io
Contact Email: sarosiantonio@gmail.com
Twitter: antoniosarosi
Instagram: antoniosarosi
LinkedIn: www.linkedin.com/in/antoniosarosi/
🎵 MUSIC
th-cam.com/video/oCEcHE_jWfI/w-d-xo.html
th-cam.com/video/a7NaCCQEdE0/w-d-xo.html
th-cam.com/video/AgzKnzmZ1z8/w-d-xo.html
📖 CHAPTERS
00:00 Introduction
00:41 Databases & B-Trees
03:30 The Balancing Algorithm
09:24 Deleting & Balancing
12:03 Final Thoughts
🏷️ HASHTAGS
#programming
#computerscience
#algorithm
มุมมอง: 43 085

วีดีโอ

The ORDER BY Algorithm Is Harder Than You Think
มุมมอง 61K2 หลายเดือนก่อน
In this video I describe in detail how my implementation of the K-Way External Merge Sort algorithm works. K-Way External Merge Sort is an algorithm used to sort large datasets that don't fit in main memory (usually RAM). Therefore, this algorithm is used by databases like Postgres to process ORDER BY queries when tables don't fit in memory. The algorithm consists of a series of "passes" throug...
Writing My Own Database From Scratch
มุมมอง 204K3 หลายเดือนก่อน
Writing My Own Database From Scratch

ความคิดเห็น

  • @7Mirino
    @7Mirino 10 ชั่วโมงที่ผ่านมา

    Not only is this actual, real software engineering, as other comments have made it clear, but your teaching method is incredible! You've managed to make me follow you on an incredibly high level technical conversation even though my current technical understanding is that of a measly junior web dev. I want you to know that every single second you spent creating all these visualizations, explanations and teaching patterns was well used and highly, highly appreciated. I expect many of those seconds were painful, as I have some video editing experience myself, but for every one of your sweat drops, the quality of this video sky rocketed! Thank you!

  • @ketimcodes
    @ketimcodes วันที่ผ่านมา

    Impecable investigación y video. Te felicito. El otro canal ya fue? Saludos.

    • @tony_saro
      @tony_saro วันที่ผ่านมา

      Sí, ya fue jajaja

  • @adrien8768
    @adrien8768 2 วันที่ผ่านมา

    😮😮😮 beautiful project ❤️❤️ great job

  • @shashankbj3804
    @shashankbj3804 3 วันที่ผ่านมา

    Thanks for the video this makes it so easy to figure out what to learn at least to know How things work. The format is so good I don't feel like I was spoon fed anything which I love.

  • @daveradoicic
    @daveradoicic 4 วันที่ผ่านมา

    And could you kindly post where to find the code that auto adjusts the data into HRF? In oracle we have to set the columns, page size and line size differently each time

    • @tony_saro
      @tony_saro 4 วันที่ผ่านมา

      You mean the tables? I'm just using the Alacritty terminal, changing the zoom levels adjusts the lines.

  • @daveradoicic
    @daveradoicic 4 วันที่ผ่านมา

    What flavor of Linux did you personally use? Version too if you’d be so kind.

    • @tony_saro
      @tony_saro 4 วันที่ผ่านมา

      ArcoLinux with Qtile window manager.

  • @montassirejerrari8791
    @montassirejerrari8791 4 วันที่ผ่านมา

    this content is priceless

  • @karaoket8911
    @karaoket8911 7 วันที่ผ่านมา

    everything is great in this video. Love the idea, love the explanation. Love the looks and the accent

  • @luisvidalcamposgutierrez1062
    @luisvidalcamposgutierrez1062 7 วันที่ผ่านมา

    Tengo un par de preguntas ¿Ya no vas a subir videos en tu canal en español? y ahora ¿Este va ser tu nuevo canal principal?

    • @tony_saro
      @tony_saro 7 วันที่ผ่านมา

      No voy a subir más vídeos en el otro y este será mi canal principal.

  • @jpphoton
    @jpphoton 7 วันที่ผ่านมา

    Excellent. i love this guy.

  • @shomikhan1333
    @shomikhan1333 7 วันที่ผ่านมา

    O man, you are awesome. Please keep making cool stuffs like this

  • @gardnmi
    @gardnmi 7 วันที่ผ่านมา

    When people tell me I'm smart I tell them that's not true because I know people like you exist. Bravo on this achievement.

    • @tony_saro
      @tony_saro 7 วันที่ผ่านมา

      I wouldn't say I'm smart, I'm just persistent enough.

  • @Dpaz2009
    @Dpaz2009 8 วันที่ผ่านมา

    Looks like legacy code to me 😂

  • @chukwunta
    @chukwunta 8 วันที่ผ่านมา

    This is it. This is software development. Thank you, Thank you so much for this. Amazing approach. Awesome 🤩 🤩 🤩

  • @CielMC
    @CielMC 9 วันที่ผ่านมา

    Neovim, Rust, tiling WM, based

    • @CielMC
      @CielMC 8 วันที่ผ่านมา

      Wait is that comic sans

    • @tony_saro
      @tony_saro 8 วันที่ผ่านมา

      😂😂😂 it's one of the nerdfonts.com, I switch them from time to time.

  • @hbobenicio
    @hbobenicio 10 วันที่ผ่านมา

    7 month timelapse engineering with that much of analysis, explanation, video quality and stuff.. man that was incredible! Much respect! Really nice work! Subscribed! Project idea: recreating a video processing software for demonstrating how to create 1min of accelerated footage of 7-month of daily programming vlogs lol, even this had to be took forever! xD

    • @tony_saro
      @tony_saro 10 วันที่ผ่านมา

      I'll have to get into video processing at some point haha, looks interesting, for now I'm focusing on stuff that I am more familiar with since I work as a fullstack dev, so databases are not alien to me. Video processing, audio processing, image processing, graphics... I literally know nothing about that.

  • @adonyssantos_
    @adonyssantos_ 10 วันที่ผ่านมา

    A few weeks I was curious to know how databases work. A few days I found your English channel with this valuable content

  • @sacc19
    @sacc19 11 วันที่ผ่านมา

    Such an amazing content!!!

  • @ItachiUchihaWarrior
    @ItachiUchihaWarrior 11 วันที่ผ่านมา

    Acá alguien al que le duele que este tipo de contenido no esté en español, (incluso con muchas esperanzas de que vuelva 4tomik xD) Pero ey, hay que comer, y está perfecto que quieras hacerlo en el lenguaje que quieras, te deseo el mejor de los éxitos :) lástima que no mucha gente se interese más en cómo funcionan las cosas por debajo, espero nuevos videos! Saludos desde argentina :D

    • @tony_saro
      @tony_saro 11 วันที่ผ่านมา

      En español no hay suficiente audiencia. A este vídeo le hubiera pasado como al video del memory allocator o el reverse proxy hubiera llegado a 20K views en el primer mes en lugar de 200K como aquí.

  • @markmagdy1525
    @markmagdy1525 12 วันที่ผ่านมา

    Why do you code in rust instead of c or c + +? I mean that c or c++ is more suitable for this kind of projects. SQLite, postgreSQL, Oracle, Ms sql and mysql. All of them are written in c/c++ , what are your decisions to choose rust instead of c/c++?

    • @tony_saro
      @tony_saro 12 วันที่ผ่านมา

      They're not written in C because "it's more suitable". They're written in C because they started development in the 1990s. Nowadays there are some options other than C or C++. Rust is a more modern language, it has generics, pattern matching, closures, traits, package manager, built-in data structures and other utilities in the standard library, etc. C doesn't have any of that, either you write it yourself or use third party code.

  • @ininieto
    @ininieto 12 วันที่ผ่านมา

    I used to follow you in your previous channel, and honestly I was pretty upset that you stopped uploading videos. Such a pleasant surprise to find you here! New sub here and all the best, man :)

  • @user-gy6ut2dz8i
    @user-gy6ut2dz8i 14 วันที่ผ่านมา

    Underrated bro!

  • @nixoncode
    @nixoncode 14 วันที่ผ่านมา

    Quick question, Can you explain where the transaction actually work? where is the state to be updated stored before calling commit

    • @tony_saro
      @tony_saro 14 วันที่ผ่านมา

      The transaction state is stored in memory. Then there's a journal file that keeps copies of the original pages so that they can be reversed if you ROLLBACK or if the system crashes. Here's where most of the "transaction" stuff happens: github.com/antoniosarosi/mkdb/blob/bf1341bc4da70971fc6c340f3a5e9c6bbc55da37/src/db.rs#L1079

  • @justAmen9999
    @justAmen9999 14 วันที่ผ่านมา

    antonio hazlo en español, plisss

    • @tony_saro
      @tony_saro 14 วันที่ผ่านมา

      Estos videos no funcionan en español, metete en mi Instagram y mira las historias destacadas.

  • @marks95
    @marks95 15 วันที่ผ่านมา

    wow! encontré el canal de antonio sarosi, podriás añadir con la nueva función de youtube, pistas de audio, para que también llegue a mas audiencia.

    • @tony_saro
      @tony_saro 15 วันที่ผ่านมา

      No la tengo disponible.

  • @Tabu11211
    @Tabu11211 15 วันที่ผ่านมา

    lmfao first mistake, making your own database haha

  • @cda32
    @cda32 15 วันที่ผ่านมา

    Really cool! Love your content man

  • @catprog
    @catprog 15 วันที่ผ่านมา

    7:16 R , L, R, LL, LR, RL, RR, LLL, LLR, LRL, LRR, RLL, RLR, RRL, RRR is how you store the binary tree on disk.

    • @tony_saro
      @tony_saro 15 วันที่ผ่านมา

      The problem isn't storing the order of the nodes, the problem is coming up with a binary format that can be easily modified in memory. Watch the video until the disk B-Tree part and you'll understand.

  • @inraid
    @inraid 15 วันที่ผ่านมา

    SQLite is a perfect example how not to write a database.

    • @tony_saro
      @tony_saro 15 วันที่ผ่านมา

      According to who?

  • @tonym5857
    @tonym5857 15 วันที่ผ่านมา

    👏👏👏👏👌👌👌

  • @viddeshk8020
    @viddeshk8020 16 วันที่ผ่านมา

    Github code for it ??

    • @tony_saro
      @tony_saro 16 วันที่ผ่านมา

      In the description of the full video.

  • @_ahrorjon
    @_ahrorjon 17 วันที่ผ่านมา

    While watching the video, I suddenly felt the urge to subscribe to the channel. I was surprised to see it only had 21k subscribers; I expected it to have at least 500k. Lol

    • @tony_saro
      @tony_saro 17 วันที่ผ่านมา

      Haha I just started it a couple months ago, getting so many subs takes years.

  • @amitgujar6231
    @amitgujar6231 17 วันที่ผ่านมา

    bro can u explain this

    • @tony_saro
      @tony_saro 17 วันที่ผ่านมา

      It's a clip from my Database video. You can find it on my channel.

    • @amitgujar6231
      @amitgujar6231 17 วันที่ผ่านมา

      @@tony_saro I just checked, 😅.u have done grate work specially the explanation u have written for split.

  • @AceOrS
    @AceOrS 17 วันที่ผ่านมา

    thanks sir.

  • @tuviega
    @tuviega 17 วันที่ผ่านมา

    Te sigo desde el canal en español, siempre tuve la duda de las bases de datos sobre todo el query planner, saludos exitos en este canal, una disculpa si escribo en español, mi ingles no es muy bueno.

  • @JonarcSacresCardines
    @JonarcSacresCardines 18 วันที่ผ่านมา

    everyone is a gangster until the real gangster arrived. I push the button "Subscrided" immediately just as the "The Voice" judges do. Your hardcore-ness as a software engineer is inspiring. Thank you for this video.

  • @jesushurtado1560
    @jesushurtado1560 18 วันที่ผ่านมา

    Ahhhhh, ahora te la tiras de gringo. Jajaja buenísima, gracias por el vídeo

    • @tony_saro
      @tony_saro 18 วันที่ผ่านมา

      Jajajaja 🇺🇸🦅

  • @tombiebl4355
    @tombiebl4355 18 วันที่ผ่านมา

    Very cool and invormative video! Keep going

  • @yoskokleng3658
    @yoskokleng3658 18 วันที่ผ่านมา

    i want to become u 🤓

    • @tony_saro
      @tony_saro 18 วันที่ผ่านมา

      I don't recommend it

  • @la-dev
    @la-dev 19 วันที่ผ่านมา

    Probably at 0:15 I have paused the video, opened your channel in new tab. Subscribed, and back here. No one is there to touch these topics. I salute you for sharing your knowledge.

  • @rincewindwizzard6836
    @rincewindwizzard6836 19 วันที่ผ่านมา

    Super big brained. Thanks Tony this is a gem

  • @miketag4499
    @miketag4499 19 วันที่ผ่านมา

    I have two questions: 1. In case of underflow root, ehy the page numbers are not modified when the depth gets decreased by 1? In that case the child pages have a wrong page number 2. Are the indexes loaded into a btree upon initialization? Thanks

    • @tony_saro
      @tony_saro 19 วันที่ผ่านมา

      Only the page pointers are modified when reorganizing entries.

    • @tony_saro
      @tony_saro 19 วันที่ผ่านมา

      Indexes are not "loaded" upon initialization, they are created with the "CREATE INDEX" statement and then they exist on disk.

  • @markmagdy1525
    @markmagdy1525 20 วันที่ผ่านมา

    no word describes what are you done ❤❤

  • @miketag4499
    @miketag4499 20 วันที่ผ่านมา

    Fantastic video, I agree with others, so nice to see some real software engineering

  • @tech-nomade
    @tech-nomade 21 วันที่ผ่านมา

    Please do a long premium course on Algorithms (preferably implemented in Rust, Go or C) on Udemy or similar platform. I bet it will sell like hotcakes. I somehow managed to avoid that topic over the last 10 years but now going to learn them in depths (within next months).

    • @tony_saro
      @tony_saro 21 วันที่ผ่านมา

      Yeah it's a good idea, I will at some point, but I can't right now.

  • @tech-nomade
    @tech-nomade 21 วันที่ผ่านมา

    Rust, Databases, Algorithms, Neovim & Linux - What do you need more in a video? :D

  • @tech-nomade
    @tech-nomade 21 วันที่ผ่านมา

    Dude that's dope! Could you share with us how you build such good animations? Just After Effects / Davinci Fusion? Or any additional tools? How much time do you spend per minute of final video? I guess at least 1-2 hours per minute?

    • @tony_saro
      @tony_saro 21 วันที่ผ่านมา

      Yeah it's about 1-2 hours per minute. I don't even use After Effects it's just Adobe Premiere with the "Essential Graphics".

    • @tech-nomade
      @tech-nomade 21 วันที่ผ่านมา

      @@tony_saro Hey man, thanx for responding that quick! I have same Wallpaper as you @ 12:09 on the right Display! :D Did you learn this kind of video production with basic Premiere Pro tutorials or are there special kind courses? Can you suggest any to learn from? Or any payed / premium ressources? I want to create vids like yours / let's get rusty's /Dreams of Code's etc on Linux, FOSS, Vue, Golang and Rust as well, but can't find the right resource to get started. Anyhow, subscribed!

    • @tony_saro
      @tony_saro 21 วันที่ผ่านมา

      I didn't use any courses at all, you can start with a basic Premiere tutorial on TH-cam and after that search for specific tutorials, "how to do X in Premiere". That's all I did, but keep in mind these are not my first videos, I have another TH-cam channel in Spanish which I started in 2019, so I have a lot of experience with editing.

    • @tech-nomade
      @tech-nomade 21 วันที่ผ่านมา

      ​@@tony_saro thanx man! yeah, probably just need to get started and then it comes from alone. Going to do a Davinci Resolve course next days on Udemy (canceled my Adobe CC long before I switched to Linux from Mac - even more evil to me than Apple, Google & Co, on the same level as Oracle). Looking forward to more vids on your projects here on TH-cam!

  • @GabrielxC
    @GabrielxC 21 วันที่ผ่านมา

    Que paso con el español?

    • @tony_saro
      @tony_saro 20 วันที่ผ่านมา

      instagram.com/s/aGlnaGxpZ2h0OjE3ODUxMDI2NDY1MjQ5NzA1?story_media_id=3399154947095379898_1492796422&igsh=bzl3MTJ4ZTNvNHd4

  • @joaopolonia9428
    @joaopolonia9428 21 วันที่ผ่านมา

    What a productive way to learn complex topics and also sharing it. You are a real software engineer!

  • @antropod
    @antropod 21 วันที่ผ่านมา

    Kibybytes