Unfazed❗️🎯

Database intro (+File system vs DBMS) 본문

Database (데이터베이스)

Database intro (+File system vs DBMS)

9taetae9 2023. 10. 20. 10:19
728x90

DB = collection of data

DBMS(Database Management System) = collection of software that allow us to define, construct, manipulate databases +provides a number of desirable funcationalities(data independence, data sharing, recovery, security, etc.)

DBS(Databse System) = DB +DBMS

 

Advantages of DBMS (Atomicity(원자성), Consistancy(일관성), Isolation(독립성), Durability(지속성) =>ACID!)

1.Data abstraction

2.Easy accessing data (database language support, user interfaces)

3.Controlled data redundancy & inconsistency

4.Integrity constraint(IC) enforcement

=> with file systems, ICs integrity constraints(e.g. account balance > 0) become buried in program code rather than being stated explicitly

=> with DBMS, easy to enforce ICs as well as add/update/delete ICs

5. Atomicity of updates (all or nothing property)

ex) transfer of funds from one account to another should either be completed or not happen at all

6.Concurrent access by multiple users

=>uncontrolled concurrent accesses can lead to inconsistencies

ex) two people reading a balance and updating it by withdrawing money at the same time => dbms will provide consitancy

7.Data Security

8.Data backup and recovery

9.Isolation 독립적으로 user1은 select, user2는 insert 할 수 있게함.

 

Databases vs file systems 

1. Access 

File Systems: provide block-level or file-level access. Operations like open, close, read, write, and lseek in UNIX give you byte-level control over files, but no built-in support for structured data or complex queries.
Databases: Provide row-level or even field-level access. Allow complex querying, filtering, and aggregation using SQL or other query languages.


2. Concurrency control

File Systems: Concurrency is typically managed at the file or block level. Concurrent writes to the same file might lead to conflicts or data corruption without careful handling.
Databases: DBMSs come with built-in concurrency control mechanisms, ensuring that multiple users can safely read and write to the database concurrently without causing data inconsistency.

3.Data Integrity
File Systems: The responsibility of maintaining data consistency and integrity falls entirely on the user or application. There's no built-in support for ensuring data integrity.
Databases: Offer mechanisms like primary keys, foreign keys, constraints, and transactions to ensure data integrity.

 

4.Backup and Recovery
File Systems: Backup typically involves copying files to another location. Recovery from failure might mean losing some recent changes unless you've implemented a custom logging mechanism.
Databases: Many DBMSs have built-in backup and recovery mechanisms, including support for point-in-time recovery, log-based recovery, etc.

 

5.Data Redundancy
File Systems: Different applications might maintain their own versions of data, leading to redundancy and potential inconsistency.
Databases: A central DBMS ensures a single, consistent source of truth.

 

6.Data Retrieval
File Systems: Retrieving specific pieces of data can require custom code to parse and filter files.
Databases: Allow for structured querying, indexing, and fast retrieval of data based on various criteria.


7.Security
File Systems: Security is usually at the file or directory level (e.g., UNIX permissions).
Databases: DBMSs offer fine-grained access control at the table, row, or column level. They also provide mechanisms for audit logging, encryption, etc.


8.Scalability
File Systems: Horizontal scalability can be a challenge, especially for distributed file systems.
Databases: Modern DBMSs, especially distributed databases, are designed for horizontal scalability and can handle massive amounts of data.

728x90