程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Introduction to Python development learning notes to understand the role of databases

編輯:Python

The point of this section

Understand the role of the database
The duration of this section needs to be controlled 5 Within minutes

The origin of database management software
Based on what we've learned before , If you want to keep the data forever , It's all in a file , without doubt , A file can only exist on one machine .

If we ignore the efficiency of accessing data directly based on files for the time being , And suppose all the components of the program run on one machine , Then use the file to access the data , No problem .

Unfortunately , All of these assumptions are made by yourself , The above hypothesis has the following problems ......

1、 It's impossible for all the components of a program to run on one machine

 Because once this machine fails, it means that the whole software will crash , And the efficiency of the program depends on the hardware that carries it , And the performance of a machine is always limited ,
Limited by the current level of hardware , There are limits to vertical expansion of a machine's performance .
So we can only enhance the overall performance of our system through horizontal expansion , This requires us to distribute the various components of the program to multiple machines to execute .

2、 Data security issues

 according to 1 Description of , We distribute the components of the program to each machine , But we need to know that each component is still a whole , Between the lines , The data of all components should be shared .
But the components on each machine can only operate the local files , This leads to data inconsistency .
So we thought of separating data from applications : Put the files in a machine , Then multiple machines will access the files on this machine through the network ( use socket Realization ),
That is to share the files on this machine , Sharing means competition , There will be data insecurity , Need to be locked ....

3、 Concurrent

according to 2 Description of , We have to write a socket The server manages this machine ( database server ) File on , And then write a socket client , Complete the following functions :

1. Remote connection ( Support concurrency )
2. Open file
3. Reading and writing ( Lock )
4. Close file

summary :

Before we write any program , Need to write a good network-based operation on a host file program (socket Server and client programs ), So someone wrote this kind of program as a
Specialized processing software , This is it. mysql The origin of database management software , but mysql It's not just about data sharing , And query efficiency , Security and so on ,
All in all , Freeing programmers from data management , Focus on writing your own program logic .


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved