开发者_如何学PythonI am wondering whether the index will be fully loaded into memory or not?
The answer to this is in several parts:
- The size of the index.
- What parts are accessed.
- Memory pressure.
I had a huge index on a table that took SQL Server a full 3 minutes to return the first result. Second query (different request) was about one minute. Third query was 20 seconds. Eventually all results came in 0.001 seconds.
The point? SQL Server cached the index in memory as it was being read.
However, if I had put other memory pressure on SQL Server, it would have dropped out those cached index pages by order of lowest reads.
No, it's treated like any other data stored on disk. It's loaded into memory disk page by disk page. And a page stays in memory as long as it's regularly accessed.
Database server cache in the memory pages (or blocks), not objects (tables, indexes). If all index pages loaded often they return in the memory.
精彩评论