Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: What is the better session memory used stat; UGA or PGA?
What is the better session memory used stat; UGA or PGA?Quote from AskTom
Forum. Try pmap -x.
<quote>
The User Global Area (UGA) is memory that is associated with a user session.
The UGA normally comes from the SGA to allow migration of sessions across
processes. If session migration is disabled, UGA memory will be allocated
from
the PGA.
The Process Global Area (PGA) is memory which is physically private to a
process
(cannot be accessed by another process). Note that an OS process and an
Oracle
session are not equivalent. The PGA, unlike the SGA, can grow at runtime.
So, in dedicated server mode, when session migration is not needed, the UGA
is
in the PGA is in the individual process.
It looks like you are using Solaris. On Solaris, ps, top and other tools
are
virtually useless for looking at memory usage of Oracle processes. They
report back not only the process memory but all shared memory attached by
the
process. You are seeing much of the SGA as well as process memory in that
report.
You should investigate the /usr/proc/bin/pmap utility instead. It'll report
back the breakdown of memory, showing shared memory segments and shared data
from .so files and the like.
</quote>
<quote>
We use UGA memory in dedicated server mode. It is just where is the UGA
located
-- in dedicated server mode, it's in the PGA. In shared server mode, it's
in
the SGA.
If you have my book -- i describe these structures in some detail, here is a short extract:
...
PGA and UGA
As stated earlier, the PGA is a process piece of memory. This is memory
specific
to a single operating system process or thread. This memory is not
accessible by
any other process/thread in the system. It is typically allocated via the C
run-time call malloc(), and may grow (and shrink even) at run-time. The PGA
is
never allocated out of Oracle's SGA - it is always allocated locally by the
process or thread.
The UGA is in effect, your session's state. It is memory that your session
must
always be able to get to. The location of the UGA is wholly dependent on how
Oracle has been configured to accept connections. If you have configured
MTS,
then the UGA must be stored in a memory structure that everyone has access
to -
and that would be the SGA. In this way, your session can use any one of the
shared servers, since any one of them can read and write your sessions data.
On the other hand, if you are using a dedicated server connection, this need
for universal access to your session state goes away, and the UGA becomes
virtually synonymous with the PGA - it will in fact be contained in the PGA.
In
fact, when you look at the system statistics, you'll find the UGA reported
in
the PGA in dedicated server mode (the PGA will be greater then or equal to
the
UGA memory used, the PGA memory size will include the UGA size as well).
</quote>
For more info:
HTH
Dimitre Radoulov
ENV;
UGA is part of the PGA, and PGA part of the SGA. Which is the better stat for session memory (currently) used? I think and am finding UGA as the answer...but don't want to ignore the higher PGA number I see, considering what the PGA holds.
SELECT
e.SID, e.username, e.status, a.UGA_MEMORY, b.PGA_MEMORY
(select y.SID, TO_CHAR(ROUND(y.value/1024),99999999) || ' KB'
UGA_MEMORY from v$sesstat y, v$statname z where y.STATISTIC# = z.STATISTIC#
and NAME = 'session uga memory') a,
-- Current PGA size for the session.
(select y.SID, TO_CHAR(ROUND(y.value/1024),99999999) || ' KB' PGA_MEMORY from v$sesstat y, v$statname z where y.STATISTIC# = z.STATISTIC# and NAME = 'session pga memory') b,
v$session e
WHERE e.sid=a.sid
AND e.sid=b.sid
ORDER BY
e.status, a.UGA_MEMORY desc
SID USERNAME STATUS UGA_MEMORYPGA_MEMORY
---------- ------------- ------------------------ -------------------- -------------------- 190 SCOTT ACTIVE 14723 KB 17243 KB 25 SYS ACTIVE 2205 KB 401 KB 80 WEBUSERS ACTIVE 422 KB 1616 KB 50 ACTIVE 37 KB 11532 KB 222 ACTIVE 37 KB 8412 KB 169 ACTIVE 37 KB 6370 KB 217 ACTIVE 36 KB 115 KB 16 ACTIVE 36 KB 4255 KB 3 ACTIVE 36 KB 2030 KB 15 ACTIVE 36 KB 4255 KB 19 ACTIVE 36 KB 1366 KB 1 ACTIVE 36 KB 115 KB 11 ACTIVE 35 KB 3443 KB 9 ACTIVE 34 KB 1558 KB 2 ACTIVE 33 KB 208 KB 4 ACTIVE 33 KB 2951 KB 5 ACTIVE 33 KB 3918 KB 10 ACTIVE 33 KB 8439 KB 7 ACTIVE 33 KB 3918 KB 133 WEBUSERS INACTIVE 1653 KB 2546 KB 61 WEBUSERS INACTIVE 1422 KB 2336 KB 194 WEBUSERS INACTIVE 565 KB 1901 KB 154 WEBUSERS INACTIVE 511 KB 1902 KB 22 WEBUSERS INACTIVE 491 KB1853 KB
Thanks,
Chris Marquez
Oracle DBA
-- http://www.freelists.org/webpage/oracle-lReceived on Tue Oct 25 2005 - 14:18:43 CDT