How lookup works in Database? : <p>I'm trying to understand how lookups works in database. In database everything is on disk in file system.</p>

<p>So lets say If I query a data in table having millions of records with some filter clause, then all records will be loaded into memory first then 
it looks for specific data or something else happens ? Correct ?</p>

<p>My understanding says, What ever the query we run, all database table's data gets loaded into memory and then do the operations. Is it correct ?</p>

<p>Secondly, If I'm having 8gb of data in table and 4gb ram, That will work to get data from Database ? Usually it works, but Does it search on disk ? Really ? </p>

<p>Please share your views.</p>

<p>Thanks</p>
