1 00:00:04,100 --> 00:00:14,660 ‫So a full table scan is when you have a large table and you want to find a role in that table or a couple 2 00:00:14,660 --> 00:00:22,040 ‫of rows, not necessarily just one, in order to do that, you need to read the entire table. 3 00:00:22,880 --> 00:00:31,490 ‫Reading the entire table effectively consist of reading at page by page because what is a table, really? 4 00:00:32,060 --> 00:00:39,110 ‫It's it's a single data file on disk or could be multiple data files. 5 00:00:39,830 --> 00:00:46,700 ‫And then you need to ask the disk controller says, hey, give me this portion and then give me this 6 00:00:46,700 --> 00:00:52,880 ‫portion and then gives me this portion and that gives me this portion, these Porgera abortions, really 7 00:00:53,240 --> 00:00:55,400 ‫we can spend hours discussing this stuff. 8 00:00:55,400 --> 00:00:55,760 ‫Right. 9 00:00:56,170 --> 00:01:00,920 ‫If you are looking at the database, these portions are called pages. 10 00:01:00,920 --> 00:01:10,010 ‫And this is what I'm going to refer to them here now on pages, read a page, but the page has a fixed 11 00:01:10,010 --> 00:01:10,460 ‫size. 12 00:01:10,460 --> 00:01:12,080 ‫Some databases have variables. 13 00:01:12,200 --> 00:01:18,110 ‫Page size, like compulsories, is always 8-K by default, unless you recompile the source to be something 14 00:01:18,110 --> 00:01:20,860 ‫else, I believe, and device equals sixteen. 15 00:01:21,860 --> 00:01:26,540 ‫So when you do that, you read these pages one by one. 16 00:01:26,540 --> 00:01:32,600 ‫But what does it mean to read 8-K from descried that's could be translated to a single IIO. 17 00:01:32,600 --> 00:01:35,900 ‫But when you go to the desk there is bloks. 18 00:01:35,900 --> 00:01:42,920 ‫There are sectors in case of a hard disk drive that is physical as D page, which is a different side, 19 00:01:42,920 --> 00:01:48,380 ‫like I believe it's four K, so that that kind of plays into consideration and we got spent hours discussing 20 00:01:48,380 --> 00:01:49,100 ‫that stuff. 21 00:01:50,240 --> 00:01:57,350 ‫So it requires a lot of Io to read all this table and then go to the memory and then one by one read 22 00:01:57,350 --> 00:02:00,200 ‫this road and find out, oh, is this meital, this is my role. 23 00:02:00,240 --> 00:02:00,490 ‫Is this. 24 00:02:02,690 --> 00:02:06,470 ‫So we need a way to be able to reduce the search space. 25 00:02:06,470 --> 00:02:08,340 ‫That's the problem that we have here. 26 00:02:08,510 --> 00:02:09,470 ‫So let's take an example. 27 00:02:09,490 --> 00:02:15,740 ‫You're a fine person with ID five, and usually when you have the ID five, usually you don't care about 28 00:02:15,740 --> 00:02:16,510 ‫the value of five. 29 00:02:16,520 --> 00:02:18,800 ‫You want more information, right? 30 00:02:18,810 --> 00:02:22,950 ‫So you want to find idea five so you can pull the name, for example. 31 00:02:23,210 --> 00:02:31,130 ‫So in this case, you're going to scan all these raw rows until you find this during the scan, you 32 00:02:31,130 --> 00:02:32,360 ‫could have built one page. 33 00:02:32,360 --> 00:02:34,820 ‫You can have pulled a hundred pages until you reach that. 34 00:02:35,060 --> 00:02:42,210 ‫And the cost can vary with the amount of pages you read from this crime. 35 00:02:42,500 --> 00:02:48,710 ‫So if I'm going to search the worst case scenario for the pages that are always at the last right of 36 00:02:48,710 --> 00:02:52,610 ‫the record, and that doesn't necessarily mean anything, to be honest. 37 00:02:52,610 --> 00:02:59,180 ‫This statement, it can be incorrect and really depends on the DBMS solutions. 38 00:02:59,180 --> 00:03:05,150 ‫DBMS are not dumb even on the full table scan when they do that, when they have to do that, when they 39 00:03:05,150 --> 00:03:08,300 ‫have to skip the index, they do a smart thing. 40 00:03:08,300 --> 00:03:15,620 ‫They do threading, they split the tables in half and multiply that and they do multiple workers that 41 00:03:15,620 --> 00:03:23,270 ‫work from the bottom and from the up and they do all sorts of tricks to find the row as quick as possible.