Okay, everyone. Good morning. Good afternoon. I'm sorry. My name is Bruce Momgen. I'm one of the PostgreSQL team members and employee of Enterprise DB for the past 10 years. James Coleman is the host mentioned was not able to speak today, so they have asked me to take his place. Fortunately, he was speaking about comment table expressions, and I also happened to have a comment table expression presentation. So I was the logical person, so if you did, he come to listen to table expressions, I have you covered. If you came to see James Coleman, not so much. This is a very interesting presentation. I think you'll find it challenging, a little unorthodox in some of the approaches, but it builds up very slowly, and at the end, it's very complicated. So if you're caught aboard like 10 minutes in, don't worry, the rockets are going to kick in at some point, and it's going to kind of take off. This presentation along with 30 other presentations are actually at my website right here. So if you'd like to download these slides even right now, those are on the website. There are recordings of me giving these many of these presentations as well. I do have 90 slides. I do have 50 minutes. So this should be interesting. Again, there is a lot of material here, but again, I don't assume you know what comment table expressions are. I don't assume that you've actually worked with them before. We start very basic, and we build up, and we build up. How is my volume? Is it too loud for people? Is it okay? You're good? Okay, it's not too loud, because I know if I talk really loud, it would be too loud. So I'm trying to be kind of quiet. Maybe I'll, you know what I'll do? Let me lower it a little bit. Maybe I don't make it a little more normal. No, it's too loud. Is that too low? Is that good? Okay, good. So I can talk a little louder maybe and more of my normal voice. So again, we don't assume a lot about comment table expressions. These were added a couple years ago into Postgres, and I think you'll find them to be, to answer, to solve some very interesting problems that you encounter as application developers. It's kind of hard to wrap your head around everything that it can be done with comment table expressions. So again, I'm going to be kind of exhaustive and try and go through it step by step in getting more advanced, more advanced until we get to the end. So as we only have 50 minutes and 90 slides, let's get started. This is the outline of what I want to cover. First, I want to talk about some technical terms, which I think will help to clarify what we're doing. Then I'll talk about the comment table expression syntax. Talk about what recursive comment table expressions sound scary it is. Then we'll go for some examples and finally writeable comment table expressions. So again, some definitions. The difference between imperative and declarative, you see that sometimes academia, but not so much in practical case. We think of job, we think of pearl, we think of SQL, we think of prologue and some of the Erlang and some of the sort of fancy languages. We don't typically classify them, but effectively an imperative language is the language similar to C or pearl. Will you tell the computer what you want to do? You're basically subscribing things in terms of statements, the change program state. This is kind of the programming language that most of us are working in on a day-to-day basis, but there is another kind of language called a declarative language. These are normally higher level languages. SQL happens to be one of them where you don't tell the computer what to do, you tell the computer what you want and the computer then figures out how to get you that result the most efficiently. And frankly, this is one of the reasons the SQL remains popular 40 years in or 40 plus years in because in a lot of ways it removes a burden from the application program. The application program can send the query to the server, the server figures out what indexes to use, figures out how to do the joins, whole bunch of stuff. I have a whole bunch of presentations about that. But the idea of a declarative language is that you tell it what you want and then it figures it out. Here's some examples. This is very simple imperative languages, very easy to understand. The declarative language, this is a little kind of weird. How would you do this looping saying hello, hello over and again in SQL? SQL is a declarative language. There's no way to create a construct, a loop or anything like that. But the bottom line is there are some cases where in fact you want to be imperative, even in SQL. Common table expressions in my mind allow you to do that. It allows you to take yourself out of sort of the declarative box and tell the system I want to do this specific thing and I don't want you to interpret it or whatever. I just want you to do that. I'm going to show you a whole bunch of examples where this is actually very valuable, particularly common table expressions allow this to happen. Again there's a lot of options for imperative programming, client applications, JDBC, LibPQ, Perl, server-side programming, you certainly have a lot of declarative imperative languages and common table expressions, which is another sort of imperative tool in your box. That's why common table expressions are so interesting because they kind of come at SQL from a completely different direction than a lot of other features. This is the syntax for common table expressions. Again, it was added in 8.4, so quite a number of years ago. The syntax always starts with the word with, so if you've ever seen a query that starts with and you're like, I don't see select, they're like, what is that? It's a common table expression. It starts with the word with and then usually the word select is after that, although technically you can do some other things I'll talk about later but I'm giving away the form there. Basically the word with and then some query and then perhaps another query and then eventually usually it ends up with select. That's typically the way these things go. Here's the simplest common table expression that I could think of. Again, we're going to start really slow. Here is that keyword with and the first thing I have to do after that keyword is name the common table expression. That's pretty fundamental to common table expressions because effectively the reason common table expressions are imperative is that effectively you're creating kind of a data source on the fly. It's almost as though you're creating a temporary table. Think of it that way. If you look here I say with and I call the contents of that thing source and then inside that common table expression what do I have? Select one. Super boring but it works. Then once I get out of the common table expression notice it's actually with and a name and as and then I've got some prens and those prens basically border that common table expression to start and stop and then I have outside of the common table expression a with and then notice the use of the keyword source. In fact source is the same. I'm referencing that source that common table expression sort of container that I created above. You can see how it's kind of imperative. Also if you don't believe what I'm doing here you want to run these queries yourself you're welcome to do that. The SQL URL at the bottom there right here. This allows you to actually take the if you just download that go to that URL and just download it you can run this in PSQL and you'll see the exact same slides. In fact when I did this presentation I wrote the SQL and then ran it and then I pasted it into my editor and into my word processor and then made the slides. It was easier to create the SQL first and then and then basically create a frame around it. The other obviously thing that you're noticing is that if there's something in red on the slide that's where you want to look obviously right. There's a lot of text on some of these slides and the red kind of is designed to kind of focus your eyes. So here's a here's another version of the common table expression. The difference here is that we're actually giving the column a name. So as you notice here back here I didn't give it a name so it had this really weird like random name that comes up. Here because I gave the column in the common table expression a name the select star actually supplied the column name. Okay so we're getting a little bigger we're now giving name not only name to our common table expression we're actually naming one of the columns. You can name it this way as well here I didn't name the column inside the common table expression I named it outside the common table expression but again call one call one lines up same thing. Okay we can do more well what we do here we name the column call one inside the common table expression we gave a com call call two outside the common table expression and then when we do the select we call it call three and what do you know call three so just keep in mind there's some layering going on if you override an earlier level it just wipes it out. Okay you can return two columns if you want here I'm returning two columns one two I get one two rows back I can do so so let me ask her any questions so far okay great okay so we're we're eight minutes and we're good okay so let's talk a little bit about union I have to tell you about this because it ends up being used a lot with common table expressions union is a way of sort of pasting two queries together so you take one query you union it with another query and and by default if you use the union without the all clause it gets rid of the duplicates so union without an all gets rid of the duplicates I think it's a really weird default but there's some relational algebra reasons for it which I'm not going to go into even if I could but normally when we're going to use union all with common union with common table expressions we're gonna use that all keyword and you can notice it has not gotten rid of any duplicates there okay so here's where we start to get a little more exciting here I'm creating two common table expressions one is called source one is called source two column names one two I'm sorry values one two on the first cable two three four in the second table I do a select in now here now I have a comma here so here's my first common table expression a comma second common table expression okay and then down here I'm selecting from source then I'm doing union all which doesn't remove the duplicates and then I'm saying give me from source two so I've created two data sources and then I'm querying them separately in separate selects which are connected by union all okay and I have one two three four returned okay so again I again it's it's like we're real you know when you take off in a plane and you're like going down the runway and you're like we're not going fast enough to take off I don't know how many you feel that way but like you're going down and you're like we're probably going like 40 miles an hour I don't understand we're gonna take off and magically you do that's what this presentation is gonna do it starts kind of lumbering down the tarmac a little bit but it eventually takes off and it gets crazy by the end so don't worry so let's do some common table expressions with some real tables here's an example I'm using a system table PG language and I'm joining it to PG roles so this is an entire select statement inside the red and I've created a data source which is the joint of those two and effectively when I do the query down here I get the same results as if I had run that now is this useful no right this is completely fabricated but again it illustrates that we can put queries that even do joins inside of these common table expressions here's what gets a little more interesting again we're not taking off yet but the plane's starting to shake a little bit here we we do a common table expression up here we still call it source it does a join but we're actually doing two different things with the result and this is where we're starting to actually use common table expressions in a way that's actually useful and I've done this actually myself I'm not sure how many of you have also done this but the typical problem you're trying to solve here is you have a query and you want to look at the data in two different ways but you want to return them in the same result set okay and the old way doing that would be to run the query twice you'd have one query here then you know just forget that don't do that so here we say with source we run the query we decide to return all the rows and when you you know all and we then add an additional row on the end it says give me the minimum so effectively what happens here is you got C internal PLP G SQL SQL and then the minimum name of those is land name and as you'll notice there's actually no value over here because I specified null on that side any questions okay so we can join to these common table expressions these sort of fake tables that we create here's a case where again kind of contrived we select a certain number of values from the PG class table we name the columns and we then select and we join the common table expression with another table and then we return the results again probably you'd never want to do this but you kind of get the idea getting a little more interesting we now have the ability to do a case statement inside of a common table expression you're like okay why should I care about this why I'm talking about this because as I said before common table expressions are an imperative give you imperative control of SQL and effectively a case statement although you never maybe thought about this actually acts as an if else clause so it gives you an SQL construct to do if else processing and I'm going to show you a bunch of examples of that as we go forward so here's a refresher here I have selecting a column and I'm actually have a second column that's manufactured that that that column is either going to say positive zero or negative depending on the value of the column okay so I talked about recursive as sort of a way of creating loops in common table expressions and this is the first time we've actually seen the recursive keyword in action okay so I kind of told you about union and union all and you can kind of paste queries together I talked about case statements kind of like acts like an if else thing again I'm kind of getting into an imperative language that has an if statement and and sort of a way of joining things together but I didn't really talk about looping because most languages have some kind of construct to repeatedly do something hopefully not repeat it forever it never finishes but some construct maybe you don't want to finish maybe it's a demon that repeatedly runs things but anyway we're going to assume that you don't want to write an SQL query that just runs forever what you could do in fact this is an example of that there is a special keyword called recursive and if you add that recursive keyword into the common table expression then effectively what happens is that you get it takes the common table expression it runs it it returns the result and then it goes back and it runs it again okay so that's a this is a very simplest example you would never do this in production in fact this is a kind of a case where it runs it returns one row and it just kind of comes down so you say recursive it returns a source but there's no kind of hook here so one row comes out it selects from source in one one row comes out it's very simple okay this is not this is not simple this is where it goes bad okay the difference between this one and this one is that this one doesn't mention source in times inside the common table expression this one does and this is a construct you're going to see over and over in this presentation and frankly over and over in production use the common table expressions here we basically have the same we've recursive keyword the word source we have a select but then we have that union all that thing I talked about earlier and then we have another select which also queries the same common table expression we're generating so this would be bad right this is the ten go to ten kind of command or looping you know while while true kind of command where it just goes on and on so what happens is you return the one but then the rest of the query asks for the one and then you get the one and it returns a one again and then that one comes back in and you return to one again and the only way this actually finished was I I actually set a statement time out so that it would terminate because it would act this would actually never finish so you'd never write something like this when it's important to understand the construct because you are going to be using this kind of construct throughout the entire presentation okay so this is basically the way it works you start with the word recursive up top you have some type of constant to I would say prime the pump okay get it started that's your first value of your loop and then in your union all you have some new value so in this case it just loops forever the one returns the source that source actually is queried here the one goes back up it comes back down it goes back up it comes back down this obviously the two and the three just never finish okay so how do you fix this well this is another example it's also very bad it tip it it technically would say hello over and over again which again is not something what you want to do in production but again in fact it would it would print nothing because it would never finish okay there's one way to fix this and that is to use union without the all because again once you get a duplicate it doesn't rerun so the same thing with the one or hello it doesn't matter it sees it sends the hello the second hello is already the same nothing new is coming out of the query it knows not to run anymore and actually terminates this is not used very much but I just want to give it to you for completeness the way you normally do it is this okay if you don't understand this slide you're gonna have trouble understanding the later slides so I'm actually gonna ask for questions once I'm done the slide the basic issue here is you say with recursive and you have in this case a counter whatever you want to call it you see the value here of one whatever that is and then you union all and here we have a case where the one actually goes up to the counter it comes down to the source because remember we're querying from source this one becomes a two okay so the one comes out the one goes up it comes into here the one plus one is two two goes up two comes down now two becomes three three goes up three comes down three becomes four you got it okay however the reason this works is that where clause again highlight the text in red what I'm saying here is that you can keep this loop going but as soon as the counter is equal or greater than ten we stop okay and this construct you're gonna see over and over again you have a priming query that does a select to get you started okay maybe it'll be a constant maybe it'll be a value from something else whatever okay then you have a union all and then you have another query which also references the same source as the top but you have some kind of limiting condition this limiting condition prevents it from running forever all right any questions about this yes sir okay so the word counter just happens to be a name I gave that column oh if I don't name okay that's a great question if I don't name the column yeah so that wouldn't work because the one would come up but there would be no name to reference it here I think is the problem yeah that would be yeah there would be it would be an anonymous column and then you couldn't you couldn't actually query it here I guess there might be some use for that but you really need this you really almost need a name I hadn't thought of it but yeah you can use it without a name but I would say once you go recursive you kind of got to name it no no no no no you could I think you could but that's a good question you have to have the name up here or could you put the name here I think you could just you could put the name here yeah I think you I don't think you have to have it up there I like it up there because it's clear but I think you don't think you have to other questions yes sir well they are yes sir effectively the way SQL works it returns the data in a non-deterministic order right but because they were generated in that order that's the order we're going to turn them in we could have added an order by down here if we want to override that but normally it will come out in exactly that number whatever now this is in a contrived example again typically if you want to do this you'd run generate series but you get the idea we got it we got to start somewhere this is a good example other questions yes sir that's a good point so the question is if that where claw does that where clause actually running for the value 10 to come down or is it not calling the function at all indeed it is calling the function so if you had a function with side effects in that where clause potentially that could be run yeah now there is some I don't even think we short circuit and clauses so I think it would always run that whole line even if you had a function call in there but again function call with side effects would be the case where it actually would matter that where clause was run and indeed it does other questions yes sir so if you had so the question is if you had a second source here and you reference source in the second source which you can do wouldn't necessarily have the seed value in fact what would happen was you you can actually generate values in source and then those values would feed into source to and source to effectively would run as an independent after source after source right so the first one would pretty much complete before the second one would generate pretty much that's I'm pretty much sure that's how that's the way that we implemented it yeah oh you can't do two recurses in the same query I haven't looked at that I thought you could I mean technically you should be able to but just an ordinary one yeah it would it would run source one and then it would feed into source to yeah other questions


