Differences between Clustered vs Nonclustered Indexes in SQL Server

Поделиться
HTML-код
  • Опубликовано: 25 сен 2017
  • Should you use a clustered or a nonclustered index?
    When starting out with SQL, you might intuitively know that you should add an index to a table, but you might not be sure what kind of index to add.
    In this video we go over the basics of clustered and nonclustered indexes to help you get through index choice paralysis.
    Blog post with example queries:
    bertwagner.com/2017/09/26/clu...
    Follow me on Twitter:
    / bertwagner
    Want to receive my latest weekly blog posts and videos in your inbox? Sign up for the newsletter here: upscri.be/c77fc8/
  • НаукаНаука

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

  • @rondabrown8897
    @rondabrown8897 5 лет назад +17

    Finally someone that explains by using realistic and relate-able scenarios...I actually get it now! Thanks

  • @emiliamatrejek5869
    @emiliamatrejek5869 Год назад +2

    I went through all videos on RUclips regarding this topic and finally that's the one that makes it clear to me. Many thanks!

  • @carloscepeda8663
    @carloscepeda8663 4 года назад +4

    Man, you're my hero, I'm not a database guy but this was so perfectly understandable.

  • @MrShivanand20
    @MrShivanand20 5 лет назад +13

    finally, a guy on point.. this was perfect!!

  • @shaoyizhang
    @shaoyizhang 6 лет назад +14

    The mushroom book example is very helpful. Thank you!

  • @cedrics7374
    @cedrics7374 5 лет назад +1

    Thanks man, I was searching for a good explanation of the differences between both, this was perfect!

  • @robertgaudreau2520
    @robertgaudreau2520 5 лет назад

    Great Bert, very clear explanation on how to use the index.

  • @rabes87
    @rabes87 3 года назад

    Dude, this video was 200x more effective than half of the Microsoft press 70-762 textbook. Thank you sooooo much!!

  • @galaxywalker2976
    @galaxywalker2976 3 года назад

    Best explanation on index I have ever watched!

  • @elinanikolopoulou1769
    @elinanikolopoulou1769 Год назад

    Best video i came across so far, for this topic. Great analogies

  • @andyqueiroz
    @andyqueiroz 2 года назад

    The better explanation ever found in the hole that are databases

  • @elisavetkonstantopoulou5386
    @elisavetkonstantopoulou5386 3 года назад

    Thank you so much for this video! You explained the purpose of both types of indexes perfectly!

  • @UmbreonLuv1
    @UmbreonLuv1 3 года назад

    Incredibly helpful on the difference between the two, thank you so much!

  • @gotchihaeyo1825
    @gotchihaeyo1825 Год назад

    At 7:40, I finally understood the nonclustered index. Thanks.

  • @almaguapa-sailboatliveaboa440
    @almaguapa-sailboatliveaboa440 2 года назад

    Great teacher. Very good to relate an analogy and explain.

  • @oljaivkovic6920
    @oljaivkovic6920 4 года назад

    Really well explained, it helped me a lot!! Thanks!

  • @FlashDark
    @FlashDark 6 лет назад +2

    Great review, thanks!

  • @Vasanthkumar-cm8he
    @Vasanthkumar-cm8he 4 года назад

    Great work... solves my basic doubts

  • @scottstabbert7966
    @scottstabbert7966 2 года назад

    Nice. Clear and succinct! Thanks!

  • @zzhao463
    @zzhao463 4 года назад

    fantastically explained!

  • @gladyskiruga9561
    @gladyskiruga9561 3 года назад

    This was really helpful. Thank you so much.

  • @TheGates7
    @TheGates7 3 года назад

    Maan, this was spot on. Thank YOU

  • @BoxerDogs
    @BoxerDogs 4 года назад +3

    Do you have a video that explains the differences between a table scan, index scan and an index seek and when SSMS will use each of these? If not, would you consider doing a video about this?

  • @cindyt8152
    @cindyt8152 Год назад

    This is so clear! thanks!

  • @fadimichael9788
    @fadimichael9788 6 лет назад +2

    A very good video, only part is the example of the clustered index, in my opinion, should be a phone book or dictionary instead of textbook content as the clustered is physically sort/ordered the data, this example very much applied on the no-clustered index. Thanks.

  • @yoanadimitrova8760
    @yoanadimitrova8760 6 лет назад +3

    Thanks, blue eyes! That was helpful. Can you do a video on ColumnStore Indexes, please?

  • @anshumanbaruah4161
    @anshumanbaruah4161 2 года назад

    Thanks a lot Bert!

  • @jubinsoni4694
    @jubinsoni4694 4 года назад

    Great Explanation

  • @aniketdeshmane6569
    @aniketdeshmane6569 Год назад +1

    THANKYOU!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! You made this so much easy

  • @sujinsnair
    @sujinsnair 5 лет назад

    Very helpful, Thank you

  • @Genovia816
    @Genovia816 3 года назад

    Super Helpful, Thanks

  • @muchwow3839
    @muchwow3839 3 года назад

    FINALLY! An explanation I actually understand lol

  • @mehdizeynalov1062
    @mehdizeynalov1062 Год назад

    Thank you very much, would be good if some examples were added, maybe it's already there in next videos

  • @shreyalande7573
    @shreyalande7573 4 года назад

    Outstanding!!!!

  • @aaronwhager
    @aaronwhager 5 лет назад

    Very helpful, thanks.

    • @aaronwhager
      @aaronwhager 5 лет назад

      @@DataWithBert Yea man, I just cut a 20+ min query down to 6 seconds by creating a proper non-clustered index! Wow!

  • @MrNessuno31
    @MrNessuno31 3 года назад

    Absolutely brilliant explanation, thanks Bert!

  • @samdatta9163
    @samdatta9163 4 года назад

    Good video.it helped me a lot to understand clustered and non clustered index.can u plztell me that ..if i create unique key does it create a non clusterd index or clustred?

  • @lucianavasiloiei7864
    @lucianavasiloiei7864 Год назад

    Thank you!

  • @kundangaikwad8941
    @kundangaikwad8941 5 лет назад

    Nice explanation..! create more videos on others indexes

  • @katdareshruti
    @katdareshruti 3 года назад

    Thank you, thank you, thank you

  • @MasterCamus
    @MasterCamus 4 года назад

    So for a report that runs from a SP with a couple of temp tables. Is it better to add cluster index after filling the tables?

  • @trishlasaxena9970
    @trishlasaxena9970 5 месяцев назад

    this video is really helpful . I have a doubt. If I have defined clustered and non clustered index and we are inserting new row, it will add the newly added row in specific position and shift other rows as per clusterd index. So, how non clustered index is getting benefitted here on inserting new rows. And is that possible to have table without any clustered index.

  • @kirankumarkommalapudi9947
    @kirankumarkommalapudi9947 6 лет назад

    Nice video.. but my understanding was table of contents also like non clusterd indexes not the clusterd index. Because contents also have just the address of the details in that book. Please correct me if I am wrong. In the video @5.10 min this info mentioned..

  • @alexanderkorotkoff2639
    @alexanderkorotkoff2639 2 года назад

    Thank you

  • @BoxerDogs
    @BoxerDogs 4 года назад

    At 6:35 you give an analogy about a nonclustered index and a clustered index. If I understand what you are saying, are the following statements true:
    - A nonclustered index is like an index at the back of a book, with page numbers (each page number is like a row identifier)
    - A clustered Index is like an index at the back of a book, but no pages numbers (which would seem odd for a book to have)

  • @hnasr
    @hnasr 5 лет назад

    well said! great video

  • @seanpaulson9098
    @seanpaulson9098 8 месяцев назад

    4:05 im confused why a insert would be so slow in this situation.
    Can clustered indexas not be sorted by some sort of tree?

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

    4:55 easily explained

  • @BijouBakson
    @BijouBakson Год назад

    thank u

  • @snake1625b
    @snake1625b 2 года назад

    with the cheap cost of storage, is the extra space a unclustered index really that much of a downside?

  • @markmatheney8631
    @markmatheney8631 Год назад

    Ummm, regarding multiple nonclustered indexes. You made a comment that occasionally you have added a nonclustered index only to see other nonclustered indexes take a performance hit.
    If each nonclustered index is "independent", how could it effect the performance of other nonclustered indexes?
    When doing a query, doesn't SQL pick the most optimal index, and use that one?
    In other words, I suppose that it SQL "thought" a new nonclustered index was "faster" and used it, I suppose that would be possible, but wouldn't that we a problem with SQL?

  • @anitha9006
    @anitha9006 2 года назад +1

    Indexes should not be used 1)on small tables 2)tables that have large batch updates or insert operations 3)not be used on tables with high number of null values4)columns that are frequently manipulated

  • @camiloatencio3662
    @camiloatencio3662 2 года назад

    SCREAMING AT THE INTRODUCTION

  • @ryanbiztech9181
    @ryanbiztech9181 3 года назад

    You remind me of the protagonist of Inception

  • @rahulsalunkhe8364
    @rahulsalunkhe8364 4 года назад +1

    Hi please next time please please use some animation or drawing...
    That will help a lot...

    • @richardplester
      @richardplester 4 года назад

      Wow the mushroom book analogy wasn't enough? Just mentally picture a table of contents and an index for a book, failing that rewatch where he flashes those parts of the book :) I'd rather Bert spends time banging out quality info vids rather than labouring on pretty but unnecessary graphics

    • @rahulsalunkhe8364
      @rahulsalunkhe8364 4 года назад

      @@richardplester Hi, at least you can draw on board, C its for better understanding for me..

  • @vittalshanbag2892
    @vittalshanbag2892 5 лет назад

    Hai sir,Pls provide me with demonstratation of clustered and non clustered index with small examples...
    Thank you sir