Physical paging and logical paging, physical paging logical Paging
1 Overview 1. Physical Paging
Physical paging depends on a physical entity, which is a database. For example, MySQL database provides the limit keyword. Programmers only need to write SQL statements with the limit keyword, the database returns paging results.
2. Logical Paging
Logical paging depends on the Code Compiled by the programmer. The database returns not paging results, but all data, and then the programmer obtains paging data through code. A common operation is to query all data from the database at one time and store it in the List set, because the List set is ordered, data in the specified range is obtained based on the index.
Ii. Comparison 1. Database burden
The physical pages access the database each time, and the logical pages only access the database once. The physical pages impose a high burden on the database.
2. server load
Logical paging reads data to the memory at a time, occupying a large amount of content space. Physical paging reads only a portion of data at a time, consuming less memory space.
3. Real-time
The data is read to the memory in one operation by logical paging, and the data changes. The latest database status cannot be reflected in the operation in real time, resulting in poor real-time performance. Each time data is required for physical paging, the database is accessed to obtain the latest database status, which is highly real-time.
4. Applicable scenarios
Logical paging is mainly used when the data volume is small and the data is stable. Physical paging is mainly used when the data volume is large and frequently updated.