‫So now here's what we're going to do.
‫I am going to insert into grade parts, select star from.
‫Grades Orch.
‫So what will this do?
‫It will essentially copy the entire table into this table, right?
‫But it will insert one row by.
‫And here's the beautiful part, guys.
‫The beautiful part on this is every time you insert around this table, the database will decide which
‫partition that row goes to based on the value of G, f, G is twenty or twenty is between zero and thirty
‫five.
‫So it goes to zero zero, thirty five and so on.
‫So it's going to distribute our beautiful table just like that.
‫So let's see what all what did I do or that's wrong.
‫Just a different syntax.
‫So let's do it again.
‫Boompa I kept doing this clear.
‫That's just where.
‫All right.
‫So let's hit it and let's just wait for it.
‫So it's going to answer 10 million rolls into this great stable nice done.
‫That's pretty fast, right.
‫So now, guys, if I do select count start from grades bahts.
‫That's the same number, 10 million and one, that's an extra one, but if I do select Max, I'd not
‫get the grade from grades.
‫Parts obviously is going to be whatever.
‫Ninety nine is the max.
‫However, if I looked at the tables now themselves, they are populated.
‫But look at this.
‫The maximum value is zero zero thirty five is actually thirty four.
‫Right.
‫So that's just select count.
‫So you can see Canstar from G zero zero thirty five.
‫This is my first partition there.
‫Only this much rows around.
‫What.
‫Oh how much is this.
‫Three million is that's three million, three million rose, right?
‫And if I go to thirty five sixty, we have around two million and so on is just a random distribution.
‫So if I do select Max G from G thirty five sixty, what do you think the number will be about fifty
‫nine.
‫Exactly.
‫Because that's the largest grade we can get in the stable and so on.
‫They are just distributed.
‫So now guys, it's still my tables don't have an index.
‫Right.
‫And always my purpose.
‫So let's go ahead and create an index and should I create an index on all of the partitions.
‫Well prior to post because I believe 11 you that that was the only way to do it in Port Postgres 12,
‫I believe they added the ability or eleven on and you only have to create it on the on the partition
‫table.
‫Great parts index.
‫Let's call it grade parts index.
‫Right.
‫Index on grades parts.
‫On the act of creating it on the master or the on the leader partition and tabled, it will create the
‫same index on all the partitions, which is very, very powerful.
‫Let's let's check this out.
‫So it's going to create that obviously there is no index on the Masters because it's empty, there's
‫nothing.
‫It's just a virtual table almost.
‫Right.
‫So if I do great sports.
‫There is an index, they say this is your index, but if I go to G zero zero thirty five, hey, where
‫does this index come from?
‫I didn't create that.
‫The database did for me, which is beautiful.
‫If I go to thirty five, thirty five sixty, we have indexes on all of them.
‫Beautiful.