Scanning the database
You have learned that all SQL operations are carried out by database management systems (DBMSs) such as PostgreSQL. Typically, the DBMS will run these operations in a server’s memory, which holds the data to be processed. The problem with this approach is that memory storage is not large enough for modern databases, which are frequently in the scale of gigabytes, if not terabytes. Data in most modern databases is saved on hard disks and uploaded into memory when it is used in a database operation. Yet again, a DBMS can only upload a small part of the database into memory. Whenever it figures that it needs a certain dataset, it must go to the hard disk to retrieve the unit of storage (which is called a hard disk page or block) that has the required data in it. The process that the PostgreSQL server uses to search through the hard disk to locate the page is known as scanning.
SQL-compliant databases, such as PostgreSQL, provide several different methods...