The file organization is a collection of related information that is stored in the secondary storage. These secondary storages are the hard drives and portable drives where the files are stored.
These files are stored in block structures that are connected in a specific manner. And this is the concept behind the file organization. The file organization is the logical relationship between various files. Making the file easier for the user.
For example, you have various folders on your desktop such as movies, videos, pictures, documents. They all clearly define the relationship that exists with the files that you will find inside the particular folder and that is what the concept of logical relationship means. Within the movie folder, you will find longer videos more than an hour within the picture folder you will find jpeg and png files. Also, one more important thing in file organization is that creates an ease of access such as creating subfolders to identify the movies that you want such as for a movie fan who might have hundreds of movies in his folder he requires to access the folder easily and this can happen if he classifies the movie folder and subfolder as well as files properly which can depict the logical relationship.
How to file organization is important to DBMS
Let’s start from the first step of database creation which is a client telling his problem to a software engineer and then with the help of a client there is the preparation of an E-R model which is a rough sketch of what entities are to be used and how they are linked to each other in a database. When the rough sketch is created of what are the entities and what is the relationship between them it’s time to craft them over our database with the help of a database management system and create rows and columns in a table and create various tables and then make the relationship with the help of keys. When the tables and relationships in one of the databases now are the time to normalize them as more than one table may contain the same row or same columns we have to find them and remove them and optimize our database. When the normalization is done then from here the file organization starts, when the database is prepared we have to organize them into our system or our server, and how these databases have to be accessed will be dealt with by the file organization.
How file are organized in the system
Let’s start with how files are stored on your computer. There are various ways to manage the file system such as FAT32 or NTFS and they store the files in three forms: contiguous allocation, linked structure, and the indexing form. You have to remember that like any data structures such as linked lists or an array these files have methods for storage, insertion, and deletion. These operations can only be performed when we know how they are organized within our computers.
Mostly the files in our database are stored in a continuous sequential manner. These files are stored in the form of blocks that are placed one after another. Now, these blocks contain the chunks of the file and the information in these files can be in sorted or unsorted fashion. Also when we discuss the relational database method which is based on the relational calculus states that the table is a set of records and the set can have the elements randomly. Therefore the tables that contain the column and the rows can have them arranged in a sorted and unsorted manner, we now have to see what are the advantages and disadvantages of both of these.
For example, there is a table and this table contains the rows and the columns. Now the data in this specific table can be sorted or unsorted. One column will have all the sorted information which can be used as a search column and the other column may not be sorted because they are needed in performing the search. In this case, the insertion becomes a little complicated because you have to find the specific location where the record has to be stored but in an unsorted manner you can store the new attributes in the next column or new row after the last row which makes the insertion process of the unsorted easier than the sorted. But for deletion and searching of the elements in the table, the sorted will have an advantage because before deletion is performed the searching has to be done, and as the sorted has information arranged this makes it easier to search information then unsorted which has random stored information. The time that is taken for searching, therefore, increases in the unsorted array method and it can be the same as checking each element till the end if we have not found that specific element.
Mapping of the records
When you have decided the way you have to arrange the file that it can be sorted and the other can be in an unsorted manner. Then it’s time to map them on the storage space. It can be stored in two methods: one is spanned and another one is unspanned. The spanned manner is storing the files in such a way that no internal fragmentation occurs in the file if the files are not stored completely in one block then it will be shifted to the next block and this will be a more optimized usage of the space. Also, the main reason we study them is that a good amount of money is spent searching for an element in the database and not the proper information storage but the searching eats up the processing of the computer thus making it more occupied for other use. The spanned mapping creates a more hectic task for searching for an element and therefore the unspanned manner where one complete information is stored in one complete block and there is no leftover information but there can be leftover spaces which may later cause internal fragmentation.