Yo! Hey, hey, how's it going, everyone? So you can hear me back here again with another reaction video. And I know in my last video I said that my next video was gonna be my reacting to every single BTS music video. Video? Um... Well, something popped up. That something was Golden Child on Rotor Kingdom with their stage called T.O.P. And everyone's been freaking about it on Twitter. Like, god damn, like, I've put a lot of goldenness on Twitter because, you know, I'm a goldenness.  So I was like, okay, I'll react to it tomorrow, which is tonight. And what we're doing is, um, we're gonna be reacting to it because apparently it's really freaking good, the stage. And so I'm excited. I know, uh, you're excited. And, um, yeah. So often in there, there's all these. Okay, I agree. I don't know what he said, but I agree. Okay, why? My chicken? Yes, I get that. Whoa! Whoa! Oh, yeah, whoa. Pretty sure that's what. But when, um, he was on mix nine. So that's how I know this thing. Oh, that's so good, really. I agree.  This is like, uh, an end of year stage, like mama. Or dub. See, insanely good with synchronization. Ooh, that's what they're good for.   You want to see how I would do it? Because it won't be good. Wait, let me have, watch it a couple times. Okay, okay. I don't, don't, won't be able to do it. So I somewhat did that. Okay, sign me up, Golden Child. Whoa.  Hey. Goddamn. I love Tag's rap voice. Like, well, just his voice in general. Oi. For a moment that I thought that he said T.O.P. And then I was like, top dog? Oh, I missed top dog so much. Oh. Whoa. Whoa. Dude, down. And why is it very close together? Oh, that's so good. I can't, no. Whoa. I should do that. Oh, don't. Goddamn. I'm constantly getting chills. That's my heart, why?  Like, no jokes. They're like, they're cool, cool-down perfection in my eyes. Not saying that was epic, because it wasn't epic.  That's what's happening. It's beating so hard. Oh, don't do that to me, ImNet.  So starters. Golden Child killed my heart in a different way that ImNet did it. ImNet gave me a heart attack out of a fright. Golden Child was Go-Chow! gave me a heart attack out of pure freaking talent and skills. There's a difference in there.     OK? That was insanely good. Spectacular. Fantastic. G-g-g-golden. Swah. That is how good the performance was. Order those things right there. That was how good the performance was. But you know what? My favorite part was definitely when they did that thing. Ah! Hit money. Seriously, when they did the... I just cracked my back. I'm not having it today. It's not my day today.  But yeah, that was insanely freaking good. Anyway, everyone, thank you all for watching this video. If you enjoyed, turn on the support by leaving a like. Comment down below how much you love the stage. And also, subscribe. And there you guys were. Got a child reaction video as well. And just got a child video. I still need to read the junk side. It's like, very well, subscribe for more of that. I lost my voice. What voice am I doing? Let's go and make a mess. Ho, ho, ho. Hopefully you guys have a great day. And yeah, just, uh... K, what's wrong?


