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?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Qlemo"Batchelor", 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 ...
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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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?
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Qlemo"Batchelor", 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.
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.
>>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.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Oracle Database

From novice to tech pro — start learning today.