1 00:00:00,150 --> 00:00:06,750 ‫What is going on, guys, my name is Hussein, and as some of you might know, I'm still in vacation 2 00:00:07,350 --> 00:00:16,890 ‫and I don't have my regular office and my camera, so I apologize for the audio quality. 3 00:00:17,190 --> 00:00:25,710 ‫But I thought I'll make a quick video for the Q&A lecture of the month of December. 4 00:00:25,800 --> 00:00:27,870 ‫I started doing this back in October. 5 00:00:28,200 --> 00:00:33,150 ‫And you guys seem to enjoy this kind of interaction. 6 00:00:33,620 --> 00:00:41,010 ‫Right where I pick a question from the introduction to database and joining Udemy course and elaborate 7 00:00:41,010 --> 00:00:41,430 ‫on that. 8 00:00:41,850 --> 00:00:52,110 ‫So as you know, I almost answer every single question that you guys ask in the anime section Q&A and 9 00:00:52,110 --> 00:01:00,240 ‫but usually, you know, when you when you type things and it's really hard to, you know, I am a horrible 10 00:01:00,240 --> 00:01:00,660 ‫person. 11 00:01:00,660 --> 00:01:06,990 ‫I like to talk more than I type and my, you know, my writing isn't that great to begin with, but 12 00:01:07,160 --> 00:01:15,630 ‫I thought, I'll just make a video to elaborate on one of these answers, and we'll pick one or one 13 00:01:15,630 --> 00:01:18,580 ‫or two questions, then elaborate on them. 14 00:01:18,660 --> 00:01:19,890 ‫I've always thought so. 15 00:01:20,400 --> 00:01:24,000 ‫I thought, I'll start with this question from Shivam. 16 00:01:24,660 --> 00:01:31,870 ‫Why will any update and post Chris updates all indexes corresponding to that table? 17 00:01:31,880 --> 00:01:36,690 ‫This sort of phrase the question of the brand and explain that one. 18 00:01:36,810 --> 00:01:38,220 ‫What exactly is that? 19 00:01:38,910 --> 00:01:41,670 ‫So this is referring to the must watch video. 20 00:01:43,700 --> 00:01:49,340 ‫A lecturer, actually, of how tables and indexes are a start to this, I really, really recommend 21 00:01:49,340 --> 00:01:59,600 ‫you watch this before really starting the course, because this is the fundamental things of the building 22 00:01:59,600 --> 00:02:05,600 ‫block that you need to understand and build upon yourself. 23 00:02:05,600 --> 00:02:09,380 ‫Once you understand these basics, it's like understanding math. 24 00:02:09,740 --> 00:02:15,590 ‫Once you adjust to how ad addition works, you know how multiplication will work. 25 00:02:15,590 --> 00:02:20,750 ‫And once you understand how multiplication works, division just comes and naturally, everything is 26 00:02:20,750 --> 00:02:23,750 ‫derived from the thing that comes before it. 27 00:02:23,960 --> 00:02:24,290 ‫Right? 28 00:02:24,770 --> 00:02:30,140 ‫You don't memorize right things usually like in math. 29 00:02:30,140 --> 00:02:31,580 ‫You never memorize an equation. 30 00:02:31,580 --> 00:02:34,460 ‫You know how it works and you derive it right? 31 00:02:34,470 --> 00:02:37,910 ‫You can solve anything by understanding the basic things. 32 00:02:38,150 --> 00:02:42,800 ‫That's why we need to do the same thing with any domain. 33 00:02:43,340 --> 00:02:45,500 ‫Really, engineering is one of them, right? 34 00:02:45,770 --> 00:02:47,150 ‫We tend to memorize. 35 00:02:47,150 --> 00:02:55,530 ‫We tend to say, Oh, it's the way it is or my school or or MongoDB is faster is just the way it is. 36 00:02:55,550 --> 00:02:57,280 ‫No, it's just at the end of the day. 37 00:02:57,290 --> 00:03:01,700 ‫It's just basic building things, building blocks at once. 38 00:03:01,700 --> 00:03:05,780 ‫You understand these basic things you can. 39 00:03:05,810 --> 00:03:07,100 ‫You don't need anyone. 40 00:03:07,100 --> 00:03:08,420 ‫You don't need me anymore. 41 00:03:08,420 --> 00:03:12,200 ‫You don't need anyone to tell you, Why is this better than this? 42 00:03:12,380 --> 00:03:16,930 ‫You make the decision because at the end of the day, you ask, Is it OK? 43 00:03:16,940 --> 00:03:18,110 ‫Why is this OK? 44 00:03:18,110 --> 00:03:19,250 ‫How does this work? 45 00:03:19,670 --> 00:03:20,570 ‫You know how it works? 46 00:03:20,570 --> 00:03:24,350 ‫Because at the end of the day, everything is all comes to databases. 47 00:03:24,830 --> 00:03:32,480 ‫And we try to be smart in databases and start, OK, what is happening really right? 48 00:03:32,750 --> 00:03:37,790 ‫When you're issuing a sequel state, once you understand what is exactly is happening? 49 00:03:39,120 --> 00:03:46,500 ‫You must go to another database and ask the same question, how is this database system doing compared 50 00:03:46,500 --> 00:03:47,430 ‫to PostgreSQL? 51 00:03:47,430 --> 00:03:48,440 ‫How was mostly called, though? 52 00:03:48,500 --> 00:03:53,820 ‫It wasn't because at the end of the day, they have to solve a basic problem, right? 53 00:03:54,690 --> 00:03:59,370 ‫How to optimize Io your writing, reading or writing to disk? 54 00:03:59,640 --> 00:04:00,690 ‫You write it to memory. 55 00:04:00,690 --> 00:04:04,500 ‫You have to flush the disk you you want to solve the durability problem. 56 00:04:04,800 --> 00:04:12,960 ‫At the end of the day, it's all, you know, first principles that everybody need to adhere to. 57 00:04:13,320 --> 00:04:14,820 ‫There is no exception. 58 00:04:15,300 --> 00:04:23,430 ‫And the problem is marketing gets into the way Oh, this is like in memory, whatever the right or this 59 00:04:23,430 --> 00:04:31,080 ‫is that faster or this is on the cloud something you know, it just jargon gets into the wing, gets 60 00:04:31,080 --> 00:04:31,890 ‫confusing. 61 00:04:31,890 --> 00:04:38,550 ‫So that other way, let's get in to the first question, which is why will any update impulse Chris 62 00:04:38,550 --> 00:04:41,100 ‫updates indexes correspond to the table? 63 00:04:41,370 --> 00:04:49,890 ‫So this is something I mentioned in the in this lecture, and we do need to understand the indexes are 64 00:04:49,890 --> 00:04:51,450 ‫there for a reason, right? 65 00:04:52,050 --> 00:05:01,110 ‫Indexes are there so that we avoid searching millions and millions and millions of things. 66 00:05:01,380 --> 00:05:05,550 ‫Whether these things or documents rows, blobs, who cares, right? 67 00:05:06,360 --> 00:05:10,610 ‫Indexes allow us to, you know, take shortcuts. 68 00:05:10,620 --> 00:05:12,480 ‫Think of an index like this. 69 00:05:12,720 --> 00:05:15,090 ‫You're going to a secretary office. 70 00:05:15,570 --> 00:05:17,640 ‫Oh, find me a company, zebra. 71 00:05:17,940 --> 00:05:18,300 ‫Right? 72 00:05:18,690 --> 00:05:23,790 ‫And there are a lot of, you know, entries and find me. 73 00:05:23,790 --> 00:05:27,030 ‫The phone number of this company is called Zipporah, right? 74 00:05:27,570 --> 00:05:32,370 ‫You can take the phone book and search from A to Z. 75 00:05:33,420 --> 00:05:37,320 ‫But an index says, OK, zebra cells with a Z. 76 00:05:37,650 --> 00:05:41,520 ‫Let's only search the ZS or the ZS if you're from the UK. 77 00:05:42,390 --> 00:05:44,880 ‫And that's basically what an index is. 78 00:05:44,890 --> 00:05:46,810 ‫It just narrows the search space. 79 00:05:47,280 --> 00:05:52,200 ‫So like, oh, while researching a b, c d and all that stuff, search only those things you need. 80 00:05:52,860 --> 00:05:54,360 ‫That was exactly what the index does. 81 00:05:55,320 --> 00:06:05,100 ‫It just smartly, based on the column that you indexed builds a data structure, right, which needs 82 00:06:05,520 --> 00:06:08,570 ‫to be stored, needs to be put in memory. 83 00:06:08,590 --> 00:06:09,720 ‫Need to be issued. 84 00:06:10,200 --> 00:06:11,820 ‫So you still need to manage this thing. 85 00:06:11,940 --> 00:06:12,510 ‫It's not free. 86 00:06:12,510 --> 00:06:13,140 ‫Nothing is free. 87 00:06:13,620 --> 00:06:13,860 ‫Right? 88 00:06:14,160 --> 00:06:15,060 ‫So you build that. 89 00:06:15,150 --> 00:06:20,550 ‫They just like you and you search it first and then that data sector, that index will tell you, Oh, 90 00:06:20,550 --> 00:06:24,590 ‫go to this page and pull this role. 91 00:06:24,600 --> 00:06:25,740 ‫It's it's there. 92 00:06:25,740 --> 00:06:32,700 ‫It's 100 percent there or some indexes are, you know, proper probabilistic. 93 00:06:32,700 --> 00:06:40,650 ‫If I tell you, I I, it's it's it's definitely not there, but it may be there. 94 00:06:40,950 --> 00:06:45,210 ‫And that's that's also a useful so-called blue filters that are very useful stuff. 95 00:06:45,360 --> 00:06:51,570 ‫So, yeah, so once you understand the indexes or data structures that need to be stored, that need 96 00:06:51,570 --> 00:07:01,350 ‫to be maintained because the moment you update your your source tables with the data, you need to keep 97 00:07:01,350 --> 00:07:02,760 ‫that index up to date. 98 00:07:03,030 --> 00:07:03,320 ‫Right? 99 00:07:03,690 --> 00:07:06,660 ‫It's like adding a new echo. 100 00:07:06,870 --> 00:07:07,170 ‫Right? 101 00:07:07,470 --> 00:07:16,260 ‫And you can't any phone number, you need to have the index right there with the letter have that point 102 00:07:16,260 --> 00:07:18,150 ‫to the, you know, the right entry. 103 00:07:18,510 --> 00:07:19,200 ‫It's the same thing. 104 00:07:20,740 --> 00:07:21,760 ‫Welcome to the question. 105 00:07:22,780 --> 00:07:30,460 ‫The question is when you impose Christmas is specifically in politics again, those don't get don't 106 00:07:30,460 --> 00:07:35,140 ‫get caught up with definitions or implementation details. 107 00:07:35,530 --> 00:07:39,160 ‫Just understand how how each database does stuff. 108 00:07:39,190 --> 00:07:43,580 ‫You know, it's just it's this the way they chose to do this, right? 109 00:07:45,100 --> 00:07:48,400 ‫All right. 110 00:07:48,910 --> 00:07:52,630 ‫Choose a specific design and they stuck with it. 111 00:07:52,960 --> 00:07:55,150 ‫It has pros and cons, right? 112 00:07:55,270 --> 00:07:59,620 ‫And I'm not going to tell you the pros and cons because you forgot to figure it out yourself with logic 113 00:08:00,310 --> 00:08:00,670 ‫and. 114 00:08:02,060 --> 00:08:05,030 ‫The index, as I said, the index is. 115 00:08:06,180 --> 00:08:13,530 ‫Need to point back to the table, right, which page and which role they need to read, right? 116 00:08:14,630 --> 00:08:19,820 ‫And when you do that, what do we point to exactly? 117 00:08:20,210 --> 00:08:24,020 ‫We need some sort of identification of the road, right? 118 00:08:24,500 --> 00:08:29,100 ‫This is what is called Tibble ID and Postgres at least every year. 119 00:08:29,120 --> 00:08:31,790 ‫And so that has a unique tuple ID. 120 00:08:32,430 --> 00:08:32,770 ‫Right? 121 00:08:32,990 --> 00:08:37,070 ‫And if you updated and specifically in Postgres, you get a new Tupelo ID. 122 00:08:37,550 --> 00:08:37,940 ‫Right? 123 00:08:38,720 --> 00:08:40,880 ‫But the road is the same logically. 124 00:08:41,150 --> 00:08:46,460 ‫So to you or the reader, it's the same road, but it's a different tuple does doesn't make sense. 125 00:08:47,390 --> 00:08:55,070 ‫So one logical row could have many, many tuple entries, and each tuple has a unique identifier. 126 00:08:55,370 --> 00:08:58,580 ‫That's unique identifier is what the index stores. 127 00:08:58,850 --> 00:09:03,230 ‫And this is what effectively does the reading. 128 00:09:03,260 --> 00:09:03,560 ‫All right. 129 00:09:03,560 --> 00:09:04,340 ‫So where are we? 130 00:09:04,620 --> 00:09:05,420 ‫We talked about. 131 00:09:07,650 --> 00:09:20,340 ‫Having index data structures that are kind of separated from this large pool of raw data where the table 132 00:09:20,340 --> 00:09:27,000 ‫exist, where the documents exist, and these are multiple indexes, you know, because you can create 133 00:09:27,000 --> 00:09:35,820 ‫an index on Field A that will create a unique index data structure that will have X amount of bytes 134 00:09:36,330 --> 00:09:41,060 ‫that would be stored in this that will need to be fetched and need to be put in memory that will need 135 00:09:41,160 --> 00:09:42,350 ‫to be queried. 136 00:09:42,360 --> 00:09:42,740 ‫Read. 137 00:09:43,830 --> 00:09:48,330 ‫And you can have many, many, many of these indexes, right based on your table. 138 00:09:49,320 --> 00:09:49,530 ‫Right. 139 00:09:49,650 --> 00:09:54,300 ‫So let's say you have three indexes each for each column. 140 00:09:54,540 --> 00:09:56,940 ‫Column A. Have an index. 141 00:09:56,940 --> 00:09:57,990 ‫Column B have an index. 142 00:09:57,990 --> 00:10:03,420 ‫Column C has an index which points back to the table. 143 00:10:04,410 --> 00:10:08,280 ‫Now this is a design choice that the post Christine made. 144 00:10:10,970 --> 00:10:19,250 ‫When you search an index, right, you found the value that you're looking for, the value is within 145 00:10:19,250 --> 00:10:21,410 ‫us right now. 146 00:10:23,760 --> 00:10:28,710 ‫What does the value contain in the index, right? 147 00:10:28,800 --> 00:10:34,230 ‫Because you're searching the keys of the index, the value because it's a key value almost right concept, 148 00:10:34,710 --> 00:10:34,990 ‫right? 149 00:10:35,250 --> 00:10:40,050 ‫The value of the element is basically the tuple idea that we talked about. 150 00:10:40,260 --> 00:10:40,550 ‫Right. 151 00:10:42,240 --> 00:10:53,040 ‫Means that the tuple I.D., the ephemeral thing that keeps changing is stored on all the indexes. 152 00:10:56,930 --> 00:11:02,590 ‫So now think about it, if I update my role, right? 153 00:11:03,440 --> 00:11:14,330 ‫It's a unique role and I made an update to a single field there and new to pull it will be created based 154 00:11:14,330 --> 00:11:15,410 ‫on Bosca's design. 155 00:11:15,650 --> 00:11:17,060 ‫Again, this is only Bosworth. 156 00:11:17,540 --> 00:11:20,030 ‫Some other databases do a completely different design. 157 00:11:20,220 --> 00:11:22,160 ‫So and this is what I wanted to keep. 158 00:11:22,160 --> 00:11:28,100 ‫An open mind is like, Oh, this is not the way or the right way or the wrong way. 159 00:11:28,130 --> 00:11:29,510 ‫This is just how it's done. 160 00:11:30,170 --> 00:11:36,050 ‫You can come up with something to challenge any of the stuff that is being done today and completely 161 00:11:36,050 --> 00:11:38,510 ‫revolutionize database engineering, right? 162 00:11:39,410 --> 00:11:40,790 ‫And not on a fluffy way. 163 00:11:40,850 --> 00:11:42,080 ‫Like we do it today. 164 00:11:42,080 --> 00:11:49,400 ‫Unfortunately, I don't think the fluff these days, nothing is actually legit that is being discussed. 165 00:11:50,330 --> 00:11:59,750 ‫So now when I update my roll, call them a rhyme, what do we need to do right? 166 00:12:00,080 --> 00:12:00,770 ‫First of all. 167 00:12:02,440 --> 00:12:08,280 ‫We changed that content of column, and we didn't touch B or C, right? 168 00:12:09,990 --> 00:12:12,110 ‫What happens in post poses create. 169 00:12:12,430 --> 00:12:18,740 ‫Exact copy of that tuple raid as a new tuple. 170 00:12:18,790 --> 00:12:27,210 ‫You have a new tuple ID, a brand new RAM, but it's effectively logically to you as a user. 171 00:12:27,690 --> 00:12:31,110 ‫It's the same row you just updated it, right? 172 00:12:32,370 --> 00:12:34,140 ‫So now there is a new tuple idea. 173 00:12:34,440 --> 00:12:39,150 ‫We updated Field A, which has an index DNC we don't touch. 174 00:12:40,170 --> 00:12:41,250 ‫But here's the problem. 175 00:12:42,570 --> 00:12:48,630 ‫If you actually look in the Index B and the index, see. 176 00:12:50,380 --> 00:12:57,670 ‫Right, and the index, all of them have entries which point to the old tuple. 177 00:12:58,880 --> 00:12:59,180 ‫Right. 178 00:12:59,610 --> 00:13:04,250 ‫Because each table again, each double has a unique identifier. 179 00:13:04,850 --> 00:13:07,760 ‫So all of these guys are pointing to the old one. 180 00:13:10,090 --> 00:13:10,450 ‫Right. 181 00:13:11,020 --> 00:13:15,370 ‫So regardless of this old indexes. 182 00:13:17,000 --> 00:13:21,110 ‫Need to know about this new to idea. 183 00:13:21,980 --> 00:13:28,770 ‫I feel like I talked about this, and I apologize if I did, but I guess it doesn't hurt and I repeat 184 00:13:28,790 --> 00:13:29,880 ‫it right. 185 00:13:29,900 --> 00:13:36,980 ‫So all these indexes need the knowledge of the news to pull it right, because if someone start searching, 186 00:13:38,360 --> 00:13:46,430 ‫let's say, Index C, which we didn't touch for a value that points to that role, they will find the 187 00:13:46,700 --> 00:13:52,820 ‫old to pull I.D. and they will get at the old value. 188 00:13:52,830 --> 00:13:54,800 ‫Yeah, see, it wasn't touched. 189 00:13:54,800 --> 00:14:02,840 ‫But what if they said they'd select a from their bill where sequel law the law was pointed to the old 190 00:14:03,140 --> 00:14:03,940 ‫double idea? 191 00:14:04,370 --> 00:14:07,430 ‫So now they will get the old value of it, not the one we updated. 192 00:14:07,730 --> 00:14:19,400 ‫So regardless, we need to update those indexes right to have the new tuple idea and. 193 00:14:21,900 --> 00:14:29,700 ‫And that's technically a problem in ample space, and that's why Ober complained one of the reasons 194 00:14:29,700 --> 00:14:37,370 ‫Obama complained about Bush scares about this because now, hey, I updated the column a. 195 00:14:37,620 --> 00:14:40,620 ‫Why are you touching indexes B and C? 196 00:14:40,860 --> 00:14:50,170 ‫So if you have a lot of indexes right, then what are you going to do is you will end up touching and 197 00:14:50,190 --> 00:14:51,000 ‫I say touching. 198 00:14:51,000 --> 00:14:58,640 ‫You're actually physically updating, doing I overdoing the rights to these data structures. 199 00:14:58,650 --> 00:15:00,080 ‫That's why I make you. 200 00:15:00,210 --> 00:15:03,480 ‫I want you just think these are things that are not in the air. 201 00:15:03,480 --> 00:15:07,890 ‫These needs to be maintained and the maintenance of this is costly. 202 00:15:08,350 --> 00:15:08,580 ‫Right. 203 00:15:08,580 --> 00:15:15,350 ‫So you have a lot of all of this indexes then becomes a problem, but post-crisis. 204 00:15:15,360 --> 00:15:16,940 ‫I believe that's another cautions. 205 00:15:16,950 --> 00:15:20,790 ‫I called into something called the heart optimization 206 00:15:23,250 --> 00:15:32,100 ‫equity heap only to and said, All right, we really didn't touch B or C. 207 00:15:32,550 --> 00:15:37,080 ‫We only touched a so does have an index if it doesn't have an index. 208 00:15:38,290 --> 00:15:40,920 ‫We have to update index, Hey, guys. 209 00:15:41,260 --> 00:15:47,260 ‫You change the representation of the row for Column A. There is an index on air. 210 00:15:47,500 --> 00:15:56,650 ‫We need to load the index a have the new value of that right because then the B three has to be reshuffled. 211 00:15:56,650 --> 00:15:58,090 ‫The B three have to be updated. 212 00:15:58,090 --> 00:15:59,800 ‫The keys have to be put into place. 213 00:16:00,220 --> 00:16:02,620 ‫We need to do all of this stuff regardless. 214 00:16:02,770 --> 00:16:07,510 ‫This is an update to that, a feel which has an index. 215 00:16:07,510 --> 00:16:09,430 ‫So you have to update it, feel it. 216 00:16:09,550 --> 00:16:17,770 ‫But the performance optimization that the post-arrest team did is like what B and C shouldn't really 217 00:16:17,830 --> 00:16:24,740 ‫need to be touched technically because they were they weren't touched, right? 218 00:16:24,760 --> 00:16:25,840 ‫Why are you updating them? 219 00:16:26,080 --> 00:16:28,860 ‫And that's what's called the heart optimization, which is right here. 220 00:16:28,900 --> 00:16:30,790 ‫I'm up against it on my face. 221 00:16:31,510 --> 00:16:32,070 ‫It's right here. 222 00:16:32,080 --> 00:16:45,010 ‫Hot optimization heap on the table, which effectively keeps the old tuple I.D. in the index right, 223 00:16:45,370 --> 00:16:50,740 ‫but updates the heap table, which we are already doing because we updated the roll right. 224 00:16:51,820 --> 00:17:00,100 ‫So then we do a pointer in the heap that the old tuple ID actually points to the new tuple I.D. in the 225 00:17:00,100 --> 00:17:05,950 ‫hip itself, so that if someone came to the old Apple ID, we let them know her. 226 00:17:06,010 --> 00:17:11,710 ‫Hey, by the way, if you want the latest representation of this double, it's has been updated, is 227 00:17:11,710 --> 00:17:12,190 ‫not it? 228 00:17:12,400 --> 00:17:20,240 ‫There is a new one here and this is done in the same page again, or to this larger, very important 229 00:17:20,240 --> 00:17:25,150 ‫to watch this lecture to know what the difference between a page and a hole and all that jazz, right? 230 00:17:25,360 --> 00:17:31,630 ‫So the page have many rows and and each row has many tables and this case of PostgreSQL. 231 00:17:32,080 --> 00:17:36,460 ‫So now you will have these multiple representation. 232 00:17:36,460 --> 00:17:37,000 ‫So it is. 233 00:17:37,270 --> 00:17:45,250 ‫They inserted some metadata in the page that says, Oh, tuple ID ID law is actually there is a new 234 00:17:45,250 --> 00:17:45,770 ‫version of it. 235 00:17:45,790 --> 00:17:48,220 ‫Go and jump to that some metadata. 236 00:17:49,730 --> 00:18:00,350 ‫Keep in mind only if the new updated top all happened to be in the same age. 237 00:18:01,650 --> 00:18:02,850 ‫As the old couple. 238 00:18:04,960 --> 00:18:10,480 ‫So does that mean because it has a fixed size, it's eight Keane, Paul Scholes at 16 in my squad. 239 00:18:10,780 --> 00:18:16,480 ‫So the moment the moment you update a row in both squares, we create a new tuple idea. 240 00:18:16,780 --> 00:18:22,030 ‫If there is a space left in that age, we're going to insert the new Triple ID in the page itself, 241 00:18:22,780 --> 00:18:25,360 ‫which is, as the bureau does, the best thing you can do. 242 00:18:25,720 --> 00:18:32,040 ‫Because now if I fit the page all the top of the it is in the speech, the moment you start jumping 243 00:18:32,050 --> 00:18:35,200 ‫to another page, that's where you need more oil. 244 00:18:35,710 --> 00:18:43,560 ‫Again, it really depends above the disc size and and and the block sizes of the operating system file 245 00:18:43,570 --> 00:18:44,080 ‫systems. 246 00:18:44,260 --> 00:18:49,210 ‫It's a little bit more complicated than that, but just think of its kind of logically right. 247 00:18:50,080 --> 00:18:54,400 ‫If things isn't the same page, then it's more efficient collectively. 248 00:18:55,600 --> 00:19:00,640 ‫So a lot of divas couldn't figure out something called the fitting factor. 249 00:19:03,140 --> 00:19:08,960 ‫How do you type this, Phil factor Google that do you want to know more about it? 250 00:19:10,980 --> 00:19:17,840 ‫And Phil Spector is is a page configuration that says, OK, so this page until 80 percent full, this 251 00:19:17,840 --> 00:19:20,090 ‫variant is 50 percent, right? 252 00:19:20,090 --> 00:19:25,030 ‫When you start, when you create a new page, only fill it and 50 percent leave. 253 00:19:26,000 --> 00:19:33,440 ‫What I understand is leave space for updates and DVDs so that we can use it for later, but instead 254 00:19:33,890 --> 00:19:40,520 ‫fill it up until X amount of percentage 80 percent, 70 percent, whatever you configure and then leave 255 00:19:40,520 --> 00:19:41,000 ‫it empty. 256 00:19:41,840 --> 00:19:51,020 ‫And then when you do that, what will happen is that page will leave some empty space in it for future 257 00:19:51,260 --> 00:19:54,290 ‫updates so that tables that have been updated. 258 00:19:55,610 --> 00:19:57,830 ‫Gets placed in the same page. 259 00:19:58,120 --> 00:19:58,330 ‫Right? 260 00:19:58,370 --> 00:20:03,620 ‫They will be reused, and that's that's basically the power of two factors very critical. 261 00:20:04,070 --> 00:20:05,810 ‫Very, very critical configuration. 262 00:20:05,810 --> 00:20:09,270 ‫When you become a DBA, that's just one of the things you have to know, right? 263 00:20:09,860 --> 00:20:14,870 ‫It's like there's configuring this based on the work load is completely something. 264 00:20:15,550 --> 00:20:17,030 ‫Yeah, yeah. 265 00:20:17,210 --> 00:20:22,310 ‫You gets paid to hand over fist for understanding these low level things. 266 00:20:22,610 --> 00:20:22,910 ‫Right? 267 00:20:23,690 --> 00:20:27,830 ‫Configuring things really can break or make your architecture. 268 00:20:28,940 --> 00:20:29,240 ‫All right. 269 00:20:29,240 --> 00:20:30,410 ‫So that's that's basically it. 270 00:20:31,150 --> 00:20:35,480 ‫So he points to only works of the tuple is in the same page. 271 00:20:35,480 --> 00:20:37,520 ‫If it's not in the same page, all bets are off. 272 00:20:37,850 --> 00:20:40,700 ‫We'll get up to the indexes regardless of what we're updating. 273 00:20:40,700 --> 00:20:47,200 ‫So that's basically why we're updating this indexes. 274 00:20:47,510 --> 00:20:47,990 ‫What's going on? 275 00:20:47,990 --> 00:20:54,110 ‫I guess this also answers this question, which is kind of similar. 276 00:20:55,760 --> 00:21:03,470 ‫Someone had a similar question here, which is like, I got a I have some confusion regarding the heart 277 00:21:03,470 --> 00:21:06,290 ‫approach for that identification problem. 278 00:21:06,770 --> 00:21:10,700 ‫And I basically I just answered basically this kind of question as well. 279 00:21:11,690 --> 00:21:18,080 ‫And so I guess I didn't talk about write amplification, you know, write amplification is the idea 280 00:21:18,080 --> 00:21:19,460 ‫of what we talked about. 281 00:21:19,850 --> 00:21:23,600 ‫You do a single object as a user. 282 00:21:24,910 --> 00:21:29,140 ‫This is there is a lecture called The Right Amplification, and this course by the other guys took it 283 00:21:29,140 --> 00:21:31,720 ‫up, so I didn't object. 284 00:21:32,260 --> 00:21:33,790 ‫I touched Field A in the. 285 00:21:34,450 --> 00:21:36,660 ‫That's all I did as a user select. 286 00:21:36,820 --> 00:21:41,790 ‫I did an update statement and I just pushed this thing set. 287 00:21:42,100 --> 00:21:47,110 ‫I just updated that single walk into anything that only that column. 288 00:21:47,110 --> 00:21:47,680 ‫I touched it. 289 00:21:49,020 --> 00:21:58,530 ‫But the the right that you think you did have an amplification side effects, because that's not really 290 00:21:58,530 --> 00:22:08,670 ‫the only thing that you have done technically there, you have indexes and plays, you have pages that 291 00:22:08,670 --> 00:22:10,830 ‫need to be sorted and shuffle. 292 00:22:10,830 --> 00:22:17,940 ‫If you have a clustered index, that's another story that might be that clustering that needs to be 293 00:22:17,940 --> 00:22:18,660 ‫done. 294 00:22:19,140 --> 00:22:28,320 ‫So we can all be indexes that needs to be updated regardless of this process, that those indexes might 295 00:22:28,320 --> 00:22:36,900 ‫have a three rebalancing, which will need more rights as a result, which results in an amplification 296 00:22:36,900 --> 00:22:37,410 ‫of right. 297 00:22:37,410 --> 00:22:39,030 ‫So you're doing a single thing. 298 00:22:39,060 --> 00:22:44,850 ‫But if you're looking at your own desk, you see a lot of a lot of rights, right? 299 00:22:45,660 --> 00:22:46,360 ‫Albers. 300 00:22:46,480 --> 00:22:53,980 ‫So this specifically when they were doing replication, which I have a whole section on, they had a 301 00:22:53,980 --> 00:22:54,900 ‫data replication. 302 00:22:54,900 --> 00:22:59,010 ‫They said, Wait a second, why is the network bandwidth overflowing? 303 00:22:59,550 --> 00:23:01,590 ‫We didn't do anything is just a single update. 304 00:23:01,860 --> 00:23:04,020 ‫They've seen a flood of rights. 305 00:23:04,530 --> 00:23:05,010 ‫Right? 306 00:23:05,190 --> 00:23:11,820 ‫So that's when they say, OK, well, we did the other day, but we have 20 indexes that have been updated, 307 00:23:11,820 --> 00:23:12,060 ‫right? 308 00:23:12,600 --> 00:23:22,770 ‫And Bosca's over where it was, was on an old version of Pulseless that didn't support keep people and 309 00:23:22,770 --> 00:23:26,130 ‫little pools, which is hot, which they saw this amplification. 310 00:23:26,130 --> 00:23:36,090 ‫As a result, bogus steam try to simplify the heap only eatable problem that that amplification by doing 311 00:23:36,090 --> 00:23:41,250 ‫the heart optimization they did that many other optimizations as well. 312 00:23:42,270 --> 00:23:42,810 ‫All right, guys. 313 00:23:42,840 --> 00:23:43,950 ‫That's it for me today. 314 00:23:43,980 --> 00:23:45,510 ‫I'm going to send the next one. 315 00:23:46,140 --> 00:23:47,460 ‫Hope you enjoyed this lecture? 316 00:23:48,180 --> 00:23:48,930 ‫Talk to you later. 317 00:23:49,380 --> 00:23:49,770 ‫Goodbye.