Oracle 11g R2 – Will Inserting a Row Keep It in the Buffer Cache?

oracleoracle-11g-r2

I understand that selecting a set of rows from the database will make sure they remain in the buffer cache (assuming they fit).

Will inserting a set of rows make sure they are available to select from the buffer cache as well?

Context:
We are considering forcing the current-day partition of a table in the buffer cache, but if inserting rows will enter them into the buffer cache anyway, then there would be no need to make the extra effort. (Rows are entered with the current timestamp, never in the past or the future, partitioning is by day).

Best Answer

Since partitions have partition keys, when you insert the row, the partition key will need to be updated as well. This works well with range, range-hash partitions from my experience. So if your primary key is part of the partition, I would say it's not worth the effort to try to load the current day partition into memory, from my experience. I'm not quite sure why you would want to have an entire partition in memory. It seems that you would get far better performance, simply by just focusing on partition pruning and partition-wise joining, and parallelism. Inserts are much faster on partition tables than heap tables anyways, and the buffer cache will be used as long was it has to search for the key. If you want to test this out, run your process and monitor the X$BH view which gives you an object-by-object view of what's being located in the cache.