SQL Index |¦| Indexes in SQL |¦| Database Index

2024 ж. 20 Мам.
602 684 Рет қаралды

Indexes in SQL are used to speed up SQL queries. A database index works much like an index in a book. For example, if you have a database table with a list of people, a common query would be to lookup someone by name. Creating an index means the database will not have to scan the entire table looking for matches. Instead, it will restrict its search to a small portion of the rows.
In this video we use a table with 100 million rows to illustrate how much an index can change the speed of a query.
Our SQL playlist starts here:
↪bit.ly/Socratica_SQL
Be sure to SUBSCRIBE for more SQL!
↪ bit.ly/SocraticaSubscribe
You may also enjoy our Python playlist:
↪bit.ly/PythonSocratica
♦♦♦♦♦♦♦♦♦♦
Ways to support our channel:
► Join our Patreon : / socratica
► Make a one-time PayPal donation: www.paypal.me/socratica
► We also accept Bitcoin @ 1EttYyGwJmpy9bLY2UcmEqMJuBfaZ1HdG9
Thank you!
♦♦♦♦♦♦♦♦♦♦
Connect with us!
Facebook: / socraticastudios
Instagram: / socraticastudios
Twitter: / socratica
♦♦♦♦♦♦♦♦♦♦
SQL instructor: Ulka Simone Mohanty (@ulkam on Twitter)
Written & Produced by Kimberly Hatch Harrison (@khhsocratica) & Michael Harrison (@mlh496)
♦♦♦♦♦♦♦♦♦♦

