Skip to Main Content

Write Great SQL Office Hours

Free tips and training every month! Subscribe for reminders and more from Office Hours. FAQ

Header container

July 21, 2020

13:00 UTC   Start Times Around the World

Subscribe to be notified of changes to sessions and give us feedback!

Having trouble watching the video on this page? Open the video in your browser.


Which Indexes Should I Create?
Many indexing examples examine a single SQL statement, suggesting the best method for that query.

But in the real world your application will query a table in many different ways. This means you need to look at the overall workload when choosing which indexes to create. This session highlights how to assess this.

Highlights include:

00:50 - Example queries
03:05 - Which indexes should we create for the demo queries?
07:00 - How databases search B*Tree indexes
11:10 - PRINCIPLE Ensure the leading columns of your index are in the where clause
15:00 - Discussion of possible indexes
17:00 - Issues with creating all the "best" indexes
28:00 - PRINCIPLE - create as few indexes as possible
31:50 - Index compression
37:00 - PRINCIPLE - put compressible columns first in an index
51:15 - Return to demo - automatic indexing has created the indexes!
54:20 - Session recap

Your Experts

    Chris Saxon

    Chris Saxon   

    Chris Saxon is an Oracle Developer Advocate and quizmaster on Dev Gym. His job is to help you get the best out of the Oracle Database and have fun with SQL! He's also part of the answer team on Ask TOM and creates YouTube videos at The Magic of SQL channel.
    Keith Laker

    Keith Laker   

    I have been working with Oracle data warehouse technology for over 20 years working on a wide variety of data warehouse projects both as a consultant and an onsite support engineer. I am now part of the Data Warehouse Product Management Team where I am responsible for Autonomous Database and analytical SQL. I am based in the UK at our Manchester office. A key part of my role is to work with our sales teams to brief our customers on data warehousing and analytical SQL: explaining the wide variety of new and exciting opportunities that our DW and analytical solutions can support. I regularly deliver sales training for data warehousing and analytical SQL across all our sales regions and provide competitive intelligence support across all the major data warehouse vendors.