Hi
I'm testing In-Memory and my question is why the figures in v$im_segments differ from the used_bytes in v$inmemory_area?
I have read a lot of great posts (for example
https://blogs.oracle.com/in-memory/what-is-an-in-memory-compression-unit-imcu ) and it is always an exact match between those columns, but that isn't the case for me.
This is what I have done in my environment:
I have enabled In-Memory for 291 tables and materialized views of vairous size (but all big enough to be enabled)
ALTER TABLE/MATERIALIZED VIEW [table_name/materialized_view_name] INMEMORY MEMCOMPRESS FOR QUERY LOW PRIORITY CRITICAL
select count(*) from dba_tables where inmemory = 'ENABLED'
count(*)
291
I wait some time to let all the data be populated into In-Memory.
This is the result:
select count(*), sum(bytes), sum(inmemory_size) from v$im_segments
count(*) sum(bytes) sum(inmemory_size)
233 6351224832 2660237312
Only 233 with a total size of approximately 2550 MB.
Let us take a look at v$inmemory_area:
select pool, alloc_bytes, used_bytes, populate_status from v$inmemory_area;
pool alloc_bytes used_bytes populate_status
1MB POOL 3421503488 3421503488 OUT OF MEMORY
64KB POOL 855638016 32505856 DONE
I of course realize after the v$inmemory_area query that I don't have enough memory allocated, but if only taking a look at v$im_segments it isn't obvious.
So what is the reason for the difference between inmemory_size and used_bytes?
Can I only from v$im_segments calculate how much amount of memory currently used in the 1MB pool?
Thanks in advance
There's a bug in the display of out-of-memory segments in v$im_segments. From MOS note 18549042.8:
Out of memory status is not shown in view V$IM_SEGMENTS.
Rediscovery Notes
View V$IM_SEGMENTS shows status STARTED for a table which does not fit in memory.
The populate status may incorrectly remain STARTED after a failure.
Additionally, there is no out-of-memory status. It should show an
indication that it is not possible to load the table completely in memory.
The fix of this bug adds an out-of-memory status for populate enabling V$IM_SEGMENTS
view to display the out-of-memory status.
The populate status is tracked by taskid, ensuring no false STARTED status.
Workaround
The undocumented view V$INMEMORY_AREA shows correctly the status OUT OF MEMORY
for one memory pool. This view can be used instead of V$IM_SEGMENTS.
This may explain why you're seeing the difference. A fix for this is available in the 12.1.0.2.170117 (Jan 2017) Database Proactive Bundle Patch.
If you've already applied this, or find you still have the problem after applying let us know. Please provide a test case showing how we can reproduce the problem when you do!