So we've learned about forces which are one way to figure out how things behave in a classical system And if you know that all the forces you can work out what's going to happen in the future. That can be quite complicated though Simple ways of working things out involved looking at conserved quantities And the first one we saw was momentum. Now momentum is always conserved. It only has one form The only disadvantage is it's a vector So it has three components It's got a magnitude and direction And so when you write down a conservation momentum what you're really writing down is three conservation laws The conservation momentum in the x-direction, the conservation in the y-direction and the conservation in the z-direction all in one hit A simpler quantity that only has a scalar quantity something like a charge and charge is always conserved But problems that require us to use the conservation of charge don't turn up that often except in more exotic situations So while being completely true and very important, it's not very useful There's mass. Mass is just a scalar But it's not always conserved. It's mostly conserved. That said Non-relativistic speeds and so forth when you're not worrying about nuclear reactions mass is effectively conserved So you can use things like conservation of pens or conservation of storm water for a lot of water goes into a drain You can figure out how fast the water has to be coming out the other end You can work out traffic flow and so forth using conservation of mass. So that's a good rule of thumb And we've also learned about conservation of energy. Now energy is important in lots of everyday situations It's a scaler. So that's very handy and it's always conserved, which is great The only problem is it comes in lots of forms and so to use it you have to learn all the different forms of energy and track How energy travels from one to another And in fact this tracking of how energy and learning how to use energy is one of the main things that enabled us to change our Technology over the last few hundred years from all the millions of years of fairly static technology beforehand Access to available energy is absolutely critical to our modern life It is a dominant force in international and domestic politics and you might ask the question if energy is conserved How can that possibly be and the answer is fairly simple energy has a lot of different forms And some of those are really easy to use and some of those are basically impossible to use So for the vast majority of human history the main energy source that we could access was the energy stored in our own muscles or If we're going to get the biology right more specifically I guess the bog of it was stored in the liver in the form of glycogen or in fat cells in the form of fat now How did that as you get there? Well, that's a long story Essentially it came from nuclear reactions in the sun into sunlight Light down in through the sky into plants plants converted into sugars the sugars are either eaten by animals or by us and then The animals were eaten by us and somehow all that got together into our glycogen and fat stores And we could run jump and adjust our environment to our hearts content and even of course once we use that energy the energy isn't gone It's just changed form So what's happened is that chemical potential energy in the chemicals in our body has turned into some kind of useful work and some waste heat It was actually the unbelievably important discovery that heat was a form of energy That allowed us as a species to go beyond the limits of what could be done with just the chemical energy Stored in our own muscles and the muscles of any animals that we domesticated Besides perhaps the occasional water wheel all energy that we were using was coming from us And this is a huge limitation even if we were using machines to try and use that energy And do that work as efficiently as possible So instead when we discovered that heat was a form of energy We learned not only that we could put work and create heat so we could say Bore out a cannon and make it hot in the process We also discovered how to do the reverse which is how to use a fire To make say a steam engine and create work and useful energy out of making things hot When we discovered we could burn things in some way and make them hot and then use that to do work That's what changed the world That's how we got from millions of years of very stable technology to suddenly the industrial revolution and things changing on an enormous scale So at a microscopic level heat energy is really just the kinetic energy of the particles moving around So if you have a gas of particles and they're all moving around at different velocities Then they each have different kinetic energy But on average you'll have a certain amount of energy Stored in the kinetic energy of that gas and that's the heat energy ultimately And the hotter something is then all these things are bouncing around and they'll have this bigger hotter distribution of energy They'll have more energy per particle on average So in the context of trying to get energy out of our muscles and to do useful things Then normally we think of the work as the important thing So this is stuff done by the force that our muscles produce And we think of the heat as a waste byproduct and indeed that's often the case So often when you're trying to use energy you end up producing some kind of low temperature heat as a result And if you produce high temperature heat like if you're building a fire in a steam engine You can use that to do work But if you have low temperature heat then you're basically that energy is not in a usable form anymore And there's this whole discipline of physics called thermodynamics where we talk about exactly what the limits are on trying to extract energy out of different sources of heat So when you talk about using energy you're really talking about transforming energy from one form to another form Well, sometimes from one form to multiple other forms of which you really only want one of them And that means that we always have to worry about the efficiency of that process Which is just the fraction of energy that you extracted into the form you wanted Divided by the total amount of energy that you used So in this case it would be the work divided by the chemical potential energy that we used


