1 00:00:00,150 --> 00:00:01,470 ‫Hey, guys, what's going on? 2 00:00:01,800 --> 00:00:08,640 ‫So we have talked about acid, the four properties in a theoretical manner, but it's time to put them 3 00:00:08,640 --> 00:00:14,730 ‫in practice and explain those four properties in an actual database setting. 4 00:00:14,880 --> 00:00:20,520 ‫So I'm going to pick this, but you can do the same exercise with any database you want for some. 5 00:00:20,790 --> 00:00:27,360 ‫I would luck to use Docker because this way I can try out many, many databases with just one command 6 00:00:27,360 --> 00:00:30,060 ‫and I have spit up another database just like that. 7 00:00:30,060 --> 00:00:30,660 ‫So let's go ahead. 8 00:00:30,660 --> 00:00:32,730 ‫And it's been a database right here. 9 00:00:33,520 --> 00:00:37,260 ‫I've got to keep this up because I'm going to need that to a terminals, but I'm going to open up a 10 00:00:37,260 --> 00:00:38,640 ‫new one right here. 11 00:00:39,000 --> 00:00:45,360 ‫And let's do a little bit about Puskás Container going to Docker Run. 12 00:00:45,870 --> 00:00:48,780 ‫Let's call it doctorand. 13 00:00:50,110 --> 00:00:53,700 ‫Let's give it a name, dash, dash name is going to call it acid. 14 00:00:54,340 --> 00:01:01,510 ‫It's got acid and we get to do we don't really need to expose the port or anything because we're going 15 00:01:01,510 --> 00:01:05,890 ‫to really go into the container itself, bash into the container. 16 00:01:06,520 --> 00:01:13,610 ‫The next command is let's go ahead and detach that and then let's pull up Puskás 13. 17 00:01:14,020 --> 00:01:19,000 ‫I think that's the latest thing before we run that actually we forgot something very important, which 18 00:01:19,000 --> 00:01:24,760 ‫is that she was Griss password equal postscripts. 19 00:01:24,940 --> 00:01:30,550 ‫You have to give it pulseless user password as go go ahead and run that just like that is going to take 20 00:01:30,550 --> 00:01:35,050 ‫a little bit while in your end to load the image. 21 00:01:35,050 --> 00:01:37,520 ‫But once you have it, you're ready to rock and roll. 22 00:01:37,540 --> 00:01:37,960 ‫Let's go ahead. 23 00:01:37,960 --> 00:01:43,010 ‫And so so let's make sure that the container is running just like that. 24 00:01:43,030 --> 00:01:43,710 ‫Yes. 25 00:01:43,720 --> 00:01:45,490 ‫Here is my PJI acid. 26 00:01:45,490 --> 00:01:46,450 ‫It's running. 27 00:01:47,140 --> 00:01:52,950 ‫They always make sure that it's running because you might have spilled something in the command or did 28 00:01:52,990 --> 00:01:55,020 ‫something bizarre or something is wrong. 29 00:01:55,030 --> 00:01:55,250 ‫Right. 30 00:01:56,080 --> 00:02:02,500 ‫So go ahead and do it and get it into the acid. 31 00:02:02,830 --> 00:02:03,910 ‫And what can I do? 32 00:02:03,920 --> 00:02:08,590 ‫We will execute a physical because of the PostgreSQL command. 33 00:02:08,950 --> 00:02:17,580 ‫And I want to log in as Deshu that Posterous user that just like that, we are in the process commensal 34 00:02:17,890 --> 00:02:18,100 ‫now. 35 00:02:18,100 --> 00:02:20,020 ‫We can execute beautiful stuff. 36 00:02:20,020 --> 00:02:23,320 ‫We can create a database, we can play that create tables. 37 00:02:23,560 --> 00:02:29,110 ‫So since I am in the Postgres database, I have a database called Polska, so I'm going to play up with 38 00:02:29,110 --> 00:02:30,140 ‫that database right there. 39 00:02:30,150 --> 00:02:30,390 ‫Right. 40 00:02:30,670 --> 00:02:39,490 ‫I was going to do create a table called Products to Test at Tomasetti and I'll go ahead and create table 41 00:02:39,490 --> 00:02:40,780 ‫products. 42 00:02:41,120 --> 00:02:43,390 ‫Let's do a PID serial. 43 00:02:43,390 --> 00:02:46,870 ‫So that's a little increment in my school, I think it's called. 44 00:02:47,470 --> 00:02:48,810 ‫And sure. 45 00:02:48,910 --> 00:02:51,220 ‫Let's make this the primary key. 46 00:02:52,440 --> 00:03:00,100 ‫And I think we can just continue doing that stuff right and then the online name as a text boom. 47 00:03:00,540 --> 00:03:08,280 ‫What else price is double our shorts, double our Flodden because I keep forgetting in different databases. 48 00:03:08,700 --> 00:03:11,020 ‫When you work on many databases, you get confused. 49 00:03:11,430 --> 00:03:13,740 ‫And the finally is inventory. 50 00:03:14,010 --> 00:03:17,310 ‫How much inventory do we have in this product? 51 00:03:17,310 --> 00:03:19,440 ‫And let's just use an integer here. 52 00:03:21,010 --> 00:03:22,420 ‫And that should be it. 53 00:03:23,050 --> 00:03:24,530 ‫Yeah, that's what I thought. 54 00:03:24,550 --> 00:03:25,650 ‫It's not called double. 55 00:03:26,290 --> 00:03:29,080 ‫It's got to be flawed, I think. 56 00:03:34,220 --> 00:03:38,000 ‫I think it's double in my school or I keep forgetting. 57 00:03:39,870 --> 00:03:46,200 ‫All right, now we have a product sale, let's go ahead and create a sales table so we can produce sales. 58 00:03:46,230 --> 00:03:47,280 ‫Great table sales. 59 00:03:49,260 --> 00:03:52,260 ‫Let's go ahead and do a sale I.D. That's a cereal. 60 00:03:52,260 --> 00:03:58,890 ‫Also primary key and enter the primary key. 61 00:03:59,010 --> 00:04:02,880 ‫That's the product ID I can create as a foreign key, but doesn't have to. 62 00:04:02,910 --> 00:04:05,210 ‫So that's an integer, right? 63 00:04:05,400 --> 00:04:07,590 ‫That's a product I.D. to draw. 64 00:04:08,860 --> 00:04:10,480 ‫Boom, price float. 65 00:04:10,490 --> 00:04:19,150 ‫We learned our lesson, so that's an entry in the sales, could be a product, could be sold in a different 66 00:04:19,150 --> 00:04:19,630 ‫price. 67 00:04:19,630 --> 00:04:19,880 ‫Right. 68 00:04:19,990 --> 00:04:23,700 ‫But the current price of the product is in the product table. 69 00:04:24,070 --> 00:04:25,510 ‫This is what was sold. 70 00:04:25,510 --> 00:04:32,280 ‫That and then the quantity as also an integer, a boob. 71 00:04:33,130 --> 00:04:33,460 ‫All right. 72 00:04:33,460 --> 00:04:37,950 ‫Now we have two beautiful tables let's test out at Tomasetti. 73 00:04:38,500 --> 00:04:42,040 ‫So the first thing, listeners populate some some rows on this table. 74 00:04:43,000 --> 00:04:47,320 ‫So I was going to do insert into products. 75 00:04:48,790 --> 00:04:59,100 ‫And let's give it a name, I don't know what are we insert name and a prize and inventory or simply 76 00:04:59,160 --> 00:05:01,000 ‫say, I'm just going to do it one one. 77 00:05:01,000 --> 00:05:04,950 ‫Royo let's call this a table at tables. 78 00:05:04,960 --> 00:05:09,310 ‫Very confusing phone selling phones. 79 00:05:09,970 --> 00:05:14,940 ‫And the price of the phone is nine nine nine nine nine nine nine. 80 00:05:15,580 --> 00:05:17,950 ‫That's an expensive phone inventory. 81 00:05:17,970 --> 00:05:20,510 ‫Let's say you have hundred units, then boom. 82 00:05:20,950 --> 00:05:21,580 ‫And then. 83 00:05:22,950 --> 00:05:23,400 ‫That's it. 84 00:05:23,670 --> 00:05:25,140 ‫That's the only product we have. 85 00:05:25,520 --> 00:05:29,520 ‫OK, so now let's test out our Atomos City. 86 00:05:29,760 --> 00:05:36,690 ‫So I mean, if we did select store for our products, you can see that we have this row. 87 00:05:37,500 --> 00:05:39,700 ‫But we're going to do is we're going to make a sale. 88 00:05:39,750 --> 00:05:42,300 ‫We're going to sell, let's say, 10 phones. 89 00:05:43,310 --> 00:05:44,690 ‫Like we sold 10 phones. 90 00:05:44,870 --> 00:05:46,040 ‫What does that mean? 91 00:05:47,770 --> 00:05:56,250 ‫The fear of walking with Demand-Driven designed that is one has scribed, but it's in the database, 92 00:05:56,260 --> 00:06:05,800 ‫it's broken into multiple queries in a single transaction, and so a sale is often units. 93 00:06:05,800 --> 00:06:12,820 ‫That means you have to deduct 10 units from the inventory and then you have to insert a row in the sales 94 00:06:12,820 --> 00:06:17,170 ‫table saying that you have inserted that you cannot do that. 95 00:06:17,170 --> 00:06:21,250 ‫And two transaction, you have to do it in an atomic transaction. 96 00:06:21,280 --> 00:06:23,290 ‫That's why we explained in the video the lecture. 97 00:06:25,120 --> 00:06:26,740 ‫So we've got to begin a transaction. 98 00:06:28,480 --> 00:06:34,200 ‫And then we're going to the first transaction we're going to do is update products, right? 99 00:06:34,570 --> 00:06:35,680 ‫What was the phone idea? 100 00:06:35,970 --> 00:06:40,000 ‫Let's just do from products you might want to query or process. 101 00:06:40,000 --> 00:06:42,560 ‫Idea number one, processed product line number one. 102 00:06:43,000 --> 00:06:45,910 ‫So we're going to do is update products. 103 00:06:47,920 --> 00:06:49,840 ‫Set name. 104 00:06:52,000 --> 00:06:59,890 ‫A bread product, set, inventory, inventory, equal inventory, minus 10. 105 00:07:01,710 --> 00:07:03,500 ‫Well, that's in this transaction. 106 00:07:03,840 --> 00:07:08,890 ‫So now if I query that product again, you can see it's 90, right? 107 00:07:09,660 --> 00:07:10,930 ‫Very, very critical here. 108 00:07:11,430 --> 00:07:13,620 ‫So now if I go ahead and insert. 109 00:07:16,270 --> 00:07:17,230 ‫Let's assume. 110 00:07:19,010 --> 00:07:20,590 ‫I crashed right here. 111 00:07:22,030 --> 00:07:23,740 ‫If I crashed right here. 112 00:07:25,140 --> 00:07:35,730 ‫What will happen, you just lost 10 units from your phones that you did a really sold OK, and that's 113 00:07:35,730 --> 00:07:39,420 ‫the idea of atomistic because you have to follow it up. 114 00:07:39,660 --> 00:07:39,880 ‫Right. 115 00:07:40,620 --> 00:07:42,450 ‫So, like, let's say I crashed right here. 116 00:07:42,690 --> 00:07:48,870 ‫I don't know, just this killed the whole container just like that. 117 00:07:49,770 --> 00:07:56,160 ‫If you do that without automaticity, it will be a disaster if you come back to the database. 118 00:07:56,700 --> 00:08:01,560 ‫And then you said select star from product and you saw that it's a 90, but no. 119 00:08:03,000 --> 00:08:05,370 ‫It says hundred y. 120 00:08:06,360 --> 00:08:13,050 ‫Because of animosity, we started a transaction, we did an update, but we crashed, we exited fossickers 121 00:08:13,050 --> 00:08:15,280 ‫in this case simulating a crash, right. 122 00:08:16,860 --> 00:08:24,990 ‫That is the idea of at the most of all, the transaction have to be done in as an attempt to split those 123 00:08:25,200 --> 00:08:28,170 ‫and those do the transaction again in the right way. 124 00:08:28,980 --> 00:08:31,470 ‫Again, transaction doing an update. 125 00:08:32,580 --> 00:08:39,480 ‫To them, victory, and then now I'm going to insert a sale and certain the sales process ideia. 126 00:08:42,000 --> 00:08:49,920 ‫Price and quantity, and let's just do values. 127 00:08:51,630 --> 00:08:57,840 ‫Number one, I sold it and I thought I sold it at nine nine nine nine nine Sam Price, they sold 10 128 00:08:57,840 --> 00:08:58,520 ‫units room. 129 00:08:59,620 --> 00:09:04,960 ‫And you can break it out into five minutes at this price and five minutes at this price will not. 130 00:09:06,360 --> 00:09:14,940 ‫And as we did of that, now, clearly the sale of Sable's you can see that we have 10 beautiful units 131 00:09:14,940 --> 00:09:20,310 ‫right here and my products are 90. 132 00:09:21,560 --> 00:09:24,320 ‫So now if you some of those puppies up. 133 00:09:25,310 --> 00:09:28,700 ‫You get a hundred, and that's called consistency's. 134 00:09:28,780 --> 00:09:33,530 ‫We just explained atomos and consistency and the same concept. 135 00:09:34,430 --> 00:09:39,950 ‫And this is only viewable in my transaction. 136 00:09:40,310 --> 00:09:47,600 ‫So now if I went to a completely different terminal and tried to query again, I'm not I'm not committing 137 00:09:47,600 --> 00:09:47,810 ‫yet. 138 00:09:47,810 --> 00:09:48,110 ‫Right. 139 00:09:50,570 --> 00:09:52,560 ‫And I do like to do the same thing. 140 00:09:52,580 --> 00:10:01,640 ‫Hopefully we got a school there, a big acid, then if I do select star from products, you can say 141 00:10:01,640 --> 00:10:05,570 ‫they're still 100 and if you call it the sales, stable. 142 00:10:07,670 --> 00:10:16,490 ‫There is nothing and that's part of isolation, because now we're we're in an atomic manner, so these 143 00:10:16,700 --> 00:10:24,430 ‫two things were inserted in that transaction, but we didn't roll back or commit the moment I commit. 144 00:10:25,340 --> 00:10:36,170 ‫Now, we have a nice view and out of the data and the data is now flushed and available, visible to 145 00:10:36,170 --> 00:10:36,800 ‫all transaction. 146 00:10:36,810 --> 00:10:42,090 ‫Now, if I created it again, you can see that we have a sales now zero. 147 00:10:42,090 --> 00:10:42,830 ‫So that is one. 148 00:10:43,070 --> 00:10:45,620 ‫And if you query the product table, you can see that's 90. 149 00:10:46,370 --> 00:10:54,230 ‫So what I was to talk about here, talking about Midcity City, we talked about consistency because 150 00:10:54,740 --> 00:10:57,410 ‫if you don't have to Midcity, you don't have consistency. 151 00:10:57,830 --> 00:11:04,220 ‫And you can argue with that, obviously, guys, because you can say, hey, I can I can be smart and 152 00:11:04,220 --> 00:11:06,020 ‫make a single query. 153 00:11:06,020 --> 00:11:06,270 ‫Right. 154 00:11:06,290 --> 00:11:11,360 ‫And I didn't for the longest time, Mongo DB, for example, didn't have Atomic City across documents. 155 00:11:11,360 --> 00:11:13,780 ‫It has only atomos of the across a single document. 156 00:11:14,060 --> 00:11:20,690 ‫And people are fine with that because most of the time they will do their data model so that it is a 157 00:11:20,690 --> 00:11:27,170 ‫single document and instead of not, say, normalized like we do here. 158 00:11:28,940 --> 00:11:32,420 ‫All right, let's jump into isolation. 159 00:11:32,570 --> 00:11:37,880 ‫All right, guys, so I went ahead and inserted a few rows in the table that you don't have to see the 160 00:11:37,880 --> 00:11:38,280 ‫process. 161 00:11:38,300 --> 00:11:39,230 ‫I'm going to cut it out. 162 00:11:39,590 --> 00:11:41,190 ‫It's a straightforward thing. 163 00:11:41,210 --> 00:11:43,970 ‫We sold a couple of units it here, a couple of units right here. 164 00:11:44,000 --> 00:11:52,100 ‫So now let's test out isolation and to decide isolation. 165 00:11:52,110 --> 00:11:54,110 ‫Guys, I want to do the following. 166 00:11:54,120 --> 00:11:54,320 ‫Right. 167 00:11:54,560 --> 00:12:02,330 ‫So to this isolation, guys, I want to do the following just with normal transactions. 168 00:12:02,720 --> 00:12:06,710 ‫I'm going to start a transaction in my first session right here. 169 00:12:07,070 --> 00:12:12,170 ‫And I'm going to do a normal query saying select product and the count of the product. 170 00:12:13,430 --> 00:12:13,930 ‫All right. 171 00:12:14,240 --> 00:12:22,130 ‫I just want to see how how much sales did I made on getting our for each product from sales and group 172 00:12:22,130 --> 00:12:23,880 ‫by group. 173 00:12:24,320 --> 00:12:31,510 ‫If I do that all of a sudden now and this query, I have three sales for like two and three sales for 174 00:12:31,520 --> 00:12:34,250 ‫product one, which is pretty good right now. 175 00:12:34,250 --> 00:12:42,620 ‫I want to actually print the report that that shows that what are this list? 176 00:12:42,740 --> 00:12:43,700 ‫Just the whole thing. 177 00:12:43,730 --> 00:12:47,900 ‫So in order to do that, you do select product. 178 00:12:49,300 --> 00:12:52,330 ‫Price, maybe you do a join, but we don't. 179 00:12:52,600 --> 00:12:57,160 ‫We're not going to do that quantity from sales. 180 00:12:58,390 --> 00:12:58,730 ‫Right. 181 00:12:59,140 --> 00:13:05,590 ‫But before you going to execute that, you're going to execute at another session started right here. 182 00:13:06,810 --> 00:13:11,610 ‫OK, and inserted a new sail, OK, you just inserted a new sail. 183 00:13:12,960 --> 00:13:20,100 ‫Right, and you are just doing your own thing right here and generating this large report, but if you 184 00:13:20,100 --> 00:13:27,090 ‫reach this stage and meanwhile think so, think of these two US as concurrent application transaction 185 00:13:27,270 --> 00:13:28,500 ‫going at the same time. 186 00:13:28,740 --> 00:13:31,210 ‫Someone is making a sale, someone is generating a report. 187 00:13:31,500 --> 00:13:34,200 ‫So in the same time, I'm going to generate a new cell. 188 00:13:34,200 --> 00:13:37,700 ‫Hey, we just sold a new phone, ram pedi. 189 00:13:37,990 --> 00:13:43,740 ‫Analysts say price and quantity, home values. 190 00:13:44,160 --> 00:13:45,090 ‫We sold the new iPhone. 191 00:13:47,550 --> 00:13:57,720 ‫And at a price nine nine nine nine nine nine is just said, we sold 10 more phones and we also go ahead 192 00:13:57,720 --> 00:14:01,130 ‫and update the products where sit. 193 00:14:02,130 --> 00:14:14,100 ‫Quantity, quantity, no set inventory, equal inventory milestone where the equation because we just 194 00:14:14,850 --> 00:14:19,620 ‫we just made etc. So we need to decrement and then what we did is we actually committed. 195 00:14:19,860 --> 00:14:20,310 ‫We're done. 196 00:14:20,460 --> 00:14:21,120 ‫We made us all. 197 00:14:22,460 --> 00:14:24,000 ‫And we weren't back here. 198 00:14:24,060 --> 00:14:27,210 ‫We're continuing to generate the report again, this is happening in parallel. 199 00:14:27,480 --> 00:14:29,310 ‫I'm posing it just to show you. 200 00:14:29,700 --> 00:14:33,870 ‫But this is now we made a sale and then you printed the record. 201 00:14:34,410 --> 00:14:35,580 ‫So you printed that. 202 00:14:35,760 --> 00:14:39,270 ‫You made three or three sales, three sales here. 203 00:14:39,600 --> 00:14:44,160 ‫And then you made and then you actually printed that stuff. 204 00:14:44,160 --> 00:14:44,880 ‫And guess what, guys? 205 00:14:45,400 --> 00:14:46,500 ‫This don't match. 206 00:14:47,550 --> 00:14:50,160 ‫You said that you and this happens a lot. 207 00:14:50,160 --> 00:14:50,460 ‫Right. 208 00:14:50,460 --> 00:14:55,440 ‫And actual companies, where were the actual table doesn't match the counts. 209 00:14:55,680 --> 00:14:59,240 ‫And this happens if you do this kind of things. 210 00:14:59,290 --> 00:15:00,360 ‫This I'm going to talk about. 211 00:15:00,360 --> 00:15:01,470 ‫This is called isolation. 212 00:15:02,310 --> 00:15:02,840 ‫Isolation. 213 00:15:02,850 --> 00:15:04,370 ‫We're not fully isolated here. 214 00:15:05,220 --> 00:15:07,740 ‫So when it will happen here, we printed this poppy. 215 00:15:07,740 --> 00:15:08,000 ‫Right. 216 00:15:08,400 --> 00:15:18,780 ‫And we said, OK, we made three phones, actually four phones and two and three ear buds. 217 00:15:18,780 --> 00:15:22,380 ‫So the ear buds are correct, but the phones are not correct. 218 00:15:22,860 --> 00:15:26,490 ‫You just produced an inconsistent. 219 00:15:29,160 --> 00:15:37,230 ‫View, so inconsistency or consistency in general can happen because of animosity, which we explained 220 00:15:37,650 --> 00:15:42,270 ‫and can also happen because of isolation, which is what I'm about to explain here. 221 00:15:42,570 --> 00:15:45,960 ‫So how do I make sure that nobody. 222 00:15:47,370 --> 00:15:54,630 ‫Touches my view when I am beginning my transaction, if I start in this transaction, I want you to 223 00:15:54,630 --> 00:16:02,580 ‫give me a snapshot, right, of all the coins, and I'm going to do as if at the moment of the where 224 00:16:02,580 --> 00:16:03,660 ‫the transaction started. 225 00:16:04,760 --> 00:16:08,600 ‫And that's called a repeatable rate, so it's going to roll back this thing. 226 00:16:09,890 --> 00:16:18,330 ‫And then we would begin a transaction, but we're going to do isolation level, repeatable rate. 227 00:16:18,350 --> 00:16:21,200 ‫I think that's how you say the default was. 228 00:16:22,490 --> 00:16:24,620 ‫Reid committed what that means. 229 00:16:25,790 --> 00:16:32,450 ‫Anything that has been committed on other transaction, I, I can see it and this isolation level, 230 00:16:32,450 --> 00:16:38,280 ‫Merks most of the time, sometimes in this case you don't want it, you don't want a repeat operator 231 00:16:38,290 --> 00:16:39,160 ‫or serializable. 232 00:16:39,410 --> 00:16:41,870 ‫So let's go ahead and start in a repeatable read. 233 00:16:42,260 --> 00:16:48,170 ‫And now if I'm going to make my beautiful query, the count, hey, there are three and four, which 234 00:16:48,170 --> 00:16:49,060 ‫is which is good. 235 00:16:49,070 --> 00:16:55,910 ‫So we made four sales bad like that, but exclude the second query. 236 00:16:57,170 --> 00:17:02,510 ‫Took away the sale, but in the meantime, someone started another transaction, we don't care what 237 00:17:02,600 --> 00:17:05,390 ‫isolation level at that point where they. 238 00:17:06,620 --> 00:17:08,210 ‫They inserted another. 239 00:17:09,650 --> 00:17:10,220 ‫Sayle. 240 00:17:11,300 --> 00:17:12,140 ‫Email, exactly. 241 00:17:13,730 --> 00:17:14,540 ‫And they committed. 242 00:17:17,920 --> 00:17:20,030 ‫So they just made it into the sale. 243 00:17:21,330 --> 00:17:21,960 ‫What? 244 00:17:23,070 --> 00:17:24,270 ‫If you query this. 245 00:17:25,420 --> 00:17:28,250 ‫Notice that it didn't show up on your case here. 246 00:17:29,020 --> 00:17:29,350 ‫Why? 247 00:17:29,350 --> 00:17:36,020 ‫Because you're your isolation level prevents you from seeing stuff that other people's changing. 248 00:17:36,580 --> 00:17:38,500 ‫That's that's a beautiful repeatably. 249 00:17:38,530 --> 00:17:39,430 ‫It's expensive. 250 00:17:40,420 --> 00:17:45,160 ‫You can understand how it works because it works at them like sea level. 251 00:17:45,280 --> 00:17:47,290 ‫And Bosco's does it differently. 252 00:17:47,590 --> 00:17:49,000 ‫Bicyclers and differently. 253 00:17:49,000 --> 00:17:50,560 ‫SQL Server does it differently. 254 00:17:50,560 --> 00:17:54,840 ‫Oracle does it exact very similar to bicycle bicycle. 255 00:17:54,850 --> 00:17:57,820 ‫This is very similar to Oracle, if you want to be very precise. 256 00:17:58,540 --> 00:18:07,210 ‫But that said, now, if you you have a consistent view, you made five sales technically on the iPhone. 257 00:18:07,210 --> 00:18:17,920 ‫But if you query again that group by you only see four, you're in this other other query for other 258 00:18:18,130 --> 00:18:18,730 ‫session. 259 00:18:18,820 --> 00:18:25,220 ‫If you just select the ID count copied from what is that? 260 00:18:25,240 --> 00:18:27,490 ‫So we have five units here. 261 00:18:27,580 --> 00:18:33,220 ‫But here, no matter how many times you execute that, you're going to get a repeatable read your readers 262 00:18:33,220 --> 00:18:33,970 ‫a repeatable. 263 00:18:33,970 --> 00:18:35,080 ‫It's not going to change. 264 00:18:35,080 --> 00:18:39,460 ‫And that's a very attractive feature for a lot of applications. 265 00:18:39,770 --> 00:18:40,010 ‫Right. 266 00:18:40,510 --> 00:18:46,330 ‫So now once you commit or roll back, you're done if you execute equity again. 267 00:18:48,050 --> 00:18:50,240 ‫You see five because you're out of your transaction. 268 00:18:50,690 --> 00:18:55,250 ‫All right, guys, that was isolation, finally for the fun of it. 269 00:18:56,620 --> 00:18:58,700 ‫Let's do this, guys. 270 00:18:58,700 --> 00:19:01,820 ‫Exit right here and then Dr.. 271 00:19:02,830 --> 00:19:07,760 ‫I'm going to do this, I'm going to begin a transaction, and then I'm going to insert a new product 272 00:19:07,780 --> 00:19:14,950 ‫inserted to explain durability and that new product, and I'm going to prepare here to kill the content 273 00:19:14,960 --> 00:19:16,390 ‫of the whole the whole container. 274 00:19:16,650 --> 00:19:17,570 ‫You stop, right? 275 00:19:18,070 --> 00:19:27,130 ‫But in the exact same second, I am going to insert a new sales and see if this is actually going to 276 00:19:27,130 --> 00:19:27,700 ‫happen. 277 00:19:27,700 --> 00:19:31,760 ‫If I say if it says commit, what will happen here. 278 00:19:32,380 --> 00:19:32,920 ‫Name. 279 00:19:34,090 --> 00:19:41,080 ‫Price inventory, yeah, that's just inserts a new product that's called. 280 00:19:42,180 --> 00:19:42,990 ‫TV. 281 00:19:46,040 --> 00:19:53,120 ‫Yeah, three thousand dollars and there is only 10 units of this, and I can do this and I'm going to 282 00:19:53,120 --> 00:19:57,370 ‫commit, but at the same time we're going to kill the container. 283 00:19:59,340 --> 00:20:01,260 ‫So immediately we were killed. 284 00:20:01,940 --> 00:20:02,570 ‫So now. 285 00:20:03,750 --> 00:20:11,420 ‫I want to know, did my TV get recorded that Postgres told us that it's committed, right? 286 00:20:12,690 --> 00:20:19,860 ‫If I do this and a lot of their base doesn't support this, by the way, like this, but it is in the 287 00:20:19,860 --> 00:20:20,400 ‫movie database. 288 00:20:20,400 --> 00:20:22,600 ‫But it does support persistance, right? 289 00:20:25,440 --> 00:20:31,050 ‫Essentially adorability is that means if you tell me that you committed something, that means if I 290 00:20:31,050 --> 00:20:34,970 ‫log in again, I better be there to see if it is out there. 291 00:20:37,600 --> 00:20:44,230 ‫Yup, it's right there because it told me it committed if if it didn't return the comment, that means 292 00:20:44,230 --> 00:20:49,810 ‫it hasn't been written and durability is a very you might say you might think of it as like, OK, of 293 00:20:49,810 --> 00:20:52,960 ‫course, Hosain, it's given that it has to be. 294 00:20:54,620 --> 00:21:01,070 ‫If I write, something has to be there by noon, some is right to memory first for a performance reason 295 00:21:01,130 --> 00:21:07,370 ‫and the container or the host dies, they forget to flash to disk. 296 00:21:07,700 --> 00:21:09,110 ‫You just lost your stuff. 297 00:21:09,960 --> 00:21:12,100 ‫But, guys, what do you think about this, guys? 298 00:21:12,640 --> 00:21:14,110 ‫Thank you so much for watching. 299 00:21:14,870 --> 00:21:15,500 ‫How fun. 300 00:21:15,530 --> 00:21:19,440 ‫Enjoy the rest of the course that I'm going to see on the next one. 301 00:21:20,150 --> 00:21:20,810 ‫Goodbye.