SlideShare una empresa de Scribd logo
1 de 13
PRIMARY
STORAGE
SECONDARY
STORAGE
1)Faster Access Slower Access
2)Expensive Cheaper
3)Lesser storage
capacity
Greater Storage
capacity
4)Temporary Storage Permanent Storage
 Secondary Storage Structure
 Used for permanent storage
 It’s a collection of records or a stream of bytes
 Every Record is a collection of fields
 A particular field is chosen as a Key
 Records are organised in file by using the key. Primary
and secondary keys.
 Consider a student database.
 Every student has a unique record
 Record has details of student-i.e name, Student
ID etc. These are the fields.
 The unique key can be the Student ID. The
records can be organised in the file on basis of
student ID.
 Sometimes data is too large to be stored in main
memory.
 Maintaining permanent record is possible only by
using a secondary storage. Hence files.
 Physical Files:
A collection of bits stored in the secondary storage
device
 Logical File:
A channel that connects he program to the physical
file(Stream).
An example
FILE* out
out=fopen(“sample.txt”,”w”);
Here out is the logical file and sample.txt is the
physical file.
 Opening a File:
A logical file is associated with the physical file
 Closing a File:
The logical file associated with the physical file is freed.
fclose(file pointer);
 Reading from file:
Data present in physical file is read by using the logical file
 Writing to a File
Data can be written to physical file by using the logical file
 Every logical file has a file position pointer.
 When we open a new stream the position pointer
is set to beginning of the file.
 As data is read or written the file position pointer is
moved accordingly.
 To move file pointer to required position.
fseek(file pointer,offset, position); 
 To display current location of pointer.
long position=ftell(pointer);
 To check for end of file
while(!feof(pointer));
 Sequential File
Stored in the order entered
 Random Access Files
An record is accessed using an index.(Hashing).
 Direct Access Files:
The records are stored based on their relative
position with respect to first record.
Record with key 50 is placed at location 50
 Records are stored in the order entered
 Used when all the records have to be processed.
 Complexity for searching O(n)
 An record is accessed using an index.
 The index of record position in file has to be
maintained in the main memory.
 The Index can be created using hashing.
 Search complexity is less. Complexity of Indexing
method used.
 Disadvantage: While handling very large
databases its not possible to maintain an index in
the main memory.
 The records are stored based on their relative
position with respect to first record.
 Record with key 50 is placed at location 50
 The search complexity is O(1)
 Disadvantage is a lot of memory is wasted.
 For example if no record has key 100 the position
100 is wasted.

Más contenido relacionado

La actualidad más candente

11. Storage and File Structure in DBMS
11. Storage and File Structure in DBMS11. Storage and File Structure in DBMS
11. Storage and File Structure in DBMS
koolkampus
 
database recovery techniques
database recovery techniques database recovery techniques
database recovery techniques
Kalhan Liyanage
 
1. Introduction to DBMS
1. Introduction to DBMS1. Introduction to DBMS
1. Introduction to DBMS
koolkampus
 

La actualidad más candente (20)

11. Storage and File Structure in DBMS
11. Storage and File Structure in DBMS11. Storage and File Structure in DBMS
11. Storage and File Structure in DBMS
 
database recovery techniques
database recovery techniques database recovery techniques
database recovery techniques
 
trees in data structure
trees in data structure trees in data structure
trees in data structure
 
File access method
File access methodFile access method
File access method
 
Database backup and recovery
Database backup and recoveryDatabase backup and recovery
Database backup and recovery
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraints
 
File organisation
File organisationFile organisation
File organisation
 
Files
FilesFiles
Files
 
File concept and access method
File concept and access methodFile concept and access method
File concept and access method
 
1. Introduction to DBMS
1. Introduction to DBMS1. Introduction to DBMS
1. Introduction to DBMS
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
 
File organization
File organizationFile organization
File organization
 
File system implementation
File system implementationFile system implementation
File system implementation
 
Concurrency Control in Database Management System
Concurrency Control in Database Management SystemConcurrency Control in Database Management System
Concurrency Control in Database Management System
 
Hashing
HashingHashing
Hashing
 
Recovery techniques
Recovery techniquesRecovery techniques
Recovery techniques
 
File organization and introduction of DBMS
File organization and introduction of DBMSFile organization and introduction of DBMS
File organization and introduction of DBMS
 
Database Normalization
Database NormalizationDatabase Normalization
Database Normalization
 
Isam
IsamIsam
Isam
 
Data structure & its types
Data structure & its typesData structure & its types
Data structure & its types
 

Similar a File structures

Fundamental File Processing Operations
Fundamental File Processing OperationsFundamental File Processing Operations
Fundamental File Processing Operations
Rico
 

Similar a File structures (20)

Unit ivos - file systems
Unit ivos - file systemsUnit ivos - file systems
Unit ivos - file systems
 
File Handling.pptx
File Handling.pptxFile Handling.pptx
File Handling.pptx
 