Пікірлер
  • It's official! The Socratica Python Kickstarter was a success! Thank you to all of our supporters. Because of you, many more Python videos coming soon!! 💜🦉

    @Socratica@Socratica4 жыл бұрын
    • Thanks for all great videos... Your explanations are simple and awesome :)

      @papunmohanty5968@papunmohanty59684 жыл бұрын
    • You guys are amazing, the quality of videos and the actress in the video is at par with a professional TV show or a movie. Excellent explanation as well !!!

      @setudutta3905@setudutta39054 жыл бұрын
    • 😱👍⚡Socratica, you nailed it! This is the SQL course I recommend every day to SQL beginners. 🎇💥🎆🖐👍🖖🤘

      @philpeko1796@philpeko17964 жыл бұрын
    • Wish you the best. You are awesome.

      @maheshtambe9535@maheshtambe95353 жыл бұрын
    • Please continue SQL video series with more SQL concepts. Big fan :)

      @mohammadsohelkhan7996@mohammadsohelkhan79963 жыл бұрын
  • I thoroughly enjoyed the 596,000 ms spent watching this video.

    @robertl30@robertl305 жыл бұрын
    • The hardship is impossible to put into words...

      @enamh89@enamh893 жыл бұрын
    • But it lasts over 900000!

      @unjordi@unjordi2 жыл бұрын
    • You might want to re-check that.

      @mcmaddie@mcmaddie2 жыл бұрын
    • 956,000 ms i guess

      @ahmeda8201@ahmeda82012 жыл бұрын
    • @@ahmeda8201 nope 596000k

      @thisisgangadhar@thisisgangadhar2 жыл бұрын
  • She deserves an Emmy's for the quality content production. Fantastic scripts, visual and sound effects, and best actress. Love the (7-min) interlude of classical music, hilarious you. Totally loving this! Thank you Socratica, you really are awesome and indispensable!

    @microsteps211@microsteps2113 жыл бұрын
    • Same here about the 7min 😄

      @hadibq@hadibq Жыл бұрын
    • Totally agree... I just love the contents this channel puts out

      @caio-jl6qw@caio-jl6qw10 ай бұрын
    • what was the name of the prelude, shazam could not find it.

      @nwokolobueze7291@nwokolobueze72912 ай бұрын
  • Maaan, I graduated college 3 years ago, learning from all kinds of tutors and lecturers, but never like crazy Cyber Doctor here. I feel scared, and educated

    @TheJupiteL@TheJupiteL3 жыл бұрын
    • Haha, "crazy cyber doctor"!

      @smoothbeak@smoothbeak3 жыл бұрын
  • I remember a query that ran over six hours. Ever month again year after year. One day I checked the output and that query had run only a few minutes. I asked a colleague if there was a problem. She said 'O, i created an index.....'

    @roelandriemens@roelandriemens5 жыл бұрын
    • haha nice learning experience

      @Bargains20xx@Bargains20xx5 жыл бұрын
    • Hahaha that's brilliant 😂

      @spmegaman1@spmegaman13 жыл бұрын
    • How many entries and coloumns did the tables in the database had ? 6 hours seem crazy.

      @CrazyBenlols13@CrazyBenlols133 жыл бұрын
    • It took an year to get a solution for a slow running query.. ? 😂

      @googdriveforme4115@googdriveforme41153 жыл бұрын
    • @@googdriveforme4115 we wasn't looking for one lol

      @diegoguisasola3858@diegoguisasola38583 жыл бұрын
  • Whoever writes these scripts deserves an award. As well as this lady for delivering the lines perfectly and giving this great performance. Education and entertainment at it's best.

    @CristhianDalmazzo@CristhianDalmazzo3 жыл бұрын
  • You just made databases interesting, and 10 mins ago I never even realised what an index was!

    @benjiviews4300@benjiviews43005 жыл бұрын
  • This couldn't be easier, crisper and more interesting. Simply enjoyable!!

    @rajatsaha891@rajatsaha8913 жыл бұрын
  • I have 20+ years in data analytics and IT and this is one of the best videos on indexes I have found. Thank you for making this so educational and fun at the same time! I'm excited to check out your python channel next!

    @joncrosby1@joncrosby1 Жыл бұрын
    • Thank you for your kind message! We're so glad you've found us!! 💜🦉

      @Socratica@Socratica Жыл бұрын
    • Could't agree more. Fantastic

      @salence99@salence99 Жыл бұрын
    • @joncrosby1, Since you have 20+ years of experience, could you please guide me how to get a job in this field? I am a Computer Science graduate and want to go to Data Analytics (I dont want to be a hard core programming developer). I have learnt SQL, Basics of Python and Data Visualization tools like Tableau and also made some dashboard to learn properly. I need your advise on how to apply for data analytics job. Should I learn any more skills? like data warehousing or cloud? Please let me know. Thank you in Advance!

      @suryas5609@suryas5609 Жыл бұрын
  • i just love this lady a lot.

    @giseleshuri9469@giseleshuri94693 жыл бұрын
    • Me tooo

      @thedev5603@thedev56033 жыл бұрын
    • me too

      @rayhan8701@rayhan87013 жыл бұрын
    • Me too

      @shreehari2589@shreehari25893 жыл бұрын
    • Same here, av falling in love with her videos ever since i discovered her channel

      @ayencoscolfield3312@ayencoscolfield33123 жыл бұрын
    • me too

      @vibhors@vibhors3 жыл бұрын
  • As Ulka said at the end of this video, use indexes wisely! A general rule of thumb for indexes is that adding indexes to a table will speed up selects (that are constructed correctly) and slow down inserts/updates/deletes because whatever SQL system you use has to rebuild those indexes if a modifying transaction occurs.

    @parsonsmarcus@parsonsmarcus2 жыл бұрын
  • I love the enthusiasm, robotic fast (not boring) narration, clear and practical examples, and the visualization! Definitely subscribing!

    @racheltindoy@racheltindoy4 жыл бұрын
  • At last, I can understand mySql. Explained perfectly in a way my brain can comprehend. I will definitely be donating to keep you guys going. Thank you so much.

    @jameskeogh9452@jameskeogh94524 жыл бұрын
    • I am with you on this one

      @liljj2k10@liljj2k103 жыл бұрын
    • Me too

      @albusdumbeldoor3128@albusdumbeldoor3128 Жыл бұрын
  • I can't believe a video on sql has quarter million views. That speaks to the quality of this video

    @H1TMANactual@H1TMANactual3 жыл бұрын
  • Unbelievable! The best SQL tutorial I have ever watched. It couldn't be shorter and clearer. I bet even a child or even my grandmother could be able to understand it.

    @user-qh6uo5wy6f@user-qh6uo5wy6f2 жыл бұрын
  • This is the channel I ve been waiting for long time. Thanks KZhead algorithm.

    @abhishekdas2512@abhishekdas25123 жыл бұрын
  • wow! This video worth a lot. B4 watching this i never knew index is this essential for faster performance. Well explained. Keep uploading such Videos. Animation were superb to understand quickly. God bless u.

    @morsheddld@morsheddld5 жыл бұрын
  • 10 min ago I never thought learning can be funny and interesting at this awesome level. Good job.

    @dhananjaywadhavane4106@dhananjaywadhavane41064 жыл бұрын
  • Love the comedic way you use to teach. Please, do not stop doing it!!

    @johnhillescobar@johnhillescobar5 жыл бұрын
  • I've been looking for a tutorial for days that solves all the doubts I had before starting to use indexes, and this one definitely succeeded. Thank you very much! A fairly complete and well explained explanation!

    @TauriMarie@TauriMarie3 жыл бұрын
  • I found this KZhead channel some time ago when I was first learning python and have been laughing ever since. I learn a good deal of important information here about methods/functions I thought I knew already. Its fun and informative and I hope you continue to educate me in this most hilarious fashion.

    @InsomniaCast@InsomniaCast4 жыл бұрын
  • This was fantastic. Hands down the best online lessons I've watched.

    @travischaplin6272@travischaplin62722 жыл бұрын
  • WHAT A BLAST!!!!! I watched the whole tutorial, took notes I was literally hooked learnt a lot felt like watching a movie, the production and creation of this course is PRICELESS THANK YOU , wish there was a JavaScript course like this

    @christopherpink842@christopherpink8422 жыл бұрын
  • Great video! One tip: Adding indexes to a table will speed up select commands but will also slow down other commands like insert/update/delete because the SQL server has to reconsider the indexes if any kind of modifying transaction occurs in the future.

    @abhishekpaul6094@abhishekpaul609410 ай бұрын
  • I love this series. Keep up the great work!

    @RockitMan-ey8tx@RockitMan-ey8tx5 жыл бұрын
  • I learned what I needed and laughed at the same time I was learning. Thank you for adding a lot of production value to the lesson.

    @yg713@yg7133 жыл бұрын
  • ur such a life saver, i often dont understand immediately in class but those videos make me understand almost immediately, thats quality, appreciate it, wish ppl always invested this much time in teaching

    @antoinebguitar2869@antoinebguitar2869Ай бұрын
  • I can't believe i watched the video. i learned something. and totally enjoyed every second of it.

    @Akopyan@Akopyan5 жыл бұрын
  • This is the best coding channel I HAVE EVER SEEN!!!!!!!!!!!

    @asdfkjhlk34@asdfkjhlk345 жыл бұрын
  • I'm a professional that spends all day querying and this is the first video that explained it concisely

    @piyh3962@piyh39625 жыл бұрын
  • Wow, one of the best explanations I've ever seen. Congrats!

    @aurelitojunio7795@aurelitojunio77954 жыл бұрын
  • This was a most excellent series. Time well spent. Thank you so much for posting.

    @user-di4bt7qu2i@user-di4bt7qu2i5 жыл бұрын
  • Ita amazing how something can be made informational and enjoyable both at the same time !

    @ameyapatil1139@ameyapatil11393 жыл бұрын
  • This is absolutely a fantastic video , I am subscribing This channel deserves number of subscribers that even the indexing will take time to count

    @hamzasaleem6154@hamzasaleem61544 жыл бұрын
  • Wow! Well done! This is by far the best video I've ever seen on SQL indexes. The demonstration was phenomenal!

    @amirhosseinahmadi3706@amirhosseinahmadi37064 жыл бұрын
  • Incredible. I've spent seven hours over the past two days refreshing myself on database concepts and filling in gaps and this was my favorite 10 minutes of those seven hours by a factor of 100 billion.

    @AndrewKlem@AndrewKlemАй бұрын
  • Fantastic. I'm slightly familiar with SQL because I only very occasionally need to have certain data pulled by our DBAs. Very cool @ 7:25 - I had that question. Thanks Socratica.

    @vero0992@vero09925 жыл бұрын
  • I really appreciate the effort you've put in the background sounds nd editing thereby making it very interesting.

    @adarsh902@adarsh9024 жыл бұрын
  • I always think of this video when I create a clustered index. This tutorial very plainly outlines the benefits of indexes and how they can speed up our queries. Thank you!

    @simplesql1408@simplesql14082 жыл бұрын
  • WOW My jaw is on the floor at how amazing this video is! Quality, tone and speed of voice is on point. Explanations are well thought out and provide all necessary context to comprehend. Video/Audio editing is perfect with just enough to keep it interesting and remove distractions.

    @TheGrizzlyKnight@TheGrizzlyKnight7 ай бұрын
  • Must Amazing SQL Tutorial ... You Deserve More Than A Billion Subscribers

    @sadowizzy1105@sadowizzy11054 жыл бұрын
  • Thank you for such an amazing explanation. I have one question though, the index you created was that a clustered index or a non-clustered one?

    @oliverkaunds@oliverkaunds3 жыл бұрын
  • wow, that was a hell of a playlist !! i could watch a million of these and never get bored. Thanks socratica

    @sudofix@sudofix3 жыл бұрын
  • This was great thanks! Just had a query that was taking 2 minutes to execute. I added in about 9 indexes and it now runs in 2 seconds. Gamechanger!

    @darrenleonard@darrenleonard3 жыл бұрын
  • Could you please tell the Socratica to make new series of topology, or any high math

    @STIVESification@STIVESification5 жыл бұрын
  • Just fell in love with you after hearing your laughter.

    @bablobko@bablobko4 жыл бұрын
  • The level of sarcasm is just the right amount and amusing! Keep up the great work :)

    @josuemedia@josuemedia4 жыл бұрын
  • You should show query planner to illustrate how RDBMS determines which query plan to use. I'm guess that is already on your list of things to cover. After that, you should cover lock escalation under concurrent load where you have a mix of reads/writes on the same table. Then for the advanced SQL indexing concepts, compare b-tree versus bitmap indexes. If you get to report queries materialized views versus dynamic views for complex multi-dimensional queries :)

    @woolfel@woolfel5 жыл бұрын
  • woooow really interesting and the way of her teaching and animation was awesomee....upload more videos on sql ,clear explanation ........congrats

    @avinash7154@avinash71544 жыл бұрын
  • you have no idea, how much you have helped me.. i have no words to say thanks .. it changed my whole DB speed .. thanks million ..

    @SanamSindhooShaikh@SanamSindhooShaikh3 жыл бұрын
  • Your videos help me understand farrr better than my professors. Thank you so much for all you do!

    @Sergeespaillat@Sergeespaillat5 жыл бұрын
  • Love how you're insisting on reading out all times in milliseconds like a programmer, even though the GUI already has converted it into more human digestible seconds and ms.

    @SteinGauslaaStrindhaug@SteinGauslaaStrindhaug5 жыл бұрын
    • It's to make it sounds that it really takes a lot of time because 4000 is bigger than 4.

      @FeLiNe418@FeLiNe4184 жыл бұрын
  • "The hardship is impossible to put in words." 😍

    @AzfarRizvi@AzfarRizvi4 жыл бұрын
  • I don't think any educational material has been as entertaining as this playlist I just watched... It's mind blowing!... Totally the best investment of my time!

    @godwinshaibu6328@godwinshaibu632810 ай бұрын
  • I, hereby declare that Socratica is the obvious front-runner for the first channel to reach 100 billion subs.

    @chevalier5691@chevalier56915 жыл бұрын
  • Extremely helpful video, thanks

    @edvzig@edvzig4 жыл бұрын
  • what about : SELECT COUNT(*) FROM person WHERE last_name = 'Mohanty', AND first_name = 'Ulka'; Result: ONE! and only ONE! Messages: Successfully run. We found the best teacher in earth and mars! Total query runtime: 0 msec.

    @DARKCOP2011@DARKCOP20115 жыл бұрын
  • Have to say that this is the only video I have seen that makes SQL seems fun to learn. Thank you!

    @sorosw2980@sorosw29803 жыл бұрын
  • Love these videos. I'm not new to python, but this may just be the first video series I watch fully. Nice work!

    @MoSec9@MoSec94 жыл бұрын
  • "The hardship is impossible to put in to words!!!" 🤣🤣

    @bndissanayaka@bndissanayaka3 жыл бұрын
  • one day machine will talk like human, human like machine

    @jorjiang1@jorjiang15 жыл бұрын
  • Did not expect this level of enthusiasm; not a complaint.

    @MelancholyMadoka@MelancholyMadoka3 жыл бұрын
  • First, I really think these videos do a great job of teaching their lessons. Second, I really appreciate your commitment to the bit.

    @DavidBranson42@DavidBranson42 Жыл бұрын
  • Fantastic job girl... Well explained... We learn the most when we are having fun... And you have successfully turned SQL into fun.... Love the craziness

    @sachunjyo@sachunjyo4 жыл бұрын
  • One of the greatest explanations I've ever seen! Well done! Anybody knows the name of the piano music? 8:11

    @iTurkiQ@iTurkiQ5 жыл бұрын
    • "Quasi una fantasia" (Moonlight Sonata) by Beethoven

      @oliviergobet9408@oliviergobet94083 жыл бұрын
  • This is a very informative video. I am so happy I finally managed to understand indexes. Thank you. Very explanatory.

    @naebara1297@naebara12973 жыл бұрын
  • The professors at our university can learn a lot about teaching from you! This was awesome

    @sempribo@sempribo3 жыл бұрын
  • all in RAM

    @koungmeng@koungmeng5 жыл бұрын
    • EVERY SINGLE COLUMN...YESSS! xD

      @stifflery@stifflery5 жыл бұрын
    • Not a big deal.

      @danielsandor8738@danielsandor87384 жыл бұрын
  • Great video! How can I check if a database has index before running a query?

    @priscillaamorim88@priscillaamorim885 жыл бұрын
    • sp_helpindex Person.

      @robertl30@robertl305 жыл бұрын
  • This playlist was GLORIOUS. Thank you!!!

    @Anna36936@Anna36936 Жыл бұрын
  • This is hands down the best video explaining this topic!

    @BENNiiiiiiiiiiiiiii1@BENNiiiiiiiiiiiiiii14 жыл бұрын
  • The typing effects music makes me feel like I'm in a game.

    @shawntv7130@shawntv71304 жыл бұрын
  • I dont know how you do it, but i watch this for entertainment.

    @maciejk125@maciejk1255 жыл бұрын
  • oh i love how you explain it! 1000x better than the teacher from the course I am attending. Thank you for sharing your amazingness with humanity, and for making a boring subject very interesting and fun

    @beatwavs@beatwavs3 жыл бұрын
  • This is one of the best computer science videos I've seen in my career (I'm final year 2 at uni) and whole life also, you rock!

    @iosifpuha6114@iosifpuha61149 ай бұрын
  • these are the best tutorials because they short and sweet just like my stamina in bed.

    @shortcutDJ@shortcutDJ5 жыл бұрын
  • 9:34 I can hear somebody BTS snickers ...

    @ezadviper@ezadviper5 жыл бұрын
  • Absolutely outstanding content. Such a clear breakdown showing the before and after. Thank you

    @curiousgeorge2064@curiousgeorge2064 Жыл бұрын
  • The way teach or explain, Its best. Concepts just penetrate into mind. Took me 4050ms to write this😂😂

    @arpitmahadule5501@arpitmahadule55014 жыл бұрын
  • did anybody else feel like yelling : "FIRE THE LASSEEEEERRRR"

    @spwim@spwim3 жыл бұрын
    • She is Dr. Evil's daughter 😂

      @oliverkaunds@oliverkaunds3 жыл бұрын
  • Oh, that laugh @0:07!

    @kirbymarchbarcena@kirbymarchbarcena5 жыл бұрын
    • or 9:29 xD

      @Nsuidara@Nsuidara5 жыл бұрын
    • @@Nsuidara Oh,yeah, forgot that one which not even Rita Repulsa can do better.

      @kirbymarchbarcena@kirbymarchbarcena5 жыл бұрын
  • never learn faster and clear before about indexes, thanks a lot

    @fajara.r1379@fajara.r13794 жыл бұрын
  • This is how I need SQL explained to me, thank you so much!

    @helenhayes3298@helenhayes32983 жыл бұрын
  • "Indexes"?? Ok, we declare war on Mars for despicable crimes against human language. Your sins would not go unpunished.

    @the-mush@the-mush5 жыл бұрын
    • grammarist.com/usage/indexes-indices/ Although you are right that it is used in the wrong context, it is not incorrect to say "indexes".

      @MrBlastZone3000@MrBlastZone30004 жыл бұрын
  • @Socratica, although your Python series was far more entertaining and captivating, this SQL series is just as informative and educational. Nonetheless I love you for your ability to break down key concepts. Thank you!

    @anthonygonsalvis121@anthonygonsalvis1213 жыл бұрын
  • This is quite a goofy video but at the end I learned everything I needed unlike from watching other videos on this topic by different content creators. Thank you for such a great video.

    @michalkubecka9045@michalkubecka9045 Жыл бұрын
  • I first encountered your videos when I was learning python in the beginning of pandemic lockdown. The python videos are sarcastic and engaging. Thank you.

    @ashishghadoje3604@ashishghadoje36042 жыл бұрын
  • Yes finally a decent video that is in English and understandable for human beings

    @Elitea20@Elitea204 жыл бұрын
  • Thank you for not only vulgarizing efficently but also doing it in such a fun way. You are much appreciated

    @ismahenelarbi5403@ismahenelarbi54032 жыл бұрын
  • Amazing editing and the explanation couldn't have been better. Thank you!!

    @sajaljaiswal1659@sajaljaiswal1659 Жыл бұрын
  • Thank you! This is what I've been looking for so long. You explained it very simply and only the important things. Thank you! 😍

    @vk86444@vk864443 жыл бұрын
  • Excellent video.

    @skylermccrary@skylermccrary7 ай бұрын
  • lovely and smart...mindblowing... one semester of SQL just done... . i loved it !!!

    @_Alpha8@_Alpha82 жыл бұрын
  • Straight to the point unlike other tutorials. I only needed the concept really..

    @waitwhat7164@waitwhat71649 ай бұрын
  • This was one of the most fun tutorials I have watched in my life.

    @narendranomprakash7984@narendranomprakash79842 жыл бұрын
  • I absolutely love the narration style.

    @efeuzel1399@efeuzel13994 жыл бұрын
  • Omg, this channel... The songs, wallpapers, environment, I just loved it! Congratulations.

    @tiagomarmitt4542@tiagomarmitt45423 жыл бұрын
  • This lady is on another level. You have taken KZhead to another level

    @obedmireku3137@obedmireku31372 жыл бұрын
  • overly simplified and ideal way to explain Indexing. Thank you so much

    @rajmehta6498@rajmehta64982 жыл бұрын
  • Thank you. This video on indexing help me speed up a project I have been working on for two years. I love your teaching style, you are awesome. Keep it up!

    @johnpeake4721@johnpeake47213 жыл бұрын
    • We love to hear how are videos are helping people in the real world!! It really inspires us to make more. Thank you for sharing!! 💜🦉

      @Socratica@Socratica3 жыл бұрын
KZhead