DP-300 Microsoft Azure Database – Evaluate performance improvements

  • By
  • July 10, 2023
0 Comment

1. 63, 68. identify and implement index changes for queries

In this video we’re going to have a look at identifying and implementing index changes for queries together with assessing index design for performance. So we’ve had a look at what indexes are in previous videos. So they stop us from having to go through the entirety of a table and allow us to seek a particular point. So what are the requirements for or indexes? Well, first of all, a big table. If you’ve got a small table, you probably don’t need an index. Small tables, even if you provide an index, may just use a scan anyway. You should have a small column size. So the best are things like numerics, but if you’ve got others like smaller text sizes, then that could be good as well.

So having an index on an Nvarchar 60 probably not that good. You should use columns which are in the where clauses and they need to be sagable. So in other words, we’ve had a look at when you’re using functions like year and left and other things, they just don’t work with indexes with sags, whereas if you used other things those are sagable. So less than greater than that sort of thing. So if you’re using a like then this is a perfectly well formed Sargable where clause. So wear hai is at the beginning. However, if I said where hai is anywhere, well, I can’t use an index for that because I would have to go through all of the items of the index anyway. So how do you create an index? Well, in TSQL you would say create and then you would either have a non clustered or a clustered index.

So name of index so I usually put IX underscore and then the table and then underscore and then the individual columns that he was indexing because the clustered or nonclassed index name needs to be unique. So create clustered or nonclustered I’ll talk about the differences in just a moment. Index the name of the index on and then the name of the table and then in brackets, that’s where you put the columns. Now what is a clustered index as opposed to a non clustered index? Well, you’re only allowed one clustered index per table. It’s frequently used with primary keys. When you create a primary key, you also create automatically a clustered index. It resorts the table based on the index. So a heap is a table without a clustered index. Once you have a clustered index, it gets resorted. So you should use it for frequently used queries and range queries. So between x and y, clustered indexes, when created with primary keys, use the unique clustered index.

So that means that there can only be one particular raw with each value. If you’re using multiple columns and it’s only one particular raw for the combination of the values, it is possible to create a nonunique clustered index. Most of the time it will be unique. So these are things that should be accessed sequentially in ranges. It’s quite good for identity columns. So identity columns are automatically created data columns. So it starts off one, two, three. In other words, it’s a sequential numbering. You don’t actually specify, the computer does. And clustered indexes are frequently used. So, whereas clustered indexes resorts a table, and you can only have one per table, because you can’t sort a table two different ways at the same time.

You can have as many nonclassed indexes as you want. It creates a separate index. But beyond, if you insert a row, update a row, delete a row, merge data sets together, then all of the indexes will need to be adjusted. So if you’ve got too many indexes, that could be slowing down your machine. Now, you don’t have to index the entire table. Suppose you have a where, a frequently used query with a very specific where. So where the city is equal to offer. Well, you could have an index that looks at just that particular where clause, that’s called a filtered index.

Now let’s imagine a hypothetical index. So I’ll create this index and it’s got references to all of these particular rows. And this happens on a particular page. And then there’s a new page which has everything else, and then another page which has everything else as well. So each of these are on separate but linked pages. And there’s also a hierarchy which says, go to this page if you want one to eight, this for nine to 17, this for 18 to 25. And this is all that we can contain on a particular page in this example. Now, what happens if I insert raw number 16? Well, I need to put it in here because an index needs to be in the right order, but I haven’t got any room. So what I need to do is break the page and create a separate page, maybe 16 goals on this page, 17 goals on the next page. It doesn’t then redo everything, it just creates a new page.

Now, suppose you didn’t want your index to use up all of the available space because you knew that you were going to be adding additional information. So at the time of creating the index, you wanted it to say, just allow five for each particular page. So it could have eight in terms of capacity. But you’re just saying, actually all I want is five. Well, you can do that with something called the fill factor. So I can say with fill factor equals, and in this case it would be five divided by eight or 62 or so. So now, if I have this index and Raw 15 comes along, then good news, here’s my page. It’s only got five items on it, I can just insert it, no need for the page to split, which obviously will take some time. And finally we can say that it is going to be sorted ascending or descending, just like with an order by.

So the default is ascending. If you happen to be using a particular query, lots of queries why it’s descending, then you might want to create the index that way. So this is how we can create an index in TSQL. Now you can’t do this for the Azure SQL Database, but in other types of databases you could in SSMS go to the indexes part, right and click and go New Index and have a visual way of doing that. As you can see, it just gives you an index template for the Azure SQL Database. So if I connect to a different database, I’m going to connect to my local database. So this could be like an SQL Server on Azure Virtual Machine and go to a particular table and right and click on Indexes and go to New Index.

Here we can see we can create clustered indexes and non clustered indexes and so forth and actually have a dialog box to do that, but that is not available in Azure SQL Database. Just a quick note about Column store. Now we won’t be talking too much about Column Store, but just to let you know, the traditional way of having data stored. So like this is called Raw Store. So we have each raw contained within a set unit. In SQL Server 2012, they introduced Column Store and it wasn’t that good in terms of number of situations when you can use it in 2012, but it got a lot better in 2014 and then got even better in 2016. So what Column Store does is it stores each column separately and then you have to get it together at the end.

So for instance, just like you get ranges of rows together, well, it’s the same way of being able to get columns together. So the advantage of this, if you’ve got a huge amount of data, your data warehouse we’re talking about, wouldn’t it be a lot easier to be able to just say, okay, give me all of the roles with this particular city and what a Column Store table does, and therefore a Column Store index does. Is it concentrates on a particular city or anything else in a page and it compresses it down.

