‫Demo, let's jump into this guy, so what we do here, guys, we're going to use Docker going to spin
‫up a beautiful Postgres instance, and then we're going to insert around 10 million rolls in that table
‫and then we'll get around, create table partitions, and then we're going to join the partitions to
‫the master table and then do some fancy kuris explaining all that jazz.
‫Right.
‫How about we jump into it, guys?
‫All right, guys, let's just jump into the demo, guys.
‫So requirement here just have Docker and that's it, because I'm going to open up a post Chris Aniston's
‫because I play with this is way, way easier than installing Puskás on my own machine.
‫But if you have it, never mind.
‫So once you have that, I'm going to actually run a Docker command here.
‫Right.
‫And I don't need to expose the ports for possible because I'm going to bash into the container inside
‫Postgres and I'm going to run the sequel commands Inside Bosco's container.
‫So I'm going to do a docker one.
‫And then all I have to do is like basically do that name, give it a name, let's call it a PG mean
‫whatever.
‫Right.
‫That's the name of the container.
‫And then once I'd have that, I want to detach this container because I want to use the same terminal.
‫And then finally.
‫Do an environment variable postscripts, password that's in acquirement, recent one, I just give it
‫a prosperous password, any any password.
‫And then finally, just do Postgres.
‫This is the image you're going to pull from.
‫And then just like that, we spun up a Puskás.
‫In a sense, if I do this, we can have that.
‫We have a podcast and it's a running and this is my name.
‫So now we're going to do it as Goldacre execute interactive terminal.
‫I want to jump into PJI main inside it.
‫Right.
‫I want to run the command.
‫Basche Right.
‫And the ones we bash into the container.
‫I want to do a sequel, DCU, which is the username and Postgres.
‫I'm just like that since I am the owner of this is going to let me in immediately.
‫So now I'm in, I'm in the beautiful Postgres CAMAC.
‫Right.
‫I can do stuff right.
‫All right.
‫So it going to do.
‫I'm going to create a table guys.
‫I'm going to call this great table grades.
‫This is just a bunch of student grades and I'm going to I'm not going to maintain names of the students
‫or anything.
‫This is just a garbage table where we have literally an ID I sequence.
‫I did just one, two, three, four, five, six and a grade.
‫That's it.
‫Right.
‫Nothing else.
‫So I'm going to grade I'm going to call it grades original.
‫Right.
‫And then I am going to get given an ID cyrille.
‫That means every role I insert will automatically get a sequence and increment.
‫I'm going to make it.
‫No, no.
‫This is a requirement for partitioning.
‫Everything should be not null.
‫Right.
‫Everything that your partition against should be not know.
‫And then I'm going to do a G, which is the grade itself G and that's also an integer.
‫No, no.
‫And just like that already.
‫So now I'm going to insert around 10 million rows in this table and that's extremely easy to do.
‫So all we have to do is insert into grades original.
‫I'm going to insert before I add an index to the G just because it's faster this way.
‫Right.
‫Because I don't have to maintain the index while I'm inserting this stuff.
‫So I'm going to answer this select star I select.
‫Here's what I'm gonna do.
‫I'm going to floor a random function, which are the random function gives me fractions like point zero
‫nine point point zero two point zero nine.
‫That's the maximum number.
‫So I'm going to multiply the random by hundred.
‫That gives me values from zero to ninety nine.
‫And that's exactly the grades right out of hundred, essentially not quite a hundred.
‫I'm not going to get one hundred but who cares.
‫Right.
‫So then then I'm going to floor the whole thing because I'm going to get the fraction, the floor will
‫give me the function.
‫So now I'm selecting this from generate series.
‫This is a function that you basically will every time you call you, you specify how many times you
‫want to call it.
‫I don't want to call it ten million times.
‫And I just added this coming so I can see for myself so that I actually like that.
‫And then let's just insert and I says, wait.
‫Oh, bad, bad, bad, bad.
‫OK, so what I'm going to do, I forgot to specify the column so insert into so I have to do G I guess
‫I didn't specify the feel itself.
‫That's my bad.
‫So all happened here is the idea.
‫You don't have to specify because it's, it's, it will be auto generated but the g you have to specify
‫it and the value will go to the G these two values.
‫And just like that we have ten million rows.
‫Obviously we can, we can generate more.
‫But just this is just for example, very nice.
‫So now let's create an index on that create index, let's call it grades, original index on grades,
‫what we call grades original Orge.
‫OMG, I said this will create an index so that create a beautiful index and we talked about indexing
‫and that's it, we have an index.
‫So let's describe the table we have here.
‫Boom, just like that.
‫We have an idea.
‫We have a.