问题
Can I pin a table to oracle dbms_shared_pool in 11G? I see I cannot do it in 10g. the table has 4 number columns and around 100K rows, it is extremely high used and read-only(which means we will not insert or update once data is prepared).
I didn't find a way so come to here ask. also another question is can I pin a highly used stored procedure to dbms_shared_pool? what's their advantage and disadvantage? is it necessary?
回答1:
Pinning tables is a bit pointless. Oracle will keep data which is used a lot at the MRU end of the DB Buffer Cache, so it is extremely unlikely to be aged out. The advantage of letting Oracle manage this is that it retains only the popular blocks. Perhaps in your situation all 100K rows are in constant demand, but that would make your situation pretty unusual.
If you have 11g Enterprise Edition you can take advantage of result set caching which is even more focused and can offer some staggering performance improvements for certain types of query. The sort of table you describe would be an ideal candidate. Find out more.
The same applies to heavily used procedures. They don't get aged out.
Now, if you are seeing a lot of reloads of procedures you think should be pinned that suggets your database either is short of RAM or what RAM it has got is not allocated correctly.
回答2:
The way I understand it is yes if the query is exactly the same each time the result cache would be the way to go. But if you use the look up table in many different queries the results will not be available.. you would cache the whole table. Then any query that uses that table would use memory data and not IO physical read data.
回答3:
You can allocate memory to the "KEEP" buffer pool (parameter buffer_pool_keep) and then alter the table to put it in the keep buffer pool; that allows only tables in the KEEP pool to buffer data there, and so if you have only one table in the KEEP pool, and you size it at say 10 megabytes, in theory the whole table could be cached in memory.
alter table my_number_stuff storage( bupper_pool keep);
来源:https://stackoverflow.com/questions/15975921/how-to-pin-a-table-to-oracle-dbms-shared-pool-in-11g