So it says this is City 112-3456 and it has a list of all of the meanings of what city one and two and so forth are in the page header. We’ll be looking at Column Store later when we talk about the use of compression for tables and indexes. But if you see what Column Store is, it’s not the standard type of index, it’s an index on a different type of table. However, Column Store indexes are generally available in more status for Azure Database. So creating a table use create clustered or nonclustered or unique clustered. You could have unique nonclustered if you want index, name of the index on name of table and then in brackets the columns. You could have a filtered index if you use the where clause. And you can have spaces in the index.

So it takes more pages, but there’s less on each page if you use the with fill factor and that is expressed as a percentage. Except you don’t use a percentage sign, so it goes from one to 10. And finally, if you no longer need an index, you can always drop it. If I write and click on an index and go to script index as drop, you can see it’s a very simple drop index. Name of index on the name of the table. So it’s the first part, but just not using the words unique, non, clustered or clustered.

Comments
* The most recent comment are at the top

Interesting posts

The Growing Demand for IT Certifications in the Fintech Industry

The fintech industry is experiencing an unprecedented boom, driven by the relentless pace of technological innovation and the increasing integration of financial services with digital platforms. As the lines between finance and technology blur, the need for highly skilled professionals who can navigate both worlds is greater than ever. One of the most effective ways… Read More »

CompTIA Security+ vs. CEH: Entry-Level Cybersecurity Certifications Compared

In today’s digital world, cybersecurity is no longer just a technical concern; it’s a critical business priority. With cyber threats evolving rapidly, organizations of all sizes are seeking skilled professionals to protect their digital assets. For those looking to break into the cybersecurity field, earning a certification is a great way to validate your skills… Read More »

The Evolving Role of ITIL: What’s New in ITIL 4 Managing Professional Transition Exam?

If you’ve been in the IT service management (ITSM) world for a while, you’ve probably heard of ITIL – the framework that’s been guiding IT professionals in delivering high-quality services for decades. The Information Technology Infrastructure Library (ITIL) has evolved significantly over the years, and its latest iteration, ITIL 4, marks a substantial shift in… Read More »

SASE and Zero Trust: How New Security Architectures are Shaping Cisco’s CyberOps Certification

As cybersecurity threats become increasingly sophisticated and pervasive, traditional security models are proving inadequate for today’s complex digital environments. To address these challenges, modern security frameworks such as SASE (Secure Access Service Edge) and Zero Trust are revolutionizing how organizations protect their networks and data. Recognizing the shift towards these advanced security architectures, Cisco has… Read More »

CompTIA’s CASP+ (CAS-004) Gets Tougher: What’s New in Advanced Security Practitioner Certification?

The cybersecurity landscape is constantly evolving, and with it, the certifications that validate the expertise of security professionals must adapt to address new challenges and technologies. CompTIA’s CASP+ (CompTIA Advanced Security Practitioner) certification has long been a hallmark of advanced knowledge in cybersecurity, distinguishing those who are capable of designing, implementing, and managing enterprise-level security… Read More »

Azure DevOps Engineer Expert Certification: What’s Changed in the New AZ-400 Exam Blueprint?

The cloud landscape is evolving at a breakneck pace, and with it, the certifications that validate an IT professional’s skills. One such certification is the Microsoft Certified: DevOps Engineer Expert, which is validated through the AZ-400 exam. This exam has undergone significant changes to reflect the latest trends, tools, and methodologies in the DevOps world.… Read More »

sale-70-410-exam    | Exam-200-125-pdf    | we-sale-70-410-exam    | hot-sale-70-410-exam    | Latest-exam-700-603-Dumps    | Dumps-98-363-exams-date    | Certs-200-125-date    | Dumps-300-075-exams-date    | hot-sale-book-C8010-726-book    | Hot-Sale-200-310-Exam    | Exam-Description-200-310-dumps?    | hot-sale-book-200-125-book    | Latest-Updated-300-209-Exam    | Dumps-210-260-exams-date    | Download-200-125-Exam-PDF    | Exam-Description-300-101-dumps    | Certs-300-101-date    | Hot-Sale-300-075-Exam    | Latest-exam-200-125-Dumps    | Exam-Description-200-125-dumps    | Latest-Updated-300-075-Exam    | hot-sale-book-210-260-book    | Dumps-200-901-exams-date    | Certs-200-901-date    | Latest-exam-1Z0-062-Dumps    | Hot-Sale-1Z0-062-Exam    | Certs-CSSLP-date    | 100%-Pass-70-383-Exams    | Latest-JN0-360-real-exam-questions    | 100%-Pass-4A0-100-Real-Exam-Questions    | Dumps-300-135-exams-date    | Passed-200-105-Tech-Exams    | Latest-Updated-200-310-Exam    | Download-300-070-Exam-PDF    | Hot-Sale-JN0-360-Exam    | 100%-Pass-JN0-360-Exams    | 100%-Pass-JN0-360-Real-Exam-Questions    | Dumps-JN0-360-exams-date    | Exam-Description-1Z0-876-dumps    | Latest-exam-1Z0-876-Dumps    | Dumps-HPE0-Y53-exams-date    | 2017-Latest-HPE0-Y53-Exam    | 100%-Pass-HPE0-Y53-Real-Exam-Questions    | Pass-4A0-100-Exam    | Latest-4A0-100-Questions    | Dumps-98-365-exams-date    | 2017-Latest-98-365-Exam    | 100%-Pass-VCS-254-Exams    | 2017-Latest-VCS-273-Exam    | Dumps-200-355-exams-date    | 2017-Latest-300-320-Exam    | Pass-300-101-Exam    | 100%-Pass-300-115-Exams    |
http://www.portvapes.co.uk/    | http://www.portvapes.co.uk/    |