• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 145
  • Last Modified:

Library cache and database buffer cache.

Dear Experts,

I have a basic question, please help in understanding.

I understand library cache stores sqls in LRU mechanism,  
whenever a new sql is parsed, SQL will be loaded into library cache and the data block for the sql will be loaded into DB buffer cache.

My question is, will DB buffer cache will contain all the related data for all the sqls stored in library cache?
0
sakthikumar
Asked:
sakthikumar
2 Solutions
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
Cache and buffer are independent, but of course it is more likely to have data for cached plans in the data buffer, because those are used more often and have more "weight". It is much more complex in fact ...
0
 
slightwv (䄆 Netminder) Commented:
>>My question is, will DB buffer cache will contain all the related data for all the sqls stored in library cache?

I suppose there is a reason for the question.  I see this as more of a theoretical question over a practical one.

In theory: Sure.  Given a large enough SGA or small enough sql cache.

Very likely on a fresh cache.  Think about this:  You flush the shared pool and run a select statement.  Pretty good chance that everything will be cached.
0
 
sakthikumarAuthor Commented:
Yes right,
Suppose if I am running a query which is having a FTS on a very large table.
Then the datablocks for FTS will get occupied with other sqls' data.
That case we will not have data for all sqls.

Is my assumption correct?
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
Yes, correct. FTS data is not likely to get buffered at all, unless for small tables. Usage stats will tell other data is more important to keep.
0
 
slightwv (䄆 Netminder) Commented:
>>That case we will not have data for all sqls.

I'm still not seeing what you are attempting to answer with this question.

Are you attempting to understand how Oracle manages the different pieces of the SGA?

>>FTS data is not likely to get buffered at all

Small addition:  The blocks will be read into the buffer cache.  How long they remain there has a lot to do with what else is going on in the system.
0
 
sdstuberCommented:
>>FTS data is not likely to get buffered at all

The data is loaded into the LRU end of the cache, to ensure the FTS doesn't erase all other cached data.  In fact, each new block read (or set of blocks with multi-block reads)  overwrites the previous block(s).  Thus the only thing left in the buffer cache when you are done is the data from the last read of the table.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now