How to Create Database Indexes: Databases for Developers: Performance #4

แชร์
ฝัง
  • เผยแพร่เมื่อ 13 มิ.ย. 2024
  • Indexes are one of the most common performance tools available.
    But how do you create one? And how does it help the database find your data faster?
    Watch this video to learn how to create an index and know if the optimizer used it.
    Need help with SQL?
    Ask us over on AskTOM: asktom.oracle.com
    Twitter: / chrisrsaxon
    Daily SQL Twitter tips: / sqldaily
    All Things SQL blog: blogs.oracle.com/sql/
    Test your SQL Skills on the Oracle Dev Gym: devgym.oracle.com/
    ============================
    The Magic of SQL with Chris Saxon
    Copyright © 2020 Oracle and/or its affiliates. Oracle is a registered trademark of Oracle and/or its affiliates. All rights reserved. Other names may be registered trademarks of their respective owners. Oracle disclaims any warranties or representations as to the accuracy or completeness of this recording, demonstration, and/or written materials (the “Materials”). The Materials are provided “as is” without any warranty of any kind, either express or implied, including without limitation warranties or merchantability, fitness for a particular purpose, and non-infringement.
  • วิทยาศาสตร์และเทคโนโลยี

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

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

    Woooooow, man! This was SO CLEAR explanation, nice! I'm impressed with the quality of the vid with everything - sound hq, switching between bricks, code and drawings where needed, highlighting the stuff and everything. Very good video!

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

      Thanks, glad you found this useful :)

  • @Sam-Land
    @Sam-Land 3 ปีที่แล้ว +3

    I wish I had watched this years ago to explain the ordering. I'm going to be breaching this video

  • @SubhashPophale
    @SubhashPophale 2 ปีที่แล้ว

    This won't be exaggeration if I say you read a whole lot pages and watch the this 13 min video. Excellent and lucid explaination of Indexes in oracle database.

    • @TheMagicofSQL
      @TheMagicofSQL  2 ปีที่แล้ว

      Thanks, glad you found this useful!

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

    I was about to thumb it up and realized it already was. Plenty of Aha! Moments
    Very clear, and fun too :)

  • @amirthalakshmi7348
    @amirthalakshmi7348 3 ปีที่แล้ว

    Thank you very much... It's really really very very useful.,.. This series deserves more views..

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

      You're welcome, please share these with anyone you think they can help :)

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

    Amazing!! Thanks!

  • @jayhaygh
    @jayhaygh 3 ปีที่แล้ว

    Brilliant! This deserves more views

    • @TheMagicofSQL
      @TheMagicofSQL  3 ปีที่แล้ว

      Thanks, glad you enjoyed this!

  • @kevingergely2462
    @kevingergely2462 3 ปีที่แล้ว

    This was awesome man thank you very much

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

      You're welcome, glad you enjoyed this

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

    You really made my day :-)

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

    BRILLIANT thank you

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

      You're welcome, glad this helped :)

    • @LillyCode
      @LillyCode 3 ปีที่แล้ว

      @@TheMagicofSQL It did, thank you for the entertianment and education.

    • @LillyCode
      @LillyCode 3 ปีที่แล้ว

      Or other way around.... education and entertainment!.. The fact that you explained it in a fun way, made it really fun!

  • @akadiryigit
    @akadiryigit 3 ปีที่แล้ว

    Hi Chris, Thanks for sharing the video, It is easy to understand and I love it. :) Could you please answer my questions when you have time ?
    I have a question about differences between Partition and Index. When should we use Index or Partition ? Why should choose Partition instead of Index.
    Thanks,

    • @TheMagicofSQL
      @TheMagicofSQL  3 ปีที่แล้ว

      This is a big topic, but broadly speaking:
      - You use an index to find a few rows
      - You partition a table to make massive tables easier to manage
      For more details on partitioning, see this guide from my colleague Connor asktom.oracle.com/partitioning-for-developers.htm

  • @Nick71NA
    @Nick71NA 3 ปีที่แล้ว

    Wonderful explanation. Only a observation, complexity for the use of index in B-tree is O(log(N)) where the logarithm base is b.

    • @TheMagicofSQL
      @TheMagicofSQL  3 ปีที่แล้ว

      Thanks. Is your observation related something specific in the video?

    • @Nick71NA
      @Nick71NA 3 ปีที่แล้ว

      @@TheMagicofSQL Only a clarification, in the video you explain the complexity for the access at B-Tree. Thanks a lot for your teachments

  • @PramodPattar-gl4df
    @PramodPattar-gl4df ปีที่แล้ว

    Hi Chris, Amazing videos with simple and clear way of explanation.👍
    I Do have a doubt, if we have a table where 90-95% of a column data values are unique. can we still create a primary key or unique index on that column. how can we use that column values efficiently for data access?

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

      The values in a PK/Unique index must be unique. If there are any duplicates you can't create a validated constraint. As long as your queries get "few" rows from the table a regular (non-unique) index works fine

    • @PramodPattar-gl4df
      @PramodPattar-gl4df ปีที่แล้ว

      @@TheMagicofSQL Thank you Chris for quick reply. 🙂
      How can I get in touch with you further. I have some queries using views which turns out to be a nightmare seeing their execution plans and performance is bad. Need your expertise guidance a bit.

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

      @@PramodPattar-gl4df You can submit questions at asktom.oracle.com; please ensure you include the execution plans & details of what you've tried

  • @premjithtube
    @premjithtube 2 ปีที่แล้ว

    How many index can create against a table?? Instead of creating index(color,shape), wat abt creating two separate indexs with these columns and use in the query?

    • @TheMagicofSQL
      @TheMagicofSQL  2 ปีที่แล้ว

      You can create an index for each unique combination of columns and index properties.
      You can create a separate index on each column and the optimizer can scan each to find which rows to access.
      In general this is less efficient than one multi-column index though. If there's little/no correlation between colour and shape and each have four distinct values, finding all the rows for a (colour, shape) combo will get ~1/16 of the rows.
      With separate indexes, the database has read a quarter of the rows from each index. Then combine these to get down to the ~1/16 rows in the table.
      Whereas with the multicolumn index the database can just search the index to find these rows.

    • @premjithtube
      @premjithtube 2 ปีที่แล้ว

      @@TheMagicofSQL thanku for ur reply sir.
      If i hav a txn table wit colmns txndate,branch,currency,country,bank. If i mak index wit txndate&branch, txndate¤cy, txndate&country, txndate&bank den if i hav a query with where condition wit txndate, branch, bank. Wat wil be the impact?

    • @TheMagicofSQL
      @TheMagicofSQL  2 ปีที่แล้ว

      It depends which the optimizer thinks is the best choice - it all comes down to the specifics of your data. Watch the other videos in this performance series to see what affects these decisions.

  • @sebon11
    @sebon11 3 ปีที่แล้ว

    P.s. you're from UK or USA? Or even Australia maybe?