I think it's about time to start. Good morning, everybody. I know today is a quiet morning, I hope you enjoy it. Okay, what I'm going to talk about is the state of Numer support within the Linux kernel. For Numer, what I'm talking about is the fact that as the number of CPU or number of cores in the socket keep increasing. Right now, the maximum number of cores per socket is today. And for AMD, it's now up to 32. So we put more socket on the system. We are getting more and more core. And with SMT, you have two fads per core. So you double the number of fads. For instance, in the case of if I know HPE, the Superdom X system can support up to 32 socket. Though the biggest one you can buy right now is probably about 16 socket. But still, you count the maximum config with 32 socket, you can have up to 896 core and the chance to 1,792 fads per system. So with such massive number of cores and fads on the system, and with multiple different socket, the application has to be aware of where the Numer nature of a system in order to freezingize it. In fact, with such a big system, you may not be even able to put up the Linux kernel without problem. But that problem, I think, is largely solved with the recent changes in the locking subsystem to make it easier to support such a larger configuration. And in this presentation, I will talk about three major challenges that we have in order to support the application for the Linux kernel to support such a large system. The first one is data locality. And then I will talk a little bit about hill pages. And finally, we'll talk about cache line contention. So what is Numer? Numer basically is a way of design system that instead of, because in the older time, you have a share bus where all the CPU communicate with the share bus and the memory is attached to a share bus. But this has changed in the last few decades to a Numer configuration where each socket has their own local memory. So different memory depending on where it is put have different pathways to all the other CPU. That means different access time. And the reason for that is simply because of performance. Because with a share bus, everything put on the same share bus, then it will limit the frequency and the speed with which you can access those information. But on the dedicated bus on each socket, transaction can be done much quicker. But the downside is if you need to access the remote data, they are far away on another node. It will take a longer time. So in this talk, I will use some term that I want to define here to make sure they understand what I am talking about. A socket refers to a physical processor chip. They are on a given processor socket. And a node refers to an entity that contains a CPU with local memory attached. And that is connected to all the other nodes via inter-poster transportation link like the hyper-transport or quick path. The two terms are not the same because you can have more than one node within a single socket. But usually, each socket is just one node. But there are cases that CPU may not be true. An example will be the AMD Epic CPU. It's actually four chips on a single socket. So you actually take out the lip of the CPU, you will see four pieces of separate silicon on the same substrate. And they are connected by the inter-poster link. And then each of the chips connect to their own memory channel. So that's why in the case of the Epic CPU or one single socket, it's actually beautiful node one. And at core, we refer to a physical CPU with their own L1 and L2 cache. And L3 cache are usually shared among different cores. But L1 and L2 are dedicated to each of the cores. And in fact, our logical CPU refers to an instruction stream that from the operating system point of view is one single CPU. We sometimes call it just logical CPU because it's not exactly the same as one core. In the case of the 86, we support up to two threads per core. For other architecture, we support four or sometimes even eight. I know that the power PC, I think the power 8 can support up to eight threads per core. But it is a setting that you can select, I think, on the bias level. You can select four threads per core or eight threads. The more threads you select, the slower each thread will be, basically. Okay. Data locati. For maximum performance, you would like to have all your data and data application to be in the same node. They are attached to the CPU in the same node without going through the interpersonal link to a remote node. The reason is that within the same node, the access time are usually much quicker. And for some of the benchmark that we want, the data for memory intensive benchmark, if the data on a local loop, the speed can be up to three times faster than if the data on a remote node. And if you have one or install some of the enterprise application like the Oracle database, they have many nodes to control their behavior. And many of the tuning nodes are actually for controlling the data locati. And another thing is that the scheduler, in the Linux kernel, will try to move tasks around to balance the load. So if most of the tasks are one node, but the other nodes are idle, the scheduler may move some of the tasks from one node to the other node in order to balance the load. But the side effect of that is the data that was once local will not become remote. So there are two ways you can control about this kind of movement of migration between nodes. Within the Linux kernel have a feature called auto-numer that when you turn it on, it will allow the kernel in its best effort try to move the data with the task as much as possible. So the scheduler designed to move the task from one node to another node, it will also try to move the data access by that task to the other node as well in the best effort spaces. But another way, because of that, because of the automatic nature, it may not be the best internal performance because you can manually control where the task and the data is. The performance are usually better than relying on the auto-numer feature. And that's why for most enterprise applications, when they have a large developer team to support you, they can tune the application much better than what can be done by the Linux kernel itself. But that requires experience and expertise. So if you don't have a large support group to manage and tune the application, you may not get as good performance as another group or another organization. They have bigger support staff to do this kind of tuning. And for instance, if you have a four-node system, you can run a single-node, single-databit instance on all the nodes. Or you can separate into four separate instances and one each of the instances in one of the nodes, each of the nodes exclusively. You will find out that the four instance one will perform much better than the one instance, one database instance, because, exactly because of the data locality problem. So depending on your use case, you may opt to have a multiple-instance database instead of a single-instance on all the nodes. And the issue that we found on tuning system on Nimera is the hill pages. All modern open systems use virtual memory to translate virtual address to physical address. And translation is done via a page table. In the case of 886, the page table is four-level for current crop of CPU. The new one that are coming, I think, next year, ISLIC, you have five-level page table and support up to 52-bit of physical memory. Right now, we only support up to four or six-bit of physical memory, which translates to 64 terabyte. But in the future, we will support up to four gigabytes of memory with five-level page table. For 886, a page can be either 4K, two-map, or even one gigabyte. But then in order to speed up the translation process, there is a kind of cache within the CPU called the TLB translation look-aside buffer that are used to cache all these virtual to physical translation to that. If you use an address that are already in the cache, it can immediately give you back the actual physical address to go there to fetch the data item instead of going through the translation process again. Because the translation itself, you have to access four separate page tables. So you have four additional memory access, which, of course, slow things down for everything that the computer is doing. But there are a limit on how large the TLB can be. So you can't have two-map entry in the TLB. And because of that, if the application has a large data set, it tries to access many from many different locations. It's possible that you want all of the cache in the TLB, and then if there's a cache, you will first use the TLB entry and then do the translation, load the new mapping into the TLB. And so that will slow things down pretty significantly. So in order to allow the TLB to cover a larger address space, you will need to use HEAL pages. Again, the kernels provide two mechanisms for you to unite the HEALs page. The first one is transparent HEALs page. With that, the kernel managed the HEALs page for you, so it will look the data page that you load in. It used 4K page by default, but you saw that you are assessing quite a number of 4K pages within a bigger 2-meter page. It will combine the smaller 4K pages together into a 2-meter page and use one entry in the TLB instead. But then if you try to de-elk memory within the HEALs page, the kernel will have to break up back to the individual 4K pages, so there are some overhead involved. Another way to manage HEALs page is using what they call the HEAL TLB FS file system, in which it's the applicant's job to manage the HEAL page. The applicant tells the operating system which memory address I want to use HEALs page. And so the kernel will then map those memory address with HEAL pages directly, and it won't break it up and it won't do other stuff. On the kernel side, it's much easier because it just follows what the applicant asked them to do, but then the applicant has to know what they are doing. If they don't use HEALs page correctly, it can hinder performance because with HEALs page, you don't use up all the memory in the HEALs pages. You are just wasting memory. In fact, in many enterprise applications, they recommend that you turn off TLB because they can do a better job than TLB by using HEALs page directly. And having TLB is just adding some extra overhead to slow things down. That's why I sometimes recommend turning off TLB and letting it handle the HEALs page. Another thing I want to talk about is the cache line contention. And before talking about cache line contention, I would like to talk a little bit about the cache coherency protocol. Within modern CPU, we usually have three levels of caches. There are some exotic CPUs that may have up to four levels. I know that for some of the big IBM PowerPC systems, they have multi-chip modules like the Wysonskate. They have maybe two chips on a socket, and then there will be the first one, the first chip of memory level forecast. But in most commercial CPU, it's only three levels of cache. And you will have a newer system with multiple socket. We need to make sure that the content of the cache are consistent.  If they are different, the programmer will not behave correctly. And a cache line in the case of 86 is about 64 bytes. There are some, I think there are some systems that would 125 cache line. But this day, I think most of them use 64 bytes as the size of the cache line. Most cache coherency protocols support four or five different states. In the case of Intel CPU, they use the MESIF, the Modify Exclusive Share, Invader, and four protocol. AMD uses a slightly different one, but the principle is about the same. When multiple CPU are trying to assess the same cache line across multiple nodes, the cache coherency protocol will make sure that the content of the cache stays consistent. Of the coherency protocol, one thing I want to let you aware that you try to do a wide on the cache line. What happens is if the cache line is being shared by multiple nodes, when you do a wide, it will have to... The cache coherency protocol will have to send the invader message to all the other nodes to invader the cache line there. And then only one node can have exclusive access to the cache line. And once it stays changing exclusively, then you can write to the cache line. So if you have multiple nodes trying to write to cache line, you create a situation that the ownership of cache line move around different nodes. A situation, what we call the cache line bouncing. And that uses quite a lot of bandwidth in the inter-processor link. And so that will limit the bandwidth available for other type of memory access and also increase the latency. Now, talking about cache line contention, usually on a large new system with multiple nodes, cache line contention can be a serious performance part of that. There are two types of cache line contention that we usually talk about. The first type is called the force cache line sharing. It's the case that multiple CPU or maybe multiple socket try to access a different data item, but they happen to be in the same cache line. In that case, you will create a cache line contention problem. So, CPU1, we try to access data item A, CPU2, access data item B. There are different data, but they're in the same cache line. They try to modify the value. It will create a problem. Cache force cache line sharing usually has to be solved. But we have tools available to pinpoint this kind of problem, like the perp C2C2. It will pinpoint where the cache line contention happens. And you can look at the address where the shared data is. If the address are different, they actually have different data items, but they just happen to be in the same cache line. The address is different within the same cache line. You know that these are force cache line sharing, and what you can do is try to move the data away so that they are in their own cache line instead of being shared together in the same cache line. So, some tuning in your application in order to move them away from each other. In the Linux kernel, the data items, they are mostly to be contained by multiple CPU, a log, and counter. Many counter in Linux have been switched to use per CPU counter. That means there is multiple counter, one for each of the CPU. They're counting the same thing. They want to look at the value of the counter when you do it from a sysfx variable or from a popfs variable that contains the counter data. What the kernel do is, they sum up all the counter for each of the per CPU. They sum up all the counter for each of the CPU in order to give you the final result. But usually, we are less frequently done than the right. So, the use of per CPU counter will avoid the cache line content problem but at the same time, allow you to occasionally read the counter value. Another data type that has frequent cache line content problem is the log. Log content content will slow things down because in the case of exclusive log, you have to, only one CPU can own the log. The rest have to wait for it. So, you basically seal your application at the log contention point. The level of log contention can be reduced by picking up a core screen log into multiple final green one. But in many cases, it's actually harder done than said. It may not be, depending on the kind of log it is, it may not be easy to break up into smaller one. And on the other side, if there are two types of logs, there's spinning log and slipping log. In the case of spinning log, when there is the contention, it also means that the CPU will be spinning on the log cache line and that cause cache line contention problem that I talked about previously. And log contention used to be a serious problem. In fact, when I began working on Linux, my job is to try to improve the performance of application on large remote system. The first system that I work on has Exocap and we see the effect of log contention and it's detrimental to performance on those kind of large system. So, we try to work on the log itself to make the log contention less a serious problem. And we have, I can say that we have largely solved this kind of log cache line contention problem by avoid spinning on the log cache line. If you have multiple waiter waiting on the log in the past, it used to just, they all spin on the log cache line to see when they are available. But today, only one or two, only the, yeah, only one of the waiter will spin on the log. The rest will spin on their own local cache line, thus avoiding this kind of log cache line contention problem. A major vision block in the locking infrastructure in the recent year is the use of the MCS log. It's a locking algorithm that allows scalable log synchronization in SNP system and slightly different variant of MCS log are used internally by the different log in the kernel. The Q-SpinLog is a new locking algorithm that was merged into the photo kernel. With Q-SpinLog, log waiter are put into the MCS queue. The MCL itself serves as a light queue, so you have a queue hat and then a queue tail. Any newcomer will go into the queue tail and ray in the queue. And then the queue hat will spin on the log cache line, but the rest are spin on the local cache line, so there won't be too much contention on the log cache line. And then we have Q-VrayLog in the kernel, which were merged earlier in the V16 kernel. With the Q-VrayLog, Q-VrayLog actually is a fair log. The period version of the V-VrayLog code is an unfair log, and unfair log have the problem that if there is a lot of contention, it's possible that some of the CPU may never get the log, or those CPU may have to wait a long time to get the log. And in fact, one of the main problems of putting up large system with main CPU is that some of the CPU may never get a V-VrayLog, and the more commonly used V-VrayLog in the kernel is the task list log. And in the Buddha process, the task list log is quite contented, because you have to spawn up a lot of kernel fare and a lot of user fare. And so it is possible that in the Buddha process some of the CPU, because they can't get the log within, let's say 70 seconds, you will have a soft log message painting in the kernel, and in some cases they even have a hard log up and crash system. V-VrayLog is a fair log, and when combined with the Q-SpinLog, it will provide fair V-VrayLog with download cache line contention problem. And then for Miltat, which is a sleeping, mutually exclusive log, in the past log-waters are allowed to spin on log as long as the log owner is running. So if you actually look at the state of log owner, if log owner is running, it will spin on log. But before the free-tank kernel, the spinning is done just... So everybody there waiting on log will spin on log cache line. So we have the same log cache line contention problem. And in the free-tank kernel, the patch is merged to make the way they can kill based on the MCS log. That means only the Q-hat will spin on the log, the web, again, spin on their own cache line. And this solved the log cache line contention problem. And the killing group has seen it enhanced and extracted into what we call optimistic spinning kill code in the kernel. They are now shared by also V-VraySamerfor. And around the, I think maybe 3.15 or 14-time thing, you will find that when they convert some of the new tech into V-VraySamerfor, the people might actually... Okay, the people might actually deteriorate because V-VraySamerfor doesn't have the optimistic spinning code. And so they also adopt the use of the optimistic spinning kill since V6 in kernel in order to achieve performance parity with Mutex. Now, I just want to show you some data that I have about the effect of log cache line contention. The following two graphs will show you the locking way of a micro-benchmark using both the kill spin-off and the ticket spin-off. It's running on a 16-socket, 244-IPPH-EH system. The Y-axis shows you the number of locking operations per second, and the X-axis is the number of core or the number of active flat there spinning contention on the log. You can see that with the kill spin-off, the performance kind of stabilizes around more or less the same value, and in the case of ticket lock, it actually deteriorates because of the increasing log contention. And you will see a drop here is because it's transitioning from only in a single node to a second node. So because there are 15 CPUs on the socket, so up to here is within one socket.  It's just because there's a lot bigger latency involved in the acquisition of log. And this extends the Y-axis up to all the CPU, all the core in the system. So you can see that if all the core in the system are spinning on the same log, ticket spin-off, the locking way will be done here, and for kill spin-off, it's up here. It's about four to five X difference, I think. So you can see, you can see that with lock case-line contention, there will be a serious performance impact. What is the number of locking operations per second? It's just the number of locking operations per second. So the Beigel benchmark is just doing acquire log, release it, and then acquire again repeatedly, and it shows you how many such operations you can do by all the flag on the system. Higher is better. Higher is better, yes. Okay, conclusion. So the Linux kernel is doing a beautiful job in managing data locality itself for its own data structure. But for application, they have to know how to manage it properly otherwise they can't utilize all the remote within the remote system. For application, they are not, they are not any more aware than what we can do, yes. We can use some tools like remote control or the CPU setting, to limit application to one on just one node, or a number of CPU within a single node. They will largely solve the data locality problem. Work is still ongoing on the transparent page-page side to make it more useful for the FH user. But that will take quite a while for the improvement to come. So I will expect that in the next few years we are still developing on transparent pages. And cache line connection is still an ongoing problem. There are many codes in the kernel and depending on what nodes some connection problem may show up which we need to address once it is found. But lock cache line connection, I think is mostly solved. Though we are still doing some additional tuning and performance enhancement in the locking code. Okay, that end my presentation. Do you have any questions? Yeah, I think it's time. Okay. I have maybe one question. No, I don't think you have time. Yeah. So are there currently, you mentioned some of tools to do some measurements. Are there some, for instance, of chip counters that would give you an idea of how much latency you have for memory accesses or in the process? Is that something that is easy to measure today? Could you repeat the question? The question is, I talk about a perp tool to diagnose the application not to find out if there are any cache line contention. The perp tool is the most common one that I use. I know there are other perp tools out there also can do this kind of measurement like the Intel vTune. But my question was, I think the tuning mentioned was specifically about mostly the local cache. And my question was whether there was a way to measure the fraction of your memory accesses before going to some other new manual and the latency that you got from that. Actually, the tools will show you the, I think it will show you the latency on different new manuals. So actually, the output of perp tool to see is very wide and it will show you on each node how many heat you have on each of the nodes. So you will know how much access are removed, how much are local. So I would highly recommend you try out the perp tools to see if you are interested in this kind of problem. And this is the kind of measurement that Autorimba uses or is it something else? Just like a regular perp tool will be caught for a certain period of time and then it will generate a report on all this cache line. The memory access pattern that exceeds a certain threshold. So you can... Yeah, I would highly recommend you try it out and see whether you like it or not. Okay, thank you very much for your time.


