1 00:00:00,090 --> 00:00:06,360 ‫So in many of my videos, I show how to interact with tables with millions and millions of rows in order 2 00:00:06,360 --> 00:00:12,060 ‫to test indexing, partitioning and other other features, especially in my introduction to database. 3 00:00:12,060 --> 00:00:16,730 ‫And Janine calls you guys ask me, how do you create a table with such a large quantity of data? 4 00:00:16,860 --> 00:00:21,390 ‫So that will be the video to essentially illustrate how to do that. 5 00:00:21,420 --> 00:00:22,630 ‫I'm going to do it from scratch. 6 00:00:22,650 --> 00:00:23,760 ‫I don't have anything. 7 00:00:23,890 --> 00:00:27,360 ‫I'm going to use Docker to spin a proposal because in a sense, create a table, create a million. 8 00:00:27,630 --> 00:00:29,040 ‫And that's that very short video. 9 00:00:29,070 --> 00:00:35,900 ‫Let's let's get into it, make sure we have Docker and let's write this thing up by postscripts 13. 10 00:00:35,910 --> 00:00:37,280 ‫That's the latest version out there. 11 00:00:37,500 --> 00:00:42,960 ‫So let's go ahead and do that docker run, because the only thing we need is, is the environment, 12 00:00:42,960 --> 00:00:46,110 ‫variable postscripts, password. 13 00:00:46,890 --> 00:00:51,390 ‫And we're going to call this all just the password, Bosco's password. 14 00:00:51,660 --> 00:00:53,700 ‫And then I'm going to do. 15 00:00:54,580 --> 00:01:01,360 ‫Also, Chris, that's exactly the image before we give the image, just give it a name. 16 00:01:01,600 --> 00:01:06,160 ‫It's got PG one because they have something called Viju as it. 17 00:01:07,390 --> 00:01:08,650 ‫It's as simple as this. 18 00:01:09,940 --> 00:01:14,080 ‫Database now we have a database the next day, I don't really need to expose to the poor because I'm 19 00:01:14,080 --> 00:01:20,830 ‫going to put it into the container itself and then run that command and I'm going to just open up another 20 00:01:20,830 --> 00:01:29,770 ‫terminal and do a docker execute dash interactive terminal and then our container name because big one. 21 00:01:30,130 --> 00:01:32,520 ‫And then I want to execute the commands. 22 00:01:32,950 --> 00:01:35,950 ‫Esequiel that you the user name is Bockris. 23 00:01:36,220 --> 00:01:40,410 ‫And just like that we are now into the postscripts command Schult. 24 00:01:40,940 --> 00:01:43,080 ‫The next thing we're going to do is create a table. 25 00:01:43,840 --> 00:01:44,880 ‫It's got a temp. 26 00:01:44,890 --> 00:01:50,590 ‫As for temperatures and I don't know what are we going to like t valuate integer. 27 00:01:50,800 --> 00:01:52,240 ‫I'm going to create it. 28 00:01:52,600 --> 00:02:00,160 ‫Assuming this is an Iot populated table with temperatures, I'm going to create a table with just one 29 00:02:00,160 --> 00:02:08,560 ‫value to temperatures and we're going to insert a million instances of different temperatures from zero 30 00:02:08,650 --> 00:02:10,930 ‫zero to I don't know how to say. 31 00:02:12,140 --> 00:02:18,850 ‫That we had the table, so here's the thing, here's how you do the trick we want to insert into temp 32 00:02:19,030 --> 00:02:21,340 ‫and that's the value we want to populate. 33 00:02:21,340 --> 00:02:27,040 ‫And the trick here is to do a select and from. 34 00:02:27,250 --> 00:02:33,280 ‫I'm going to I'm going to leave this as empty here from generate series. 35 00:02:33,280 --> 00:02:39,250 ‫And this isn't a built in function and Postgres and that when you do a select from generosities, you 36 00:02:39,250 --> 00:02:42,420 ‫can specify from zero to anything really. 37 00:02:42,550 --> 00:02:47,380 ‫And I'm, I'm going to do a million in one zero zero zero zero zero zero that will essentially return 38 00:02:47,380 --> 00:02:47,650 ‫for you. 39 00:02:47,650 --> 00:02:49,270 ‫It varies from zero to a million. 40 00:02:49,300 --> 00:02:49,730 ‫Right. 41 00:02:49,780 --> 00:02:50,590 ‫And select. 42 00:02:50,800 --> 00:02:54,460 ‫But I don't really care about those values because they are very sequential. 43 00:02:54,460 --> 00:02:56,080 ‫I want random values. 44 00:02:56,080 --> 00:03:01,320 ‫So you're going to call a function called random and random are essentially fractions, right? 45 00:03:01,330 --> 00:03:03,790 ‫So zero point zero zero, whatever the values. 46 00:03:04,090 --> 00:03:07,510 ‫So I'm going to multiply by 100 to get a value from zero to one hundred. 47 00:03:07,690 --> 00:03:13,440 ‫And so since I have an integer, this will be coursed nicely into an integer. 48 00:03:13,600 --> 00:03:16,930 ‫So last thing, the semicolon and that's it. 49 00:03:17,230 --> 00:03:20,470 ‫If you have indexes, this is going to be that's a really guys. 50 00:03:21,160 --> 00:03:21,940 ‫It's done. 51 00:03:22,120 --> 00:03:22,630 ‫That's it. 52 00:03:22,870 --> 00:03:25,720 ‫So if I know like a select from temp. 53 00:03:26,730 --> 00:03:27,480 ‫Limit. 54 00:03:28,390 --> 00:03:36,490 ‫Then you can see I have I on our values, and if I select Count Star from Temple. 55 00:03:38,040 --> 00:03:45,640 ‫Because I have a million rows, that's it, guys, very, very quick video so you can populate this 56 00:03:45,660 --> 00:03:52,680 ‫area and play, you can essentially change that number to be whatever you want, really, and just play 57 00:03:52,680 --> 00:03:53,070 ‫with that. 58 00:03:53,190 --> 00:03:58,500 ‫And you might say, oh, what if I have multiple fields just easily just add comma and then add that 59 00:03:58,710 --> 00:04:04,260 ‫this is obviously an integer, but you can easily do the same thing to create characters with other 60 00:04:04,260 --> 00:04:10,180 ‫functions, convert the character, the number into ASCII, into actual characters and play with that. 61 00:04:10,290 --> 00:04:11,850 ‫So that's potentially the call. 62 00:04:12,000 --> 00:04:13,700 ‫All right, guys, that's it for me today. 63 00:04:13,860 --> 00:04:14,810 ‫Very quick video. 64 00:04:14,820 --> 00:04:16,020 ‫I'm going to see you in the next one. 65 00:04:16,080 --> 00:04:17,310 ‫You guys say goodbye. 66 00:04:17,580 --> 00:04:21,960 ‫All the commands, by the way, are going to be in the description so you don't have to pause and look 67 00:04:21,960 --> 00:04:22,460 ‫at this stuff.