FILES IN C
FILES IN CFILES IN C
FILES IN C
 
Ch 17 disk storage, basic files structure, and hashing
Ch 17 disk storage, basic files structure, and hashingCh 17 disk storage, basic files structure, and hashing
Ch 17 disk storage, basic files structure, and hashing
 
File Systems
File SystemsFile Systems
File Systems
 
File management
File managementFile management
File management
 
File handling in C hhsjsjshsjjsjsjs.pptx
File handling in C hhsjsjshsjjsjsjs.pptxFile handling in C hhsjsjshsjjsjsjs.pptx
File handling in C hhsjsjshsjjsjsjs.pptx
 
text and binary sequential and random files with modes
text and binary sequential and random files with modestext and binary sequential and random files with modes
text and binary sequential and random files with modes
 
Learn about the File Concept in operating systems ppt
Learn about the File Concept in operating systems pptLearn about the File Concept in operating systems ppt
Learn about the File Concept in operating systems ppt
 
Introduction to File System
Introduction to File SystemIntroduction to File System
Introduction to File System
 
File Handling in C
File Handling in CFile Handling in C
File Handling in C
 
pspp-rsk.pptx
pspp-rsk.pptxpspp-rsk.pptx
pspp-rsk.pptx
 
FIle Handling and dictionaries.pptx
FIle Handling and dictionaries.pptxFIle Handling and dictionaries.pptx
FIle Handling and dictionaries.pptx
 
Unit-VI.pptx
Unit-VI.pptxUnit-VI.pptx
Unit-VI.pptx
 
Fundamental File Processing Operations
Fundamental File Processing OperationsFundamental File Processing Operations
Fundamental File Processing Operations
 
Fundamental File Processing Operations
Fundamental File Processing OperationsFundamental File Processing Operations
Fundamental File Processing Operations
 
presentation_files_1451938150_140676.ppt
presentation_files_1451938150_140676.pptpresentation_files_1451938150_140676.ppt
presentation_files_1451938150_140676.ppt
 
files in c ppt.ppt
files in c ppt.pptfiles in c ppt.ppt
files in c ppt.ppt
 
Unit 3 chapter 1-file management
Unit 3 chapter 1-file managementUnit 3 chapter 1-file management
Unit 3 chapter 1-file management
 
File Management in Operating System
File Management in Operating SystemFile Management in Operating System
File Management in Operating System
 

Último

Último (20)

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 

File structures

  • 1.
  • 2. PRIMARY STORAGE SECONDARY STORAGE 1)Faster Access Slower Access 2)Expensive Cheaper 3)Lesser storage capacity Greater Storage capacity 4)Temporary Storage Permanent Storage
  • 3.  Secondary Storage Structure  Used for permanent storage  It’s a collection of records or a stream of bytes  Every Record is a collection of fields  A particular field is chosen as a Key  Records are organised in file by using the key. Primary and secondary keys.
  • 4.  Consider a student database.  Every student has a unique record  Record has details of student-i.e name, Student ID etc. These are the fields.  The unique key can be the Student ID. The records can be organised in the file on basis of student ID.
  • 5.  Sometimes data is too large to be stored in main memory.  Maintaining permanent record is possible only by using a secondary storage. Hence files.
  • 6.  Physical Files: A collection of bits stored in the secondary storage device  Logical File: A channel that connects he program to the physical file(Stream). An example FILE* out out=fopen(“sample.txt”,”w”); Here out is the logical file and sample.txt is the physical file.
  • 7.  Opening a File: A logical file is associated with the physical file  Closing a File: The logical file associated with the physical file is freed. fclose(file pointer);  Reading from file: Data present in physical file is read by using the logical file  Writing to a File Data can be written to physical file by using the logical file
  • 8.  Every logical file has a file position pointer.  When we open a new stream the position pointer is set to beginning of the file.  As data is read or written the file position pointer is moved accordingly.
  • 9.  To move file pointer to required position. fseek(file pointer,offset, position);   To display current location of pointer. long position=ftell(pointer);  To check for end of file while(!feof(pointer));
  • 10.  Sequential File Stored in the order entered  Random Access Files An record is accessed using an index.(Hashing).  Direct Access Files: The records are stored based on their relative position with respect to first record. Record with key 50 is placed at location 50
  • 11.  Records are stored in the order entered  Used when all the records have to be processed.  Complexity for searching O(n)
  • 12.  An record is accessed using an index.  The index of record position in file has to be maintained in the main memory.  The Index can be created using hashing.  Search complexity is less. Complexity of Indexing method used.  Disadvantage: While handling very large databases its not possible to maintain an index in the main memory.
  • 13.  The records are stored based on their relative position with respect to first record.  Record with key 50 is placed at location 50  The search complexity is O(1)  Disadvantage is a lot of memory is wasted.  For example if no record has key 100 the position 100 is wasted.