I love you because you wash all my clothes. I love you because you make me warm dinners.  You're really creative.  I love you because I might not see you for months and then when I see you again it's like there's been no time at all. You always pick me up when I'm down. Crunchy, but it's true. I'm obsessed with you so much. You don't realise, you don't understand how much of a good person you are. You do so much for others. I love you because you work really hard and you have a lot to deal with, but you deal with it really well.  I love you because you put up with me and that takes a long time. Don't really care of people's faith. You're always there for me when I need you. I love you because you make me feel like a matter and that I'm always doing something that makes a difference. I know that no matter what happens you'll always be there and that's an incredible trait to have because I don't know how anyone could love someone that much. I love you because you're on my side and I appreciate you.


Alright, GT Goku, what can he do, level three maybe? Oh, how's it going everybody? Dodged it right here back with some more Dragon Ball fighters, rank matches. This time playing the All Vegeta team in order to check out the newest manga colors added to the game. And yes, you're also seeing that right, we are going up against the highest rank in the game, Zeno. I'm also only just now realizing that this man's name is a plug. Sub to Cat Carat YouTube, also subscribe to me, I realize his name didn't have that, but I'm adding that on. But yeah dude, this is the promo video. I hope he doesn't beat me. I gave you a shout out bro, please, please bro. This is just so aggressive, I'm kidding. But yeah, I guess we should talk about the manga colors. I actually think, I'm not gonna lie, I like these a lot more than the Goku manga colors, even though I like Orange, like I like Goku's Gi better, but for some reason it just looks way better on Vegeta. Like look at base Vegeta bro. Like it's popped right off the page. Also that, I can't believe I got hit by that. That was sick. The knee mix, I think I have to spark here. That was interesting. Oh wow, he actually caught a key blast there, that was cheap. Woo, he's reflected me. Take a key blast then. Oh come on, you didn't get hit by that, that mix was beautiful. Oh no, that sucked that we lost him in. No dragon rush, I'm surprised. Why did I hit super? And let's go, a big drop. I'm just gonna level three, oh. I did the wrong input, that's why I got it. The level three actually would have worked there, that's the saddest part of it all. Oh my neck. Okay, base Vegeta is gone, now we get to see Super Saiyan Vegeta, it looks good on him as well. You could really, I'm glad that actually we went up against another base Vegeta, you can see the difference. The low, I can respect it, I can respect it. Man, yeah just look at the difference in like the color scheme. It's much brighter. Okay, another level three. We don't even have spark now, our level three strategy would have worked earlier. I don't know if it worked today, the overhead, that was nice, get off of me though. Talk to me in the dragon, okay.  We had to see the level five at least once, right? You gotta see it with the new color. Ugh, how close through are we to the corner? Ah, not at all, felt that. Oh, he's blocking right now. I didn't know if the light string would work there. I didn't know if the light string was where, I regret not going for it. If I was gonna do the medium jigs, I should have committed. All right, we actually get a recovery there. Whoa, I don't think I was plus there either. Ah, that's a Key Blast was sick. Ooh, ooh, ooh, ooh, blocking on this find. Daring today, aren't we, sir? Oh, I thought I could see brush there. I'm guard canceling, yes, barely worth it. What a, I didn't block as I thought he'd combo.  Energy Cutter actually hit, and he Bardock confirmed off me.  Very solid character. All right, we got ourselves a game now. Blue Vegeta's arriving on the scene. Ugh, let's go. All right, we're jumping around. Move it. Too late, ah, no, it was early. It was early, I could see it coming though. All right, Blue Vegeta getting pushed around. That's fine. I'm vanishing, I got two H, no two H, I'll take it. Beautiful, not gonna get us a lot there because I don't know the route off Super Dash confirmed, but.  EX doesn't drop it, that's gonna be like one super away from death, yeah, well he's gonna have to spend two, but the first super sets up the second, easy KO, and now we're heading into game two. Are we gonna be able to snag a win off a Zeno rank? With this, it's looking good. We just gotta clean up some play here. I may be overall new to the Vegeta's, well not new, but I may be new to the Vegeta, all I assist in, but I can make it work a little early, not early, but I'm gonna mash here, no, no, oh, right there was the mash chance, the mash chance? That was not supposed to sound like I was trying to say last, that was not supposed to be a joke basically. That was me missing my chance to mash, all right. We'll reflect and I panic back dash. All right, get the big bang up. Really double reflect, I can't believe it. That was sick. It's Vegeta against Vegeta, I am losing a lot of health. All right, we gotta switch.  All right, we're getting another chance, I need to switch out. All right, you forced my hand. Oh my goodness, wow, why didn't I launch him up? A lot of mistakes here tonight. All right, there we go, please? All right, good, it finally worked. I was about to say that I missed so many opportunities. All right, big KO here on base Vegeta, hopefully I'm not gonna do anything fancy. There's no need to risk it, just go for a little bit of this. Two bars probably would have killed, but I'm a coward. I was not gonna let the, listen, I was not gonna let a character get away because I want it to be greedy. All right, I will definitely take that. No, I couldn't ex kick out of that. I thought I had time, Bardock snipes us though. All right, GT Goku, what can he do? Level three maybe? Oh, I didn't think he would. Doesn't this give up corner? I guess it doesn't matter. I'm getting mixed. Now, is it going to be overhead, cross up? Can he cross me up? Is it gonna go low? I'm raw tagging, oh, he went low. That was an option. Wow, I can't believe I didn't recover in time. That was an option we discussed. I was ready for that.  I let Bardock get away, whatever. Bardock, you're coming back out.  I can practically predict it. Oh, get in the corner. Let's go, that was big. Three level one skills here, and I'm not in the business of messing this up. All right, Gallic Gun, please seal the deal. We're going up just up against Goku GT then. Team Vegeta is making the moves we need to make. There we go, I needed that. Needed that too. I tried to buy as much time as possible. Oh, we blocked it, but barely, and I wasn't ready for the follow-up, not against the highest rank. Oh, you got that? I really need to work on being patient in the air. I hit a button, I think I hit A. Dragon Rush, wow. Oh, I got Key Blast, that was supposed to be a reflect. Oh, that was so sick. I didn't think he'd cross up, that was crazy. All right, we got one character left. Do I make a read or do I set my feet? I'm going Super Dash.  Oh, what did I guard against him? Super Dash, man. I can't let him hit a beam on me. He'll vanish and mix me. What a confirm. I'm not going to take any chances. Gallant Gun, we'll seal the deal. We take game two with all Vegeta's. Okay, I was sweating. We got really lucky there. I think I jabbed his E, or did he fall afterward? I can't remember, you saw it. Basically, I wasn't thinking. I blacked out somewhere along the lines after I lost two Vegeta. He's going to try to bar dock me. I can see it in the future. No bar docking? Oh my goodness, at least you could have bar docked me. That was me. That was a good timing right there. Let me get a little bit of, I'll give you a three out of 10. All right, early spark, I can appreciate it. Oh, that was a mean two H. I wanted a big bang, but even that wouldn't have worked there. All right, we sparked there as well. Ready for ya. Oh, vanish doesn't beat that. That would have been sick to keep the corner. Level three, yep, level three coming our way. He has a lot of options here. We've expended our sparking, trying to keep that pressure on him. I don't know what we do here. We just raw tagged, but that could have gone back, and that could have backfired so easily. I don't know why I was worried about the past. I need to worry about the present. You got loops? I'm really not trying to eat cereal right now. Part of a balanced breakfast, I get it, but I don't need it right now. Supernastat. Switch, whoa. Oh, that was not a correct two H there, but it worked. Talk to me down here while you're talking to me then. Don't really have a lot of options. Beautiful day. Do I, I get the blue life, right? I get the blue life. Let's not kid ourselves here. I'm getting blue life. No, no, what a huge loss, Key Blast. I haven't thrown a lot of Key Blast. Oh, we traded. What a combo. All right, this should kill, but if it doesn't, oh, I panicked. I definitely, I definitely was mashing Facebook and Vegeta. Okay, a decent character lead. I tried to make her read. Beautiful dragon rush. She knew I was too worried to click a button. Sick thinking. Six bars, he probably spent some here.  Yeah, I'm not, I can't say I'm surprised.  Bardock's iconic line. You're the one who's, yeah, go ahead, say it, Bardock. I get it, but you'll never mix me.  He did not just block.  I should have played defense. I should have. The thing is, I figured he'd be reckless. Oh! You should have never dri- You got it. Hey, you got it. I was just happy I got to live. Okay, we lost that character lead and now I think we're actually, we're behind. No, I hit the EX kick. It was too late though. I wonder if pre-nerf would have hit. I actually am not aware. Let's go! Three bars, you spent it for nothing. Is that my feet? Oh! No, that was crucial. Bardock, Beasus actually hit there. Can a bar kill? Can two, oh, two bars can kill. That was nice. Good patience on the combo. It's gonna be up to limit break Vegeta. Every character we lose makes my wake-up level three hurt more. Why did I have to turn to the side of idiots? Oh my goodness, that was lucky. I tried an EX kick again. It didn't even go off that time though. So at least I got to see, oh! Smooth! No, no, no, please! One more chance! Oh, we even got the bar. No, what a way to lose. Great game. I mean, that was sick. That was a really nice two H at the end. That was really good on the ball fighters. My man was alert. Damn, we shouldn't have the wake-up level three stings right now. Great games. Hey, now we're actually going up against another opponent using the other Vegeta in the game, Baby Vegeta. That update is actually when these colors were added. I feel like because we ran into the Zeno rank, or Zeta, we didn't exactly, we didn't get to talk about these too much. But again, I like them way more than the base Goku. Why did I try it right there? Oh, no, don't hit a button. No! I'm just gonna Super Dash. Fake pressure, fake pressure, okay. He knew, he was onto my game. Loops, you got these? Let's go! Oh, he was trying to get new and interesting. Hey, what's up, brolies? I didn't think Vanished would get me in that situation. Loops? Oh, going new and interesting. Css Loops, I'm out, I'm out! Oh, wow! Actually caught me before I could Vanish there. That is not looking good for my blue health then. Nevermind, we're good. Switch out, just to make sure those keyblasts don't come back. I don't think they were going through. I regret, okay, we got a spark. My momentum is all off, we got a spark. Doesn't tag me out, I can at least appreciate that. Maybe we don't spark right now, I'm sparking. I'm sparking, you know we gotta get a little bit of this momentum back. Spent so much bar, okay, I'm not gonna finish it. Oh, it just gave me baby Vegeta back. I need to make up for some mistakes. Super Dash? Oh no, please open up. Please, just open up, okay, there we go. I needed that dude. Okay, I needed a character, I was feeling real nervous. We should probably also, ah, it's Broly and UI Goku. Anybody that limit breaks is gonna hurt. Broly maybe a little more so though. No Super Dash, do it now. Go in. Oh, that was casual. My man just reflected me, the biz casual. Didn't even flinch. I'm getting thrown to the corner. That is never a good sign. UI Goku, please. Level three? No level three, doesn't even wanna spend the bar. Guard cancel in. Okay, I'm gonna guard cancel again if you don't mind. My meter is not as precious as it is right now. I throw my meter away at the drop of a hat. Well, how did that drop? Okay. No, Big Bang missed. Oh, my coverage. Okay, again, he has six and a half bars. Does he spend it this time around? He might got, no, see us just again. He doesn't wanna way out. We have been healing this, this team has taken a beating. Okay, wait, we might be seeing him leave. Yeah, okay, he's getting out. I actually don't, I don't mind this too, too much. Obviously it's bad to see that blue health go away, but oh, I reflected out of fear. I reflected out of fear. It's bad to see that blue health go away, but limit break Broly's a monster anyway. So dealing with him now might be preferable. Oh, I made a huge mistake though. Should have just taken, all right, we level three there. We level three, too many mistakes. I gotta get at least a hard knockdown from this. Woo, smooth though. Smooth, I won't take that. I won't take that, I don't mind that. Oh God, okay, grab, I'm watching the grab. Any key blasts you wanna throw, go. Come here then. Two H, oh, okay, I don't like the corner.  Oh, the two H missed, big trouble. We are in big trouble. Trouble's getting bigger. Trouble's getting bigger all the time. Not good, not great. Am I dead? Didn't drag and rush. Wounded the grab route. Level one, am I dead? Yes, that limit break Broly would have killed me. I would have gotten killed just for breathing against Broly limit break. Key blasts destroyed mine. Gets a vanished route as well. Huge damage, not unwinnable though, we still got a second chance with this character. Drag, oh, he takes it, that was huge, huge tech for him. Okay, jump that. Drag and rush from far away, I jabbed because I thought he'd be a lot closer. Does this give me another bar?  Not enough to kill those, I'll just keep the bar for defensive purposes. I'm going again. Oh, you know I had to go again. I saw he stayed crouch for that and that was a mistake. I was like, maybe I turned that mistake into an odd purpose thing. Big bang attack, it misses. He drag and rushes. Okay, I'm just, I'm very worried. You kick, okay.  Oh my goodness, why the command grab? There was no need to wage that. You right, hey, when you right, you right. You don't gotta, you don't gotta see my, oh, that's it, that's it. That was very lucky. Is that it though? It's not, is it? I'm just going to Gallagin anyway. I missed. He got hit by the one. Oh, sniped him, look at base Vegeta. Cheezing through across the map. That was sick. I will definitely take that. Look at that. Oh, that's a good shot. I didn't realize that. See when we beat the Zed Oreg, I was not a, I was, it's all a lie. Conspiracy stance. Css, I didn't realize when you call Goku, Css, he breathes. I just realized they used this pose from his counter for that. I guess it makes sense. I just, oh, nice conversion. I will take that. I'm not going to do anything too fancy with it. Oh, missed my two H by a little bit. Baby's going to combo it to the sea. All right. What does he do off this though? Spinning? No, bringing back down to the ground. No sliding. I'll take it.  My goodness, those legs. Oh, nice, nice. That was really sick. Anti-air to aired me with the gaol claws. I can respect it. What I can't, what I can't do is stick around though. I've really got to get going. I hope you don't mind, but I'm going to leave. Got to go ahead and leave DP just for sliding. I appreciate it. Wow, I can't believe I, I can't afford to miss stuff like that. I'm going back out into base Vegeta. I'd rather die than leave. I'm thinking about leaving again. I'm really thinking about leaving. Oh, no, he didn't grab, but he did not grab that time. Caught me mashing. Just one of the many facets of you guys gameplay. Oh, Broly is just going to make this real cheap. CS this just makes this a saving expense. Oh, hey, you know what? At least baby Vegeta is back out. This is a chance to get that momentum back. If we tie it up here without getting hit, that's huge. Jump. Oh, right over his assist. Right. No, we got hit by that. We had to block. Cheap. I didn't have Super Dash. No, let's go. I'll take it. We didn't, we did get hit a few times, but I'll easily take this big bang. Please kill just one. Nice. Big bang attack brings the damage. Now we just have to deal with the two boss monsters and we're good. I officially took out one blue eyes, white dragon.  I only said the reason I said that is because I could tell somebody thought I didn't know the name of the monster. And they were going to bully me in the comments.  I'm just hoping there's a Jordan watching this that also plays Yu-Gi-Oh is going to correct me. I'm making reads. I'll just settle for a Jordan. Oh, I thought I got two H vanish. Who cares? Key blast, key blast. I backed dash.  I don't know why my thumbs did that. Big damage back into the quarter three bars. He might spend it with Broly just to get UI out, but he does it. Let's go. Pain. Oh, it reflected, just got hit with a big bang. I'll take it. I'll take it. Okay. So this is where I'm probably going to want Vegeta's assist. I don't know why I kicked it. Oh, I tried to outrage Broly with these stubby arms. Level three? No, just vanishing. My goodness, man. Look at the damage. I don't even know what he did to me. Oh my goodness. What was, what did that combo start with? Oh no, I can't reach. I just trusted him. I trusted that that would combo.  He took advantage of my low IQ.  Come on, even seven. Oh, that was so painful. I looked, I was like, wait, that missed complete. And then I realized my hands were on my controller. I had to pay it. I paid it, dude. I'm going to have to read Sparky for Sparky. You thought I didn't have your number? Come here. I've seen the face of death and it's Broly. No, he's, my goodness, man. Just die. No way. We lost that huge. Don't do it. Okay, beautiful hold vanish right there. Two H took a while to recover and we're going to walk away with that's two wins, right? Let me, let me, let me just, let me just make sure it's two wins. Let me check. That's two wins. Thank you so much for watching. Hopefully you enjoyed this one. Had a lot going on. But yeah, let me know your thoughts on the new Vegeta manga colors down in the comments as well. Of course, you can also let me know your favorite moment while you're down there. Make sure to like button and subscribe to the channel if you like these videos and want to see them keep coming out. Other than that, I have been Dr. Doia and I will see you in the next one.


What's up YouTube Dylan to be progressive soccer training here are some individual futsal highlights for my recent futsal match Progressive futsal club versus Calgary villains major if you want to watch the full match you can check that out on my youtube channel I'll be posting more full matches more individual highlights as well as Analysis of my successful plays and most importantly my mistakes and failures. We won the game I won't tell you the exact score one goal one assist not my best game, but getting better every day Check it out. Make sure you subscribe share and like Today's my dad's birthday. Happy birthday dad. He's on the camera We're going to play some futsal playing against villains Villains is a strong men's team They just entered the league this year because we won the league last year and went to nationals a lot of teams picked up Interests and they joined this futsal league. So that's a good thing. It's becoming more competitive It's becoming stronger competition, but that means we're gonna have to raise our game I'm gonna have to raise my game. We're short one player. It's gonna be a little more playing time I don't mind But I'm really just gonna focus on pressing pressing with intensity really trying to get around the field off the ball movement So never being standing still unless a wide open will stand still but being very proactive with my movement both Defensively closing players down or trying to nick some passes not letting my opposition play and Authentically making those forward runs getting myself in open space And if I do those things I think that the goals are gonna come and I'm gonna do my best to help the team win So I hope you guys enjoyed the video if you do Please remember to like and share if you haven't already subscribed hit that bell notification So you never miss a video two games two wins We won It was a good game as a heated game that team like I said was a strong team They're coming to knock us off a lot of people said hey, these guys are gonna meet you But we weren't having any of that. This is our league and we made a statement today. So we felt really good about the win personally played okay, I Am still definitely rusty. I need to not as sharp as usual. I need to practice my shooting more I have to it's difficult in the winter As I'm sure you guys know this is where make the most out of games So I have to find a way to practice my shooting so I can be more clinical in front of that tribe if you have it They'll see you guys next time


Planning Day. Oh, thank you. Welcome to Financial Planning Day. And to our first speaker of the day, we have Brian Truett here from Truett Insurance Agency, who will be talking about insurance sublimits. And we're very lucky to have Brian. I know him mostly from his, the presentations that he's given to financial planners, helping us understand what we need to make sure our clients are doing. And so he's an expert to the people who are supposed to be experts ourselves. So we're very lucky to have him. Some administrative items for this session. There's a chat functionality in the bottom of your Zoom. And so if you have any questions, put them in there, and we'll get to those as the presentation goes on. You don't need to wait until the end. And if you are planning on joining us for Financial Planning Day one on ones, those are happening as well. And we have a full schedule today of presentation. So thank you for coming. And thank you, Brian, for enlightening us on insurance on Saturday morning. Yeah, my pleasure. So this is a, this is a modified class that I have done from the Financial Planner Association. So I tried to make it more accessible to, you know, people who just want to buy some insurance. But it's about sublimates. And it's a really important topic in insurance, particularly on property insurance, because there's a lot of hidden agenda in insurance carriers. A sublimate is an internal limit on an insurance policy that's not easy to see. So I used an example of life insurance. If you went out and bought a life insurance policy, and somewhere in the fine print, it said, you know, if you died of cancer, it would only give you 10% of the million dollars. That wouldn't be a really great way of protecting your family, because you don't really know what you're going to die of if you buy the life insurance policy. Property and casualty insurance has a lot of those types of sublimates in them, or in it. And it's important to read your contracts and know what you're buying when you buy insurance. The problem in the insurance business that we have is that shopping for insurance is mostly a process of someone trying to get your attention. Farmers and, you know, they have these great ads where like a moose attacks a camper, or there's the lizard and the lizard's awesome. I mean, I love the, it's in a boat and wants to get on shore and flows having this romance on the progressive commercials. I watched this very carefully. And there's nothing in those commercials to tell you what you're buying. They're just grasping your attention. So you have humor and songs, and my kids are always like we are farmers, you know. And I'm like, actually we're not kids and then no one annoys me so they do it more. But they're giving you some appeals to cost or services like that moose attacking something or the chaos guy or whatever he is, the havoc guy, you know, driving around. You can switch and save and we'll take care of you. But there's no useful information in the absence of useful information. People create their own metrics using maybe some numbers or some internal calculus. Well, this is a bigger carrier than the other carrier, whatever you think is important, you use and you make a decision and move on with your life because you've got to live your life and insurance isn't super exciting, even on Saturday morning at 10 o'clock. So what happens is in the world of insurance, there's a continuum of coverage. And at this end of the spectrum here, at the bottom where there's $1 sign, it's less expensive coverage that has very lean coverage, very narrow interpretation of coverage. So you might not have any extra extended replacement cost or code upgrade coverage. And I'll get into what some of these things are as we go forward. But you might have a depreciated payout, ACV means depreciated payout. And up here, where it's more expensive, if your house burns down, they'll just write you a check for the replacement cost of the house and tell you they're sorry you lost your house. And so the easier it is to get money from an insurance carrier, the more expensive the policy is going to be. Most policies that people purchase on homes and in autos for that matter, but this is really much more about property, falls into this middle section here. And it's called the middle market. And we call it that for a reason, because these are carriers that advertise to middle America, and they fall in between the sort of low end carriers and the high end carriers. And these carriers build their insurance policies based on a statistical probability. So they know from their loss ratios that they don't typically lose an entire house, that only happens maybe 10% of the time.   And everything is fine.   And be okay. It's the people who fall in the outside of the middle average claim, meaning that being dissatisfied customers. So in here, in the middle market average claim, people might have a small claim and they're fine. But if their house burns down, or if you had a sewer backup claim, and sewer backup is the number one cause of loss in our insurance agency, from a property standpoint, that particular event happens to more people at a higher rate of claim than any other type of property loss that we have. And that's followed by a water from burst pipe, and then water from wind. Fire is not even in our top three, or four covered causes of losses as the top. So, but if you had a sewer backup that say flooded your entire house, and it was a $200,000 claim, that's when your insurance carrier has put these protections in place for themselves to say, oh, we're really sorry, this is only covered to $5,000, not $200,000. You see, on page 47, line A sub chapter one, it says sewer backup is only covered to $5,000. So the carriers use these sub limits to sell insurance at a low rate and then protect themselves against catastrophic loss. So they're bringing you into the family by low rate and advertising, but then they're protecting their downside risk by having lower limits on things that are catastrophic losses. And only only only happens to 10% of people that those catastrophic losses occur. So it's not a very well known phenomenon. And that's until you reach like a large fire situation like in California where we keep having these massive fires where thousands of people lose homes and now everyone finds out that they don't have coverage. And that's where the government tries to step in and say, hey, wait a minute, you guys, you got to cover these houses. So you should know that these two slides on how insurance works are really the most important things I'm going to talk about today because it's how you protect yourself by asking questions about the rest of the things that we're going to talk about. So the first type of sub limit that I see very frequently is a really basic and subtle one. It's replacement cost as a sub limit. So most insurance carriers when they're calculating the value of a home, a value of property, use a very limited means of calculation. They come up with a minimum potential loss. So a house might, if you put all the year build and the square footage and your type of walls and roof and all those things into a system like Marshall Swift Beck, which is very common among the insurance carriers. If you did the same thing with State Farm and Farmers and Safeco and Liberty Mutual and name your other carriers, you're going to come up with a pretty uniform estimate on what the replacement cost of a house is. And these carriers are using minimums. So we've routinely seen in San Francisco a house might be insured for four or $500,000 because that's what the minimum was, but really that's closer to a million dollar home or higher depending on what people have done on the inside of that house. And so this is where you get this. This client was insured for $677,000 or $176 per foot. When we asked what was in the house, we ended up calculating that that house should have been insured for $1.5 million and that client was under insured by $862,000. This is really important because if they're starting out without enough coverage and they have things like ordinance and law sublimated or sewer backup sublimated or something like that, they end up getting them to trouble. And you'll notice that the premium on this policy was $2,000 a year, almost $2,100, and they had $1,000 deductible. We raised their deductible to $10,000 and we gave them another $860,000 of coverage. And so now their potential outlay of risk is really only the $10,000 deductible versus being potentially underinsured by $862,000. But these people were in peril if they would have had a really large loss. And the second thing on this particular sublimate is how the settlement options work on an insurance policy. So a lot of times on a policy, in fact, most times, the policy will say, we will pay you $677,000, but in order to get that amount, you have to replace, rebuild or repair whatever property was damaged. So in order to get the $677,000, you have to be able to rebuild that house. But if you can't rebuild it because you're actually underinsured, then they're going to give you the ACV, which is actual cash value. So we're going to go back to that house from 1998, depreciate everything in it, the flooring and the cabinets and everything and say, now we're going to give you less than $677,000. We're going to give you the depreciated value of what those things would be worth today. So people end up with much less than they were expecting because in a large loss, they can't afford to rebuild because they weren't insured to value in the first place. And the settlement options almost ensure that they will get far less than they would have expected than their contract would have said they would. So these are really common problems that we see in claims all the time. I do, these aren't my claims, by the way, that we see the problems on. These are claims that I do a lot of volunteer work. Since I know a lot of financial advisors and people who volunteer in organizations like this one, they'll call me and say, hey, we have this person who lost a house. And so I've been involved in many claims that weren't my own claims, but I was able to read the contracts and help people negotiate with their insurance company about how best to settle them. But it's very difficult to negotiate when you don't have enough coverage from the start. And ultimately on that contract, the insurance contract says that the burden of telling the insurance carrier how much you need is on the insurer, the person who really knows the least about insurance. So replacement cost as a subordinate is a really important thing to understand if you own a home. And things to think about when you're talking about replacement cost or what kind of windows are in the house, you know, a vinyl window is a completely different cost than say a wood window and metal windows that are fire-rated can be extremely expensive. So in certain areas of San Francisco, in particular, after the Loma Prieta earthquake and the fires that occurred, San Francisco forces rebuilt to be in fire-rated windows and fire-rated eaves because the houses are close together. So all of those types of things can raise your cost considerably. If you have a very complex roofing system, it can be more expensive or if you've put in a really nice stone or you've spent a lot of money on carpet. So pay attention to the things that you've done in your home and what you're expecting from the claim. It becomes obvious if you're underinsured. A lot of times people will know a contractor or they can get a bid. What would my total cost be to rebuild this home? It's a really good question to ask if you have contacts in that space if you're insuring a home. So that's replacement cost and it does manifest as a subliminal if you get it wrong because you can't get what you were expecting. And most people who buy insurance or buy insurance with the expectation that they're going to have their home built. So the next one I'm going to talk about is ordinance and law. It's also called building toward upgrade. It's kind of confusing because when you rebuild, like if you rebuild the house from 1998, you'd have to rebuild that house to a 2022 code. In San Francisco, there's a lot of houses that were built in 1900 and they've had some upgrades. But when you're doing upgrades on a home, you don't have to fully take care of all the code. There's a lot of grandfathered code. The bottom line with code upgrades causes unpredictable expenses for the carrier because if you have to put in like fire-rated windows or you have to put in a EV charging station or you have to redo the energy efficiency of the home, all of those things cost a lot of money. And it gets treated as a separate cause of loss. So you might have a fire, it's the first cause of loss. Okay, you had this amount of damage done in the house. And then if we have to rebuild to a different code, the carrier considers that to be a separate type of loss, a second cause of loss. So they usually express code in a percentage. They'll say we'll give you 10% or 100% or 50, whatever that number is, they will give you that amount of code upgrade on your house. There's two reasons why this gets misunderstood. One is remodeled houses, like I said, could be remodeled without triggering full code. But the fire department has a tendency and if you have a water plain, we have to open up all the walls to dry or to make sure that there's no fire. So once you've opened up all these walls, that's when the code starts to come into play. The other side is it's often said it's an extra coverage. So if you have like a million dollar house or a $500,000 house, they'll say, oh, well, you have this extra 10% for code upgrade. It doesn't increase the value of the claim. It actually limits the value of the claim. So the way that works is, oh, here's, this is some stuff that we see in code, energy seismic, San Francisco seismic is a really big one. We had a claim one time on some windows in San Francisco where the house had a big fire and the difference in the windows that we had to put in was about $40,000 of cost because the client wanted wood windows and the carrier said they would only put in vinyl windows. And then the city of San Francisco said you had to put in fire rated windows, which is triple glass metal window, which is very expensive. But we're looking at water efficiency and historic ordinance. This first picture, if you had to rebuild one of these houses here from, what square is this? Alamo Square. If you had to rebuild one of those houses, you can't just rebuild a modern house. You have to rebuild it to look like those houses because San Francisco makes a lot of money selling space for people to film that famous spot. So they're not going to let you just rebuild a modern home right there. You might have to demolish part of the house in order to comply with code. So anyway, these are some of the things that we see. And here's how this works. So if you had a house that was insured for $1 million and you had an ordinance and law sub limited 10%, that means of that million dollars, you have $100,000 towards use for code. So if you had a house with building code upgrades of a home that were 20% of the actual bill, so $200,000 of that million dollars is code. The carrier is only going to pay $100,000 towards code. So the client would be $100,000 out of pocket to rebuild that house. So the carrier ended up ensuring the house for a million, but only paid out $900,000 on the client because of code. A house that was built in 1970s is going to be about 30% to 40% code difference. So that is a big number of that million dollars. If it's 40% of code, $400,000, the person could end up having it out of pocket on a rebuild of $300,000, $400,000 of code, $100,000 comes back in from the carrier, and then you have this $300,000 that they're saying that they're not going to cover because it's code. That is where you're an outlier on that bill curve that I showed because the carrier is going to be very sorry about it, but their policy says, right here, it says that we only give you this 10% of code. So anytime you see an insurance policy that has this sub-limit, that policy is designed not to pay any catastrophic loss. That's the reason that it's there, and then if you pair this sub-limit with, say, in order to get the full value of your claim, you have to repair, rebuild the place, now the carrier can even owe you less than they would have otherwise because they're not going to give you all of the money that you had on your contract, they're going to give you less money. So when you start adding all these moving parts of the policies together, it really creates a peril. There are carriers that pay, you know, that will write 100% code and 100% sewer backup, but you have to ask for those things. And a lot of the people who are selling insurance are only doing that, they're just selling insurance, so they wouldn't know to do that because they're not involved in claims. So you sort of make your own justice if you're shopping for insurance, and you have to really know what questions to ask, and you have to know if that person even understands what they're talking about sometimes, because, you know, the companies that are selling product on television that you see while you're watching television are the same carriers that are hiring their salespeople, and those carriers aren't that worried about whether or not they know about this code upgrade and sewer backup because those carriers are using that bell curve to protect themselves. So is there any questions so far? Yeah, that's actually a good, we had somebody who wanted to know the difference between working with...