What is cpu_time in v$sqlarea
Hi,
I am trying to balance the cpu_time column found in v$sqlarea compared with cpu_used_by_this_session found in v$sysstat. I am finding that the cpu_time numbers in v$sqlarea far exceed the value in v$sysstat by a huge factor.
To try and qualify the cpu_time for a given piece of SQL I used the following formula:
CPU Hours = cpu_time / 100 / 60 / 60 / cpu_count
I end up with a value of 4600 hours for a piece of SQL that ran in less then 24 hours. The value for this single piece of SQL dwarfs the total cpu time shown in v$sysstat.
I'm very confused. Any help or clarification on cpu_time within v$sqlarea would be greatly appreciated.
Thank you.
I appreciate the response. I don't know that cpu_time and elapsed_time is in microseconds (I haven't seen that documented but I'll continue to check), still I tried the calculation as though it were. Here are the results, with a couple other related metrics for the same SQL:
Metric From v$sqlarea Calculated
CPU Time 14,408,422,727 14.3 CPU Hours
Elapsed Time 24,548,346,796 24.4 Hours
Buffer Gets 226,606,878
Disk Reads 44,401,607 The process that uses this SQL is run daily and does not take 24.4 hours elapsed time. Even assuming microseconds these numbers are too high, although they come closer to within reason.
Still confused and looking for further clarification.
Thanks.
Similar Messages
-
Hi,
What is Buffergets in V$SQLAREA? Explain in detail..
Will the high buffergets by the cursors affects the performance of other SQL queries?
Thanks,
Vijayanand.Hi,
A 'buffer get' is how a user's server process accesses data in the buffer cache. A buffer get is the act of copying the contents of a particular buffer in the buffer cache (SGA) to that process's private memory (PGA). Buffer gets are essentially the unit of work, when executing a SQL statement. Regardless of the access path or execution plan, ultimately, the data will need to be read from the buffer cache. The act of doing that is a buffer get. Minimizing the number of buffer gets is the very essence of performance tuning a query.
Buffer gets can be in current mode or consistent mode. More information on the difference can be found here:
http://www.mail-archive.com/[email protected]/msg87726.html
Hope that helps,
-Mark -
What's unit of CPU_TIME & ELAPSED_TIME columns in v$sqlarea
Hi,
Oracle 9.2.0.4 on Solaris 9.
What is the time unit of CPU_TIME & ELAPSED_TIME columns in v$sqlarea?
The Database Reference says it is in microseconds (1/1000 seconds?).
My java code would get the query result even before the database engine finishes parsing the query string. Either the doc is wrong, or the data in the v$sqlarea is not right.
It seems to me that the unit should be 1/1000000 seconds.
Anybody knows what the unit really is in those columns?
Thanks,
HarryAnyone any idea by what logic "10s of milliseconds" can translate to .000001 seconds?
I can see how it could mean .01 seconds (10 times a millisecond) or .0001 seconds (a tenth of a millisecond), but .000001 seconds seems a long way off.
Would you remember where you found those numbers? -
I've found this page
[http://www.billmagee.co.uk/oracle/sqltune/080_identify.html]
in which is said:
BUFFER_GETS Cumulative total of memory blocks read for this statement
so if I want to see how many blocks a query read per execution I must do ((disk_reads+buffer_gets)/executions) as suggested from the query on the same page.
select sql_text,
executions,
to_char((((disk_reads+buffer_gets)/executions) * 8192)/1048576,
'9,999,999,990.00') as total_gets_per_exec_mb,
to_char((( disk_reads /executions) * 8192)/1048576,
'9,999,999,990.00') as disk_reads_per_exec_mb,
to_char((( buffer_gets /executions) * 8192)/1048576,
'9,999,999,990.00') as buffer_gets_per_exec_mb,
parsing_user_id
from v$sqlarea
where executions > 0
order by 6 descThis is correct?
Buffer gets refers only to the block found in the buffer cache (not loaded from disk) or to the total amount of db block on which the query works (indipendetly if they are found immediately in the buffer cache or must be read from disk) ?
Hope you can help me.
Thanks
Adriano AristarcoYes, the index is appearing on the dba_indexes table, however its state is 'UNUSABLE'.
It looks impdp takes its state from origin metadata, puts into destination, and even is not trying to rebuild it.
Of course, after running ALTER INDEX REBUILD its status was changed to VALID.
So, what's the point impdp tells about its state? It can be hundreds of unusable indexes, why it's not just rebuilding it? -
Question on SQL_TEXT from v$sqlarea
Windows 2003
Oracle 9.2.0.6.0
I have a number of DML statements I want to run dynamically. I have a PLSQL proc which generates the statements and populates a tracking table with them. It then selects from the tracking table and executes each statement dynamically with a status field against each statement. a pretty simple cursor loop.
All the statements are deletes with a bitmap index hint to delete where delete_flag = Y.
delete /*+ INDEX(<bitmap index name on delete_flag>) */ table_name WHERE delete_flag = 'Y'
several hundred of these. before it runs for each statement I update the tracker table with "running" for that statement so I know which table its running against. 1 of the tables seems to be hung for a long time. hours. I would have expected the delete of this particular table to run in minutes tops. Theres maybe 1 mill rows in the table with 300k rows to be deleted.
explain plan for that statement is good, uses the index as expected with a low costing.
So I started to dig around.
Looking at the waits for this session every few seconds, it seems to be progressing through the blocks so no waits in partiuclar to worry about.
I then happen to check the SQL for that session (nothing else running on the DB while this procuedre is running)
select sesion.sid,
sesion.username,
optimizer_mode,
hash_value,
address,
cpu_time,
elapsed_time,
sql_text
from v$sqlarea sqlarea, v$session sesion
where sesion.sql_hash_value = sqlarea.hash_value
and sesion.sql_address = sqlarea.address
and sesion.username is not null And the SQL_TEXT returned is not the SQL that was submitted dynamically. the table is correct but its using the primary key to delete.
DELETE FROM hung_table_name WHERE PK_FIELD = :B1
Can anyone explain why Im seeing that delete statement and not the one submitted dynamically?I can understand guys saying I cant be absolutely sure nothing else is running based on the SQL, but I am sure.
its a small shop, no apps coming in, 1 other dba, 2 developers, no scheduled jobs in the database, no scheduled job on the OS, no other users on.
The tracker table that Im populating has a few hundred statements in it, dynamically generated from a cursor theyre all
step, command, status
1, delete /index hint/ from table1 where delete_flag=Y, Pre
2, commit, Pre
3, delete /index hint/ from table2 where delete_flag=Y, Pre
4, commit, Pre
5, delete /index hint/ from table3 where delete_flag=Y, Pre
and so forth....
Theres no room for anything else to get in, let alone a well constructed command to delete by the primary key.
In the PLSQL, the cursor is select command from tracker_Table order by step
for i in cur
update tracker_table set status ='running' where command = i.command
execute immediate 'i.command';
update tracker_table set status ='complete' where command = i.command
As the entire job takes 2 days (yes, Im trying to come up with a better way and I didnt write this one), this method works for tracking where the job is. At the time this particualr table is getting stuck, the status is set to 'running' for the same table that I see the 2 statements for the in sql_text.
1 which is the statement with the index hint and a non matching hash value in v$session. And 1 statement which Ive shown deletes by the PK where the hash value matches the hash value of the session thats running the delete statement.
Ive never seen that before in a view (sql area)I would have queried many times over the years.
So, unless I can see otherwise, Im going with my earlier instinct that the query is being rewritten to delete by PK based on what sybrand said about the 9i explain. Still doesnt explain for me the other SQL with the non matching hash value though.
Or better turn on sql trace in 1-st session as it was already advised and then look into trace file.see earlier post, its taking hours and not returning so cant get a good trace. -
Running thread - which statement to get to know what this thread is doing
Hallo,
I have a thread in my database running.
Normally the action I am doing with this thread lasts 1 hour. Now it is working for 3 hours.
How can I get to know what my thread is doing and how long this will last? Which statement can I use?
Thanks in advance, JadexyThis query shows what a session is doing:
select s.sid
,(a.APPLICATION_WAIT_TIME / 1000000) as APPLICATION_WAIT_TIME
,(a.CONCURRENCY_WAIT_TIME / 1000000) as CONCURRENCY_WAIT_TIME
,(a.CLUSTER_WAIT_TIME / 1000000) as CLUSTER_WAIT_TIME
,(a.USER_IO_WAIT_TIME / 1000000) as USER_IO_WAIT_TIME
,(a.CPU_TIME / 1000000) as CPU_TIME
,(a.ELAPSED_TIME / 1000000) as ELAPSED_TIME
,a.ROWS_PROCESSED
,a.disk_reads
,a.buffer_gets
,a.direct_writes
,a.optimizer_mode
,a.sql_text
from v$session s, v$sqlarea a
where s.sid = &YOUR_SESSION_ID
and a.sql_id = s.sql_id
order by 1
Times are shown in seconds. -
Possible to find session/user who ran SQL in v$SQLAREA ?
Using this:
select * from v$sqlarea where sql_text like '%2412982%' and sql_text like '%prms%' and module != 'sqlplusw.exe';
I am able to locate a particular instance of a piece of SQL being executed and stored in the library cache.
However, I would really like to know who run it but I never "catch them".
Is there a way?
1* select * from v$sqlarea where sql_text like '%2412982%' and sql_text like '%prms%' and module != 'sqlplusw.exe'
SQL> /
SQL_TEXT
SHARABLE_MEM PERSISTENT_MEM RUNTIME_MEM SORTS VERSION_COUNT LOADED_VERSIONS OPEN_VERSIONS USERS_OPENING FETCHES EXECUTIONS USERS_EXECUTING LOADS FIRST_LOAD_TIME INVALIDATIONS
PARSE_CALLS DISK_READS BUFFER_GETS ROWS_PROCESSED COMMAND_TYPE OPTIMIZER_MODE PARSING_USER_ID PARSING_SCHEMA_ID KEPT_VERSIONS ADDRESS HASH_VALUE
MODULE MODULE_HASH ACTION ACTION_HASH SERIALIZABLE_ABORTS CPU_TIME ELAPSED_TIME I
CHILD_LATCH
select it.company, it.product, p.description, it.transaction_code, ifsapp.km_util_api.conv_to_date_fmt(it.company,to_date(it.transaction_date,'YYYY-MM-DD')) order_date, it.reference, it.wareh
ouse_id warehouse, it.transaction_quantity, it.inventory_unit_of_measure, it.location_aisle, it.location_row, it.location_tier, it.lot_identifier, it.user_profile, it.reference_2, it.referenc
e_3 from ifsapp.prms_inventory_transaction it, ifsapp.prms_product p where it.company=p.company (+) and it.product=p.product (+) and it.company=upper('OKM') and ((it.lot_identifier like upp
er('%2412982%')) or ('' is not null and it.lot_identifier like upper('%%')) or ('' is not null and it.lot_identifier like upper('%%')) or ('' is not null and it.lot_identifier like upper('%%')) or
('' is not null and it.lot_identifier like upper('%%'))) and (('' is null or rtrim(it.product)=upper('')) or (rtrim(it.product)=upper('')) or (rtrim(it.product)=upper('')) or (rtrim(it.product)=
8328 3616 17240 1 1 0 1 1 1 1 0 1 2006-09-28/08:47:09 0
1 134719 134846 0 3 CHOOSE 166 166 0 07000004A8D88FB0 1040757058
Repetitive Distribution.exe 0 0 0 34410000 58880847 N
3I think the SQL listed is wrong, as it only display the SQL created by Oracle whenever the user login, which is:
SELECT DECODE('A','A','1','2') FROM DUAL
And all subsequent SQL issued by the user during the session is not listed.
I am also in the midst of trying of get the user issuing the SQL :-).....MANY THANKS AHEAD.... -
Oracle 8i: full sql text in v$sqlarea
I work with oracle 8i.
is there a v$... that shows the execution plan for a query.
in thev$sqlarea there isn't the full_sqltext column, and I need to know what oracle is doing now.
Message was edited by:
user596611v$sqltext_with_newlines will produce multiple rows per statement.
You'll need an inline view
select t.hash_value, t.sorts, t.executions, t.buffer_gets, t.disk_reads, tn.sql_text
from v$sqlarea t,
(select hash_value,sql_text
from v$sqltext_with_newlines
order by hash_value, piece) tn
where sn.hash_value = t.hash_value
Sybrand Bakker
Senior Oracle DBA -
How do I find out what is being captured and applied?
Hi,
I have the following issue i'm trying to understand.
My test 2-way streams setup (10.2.0.3 on windows) was stopped/broken for some weeks. I got around to starting to fix it yesterday. Since then its been sat there scanning through logs starting from the 21st of May 2007 (and still on the 21st). There are large number of messages being captured queued and propagated (8378901+ at the mo). This would make some sense if there had been constant changes going through for the past weeks but there haven't. I've created and dropped a table, inserted a couple of rows, and maybe created an index but thats it.
So what is going on?
Is there a way to peek into the queues and see the contents of these messages?
How do I find out what its doing and why?Hi,
You can know what is being applied using the following query:
select sid, event, p1, p2, state, seconds_in_wait, sq.SQL_ID, sql_text
from v$session s, v$sqlarea sq
where sid in (select sid
from v$streams_apply_coordinator
union all
select sid
from v$streams_apply_reader
union all
select sid
from v$streams_apply_server) and s.sql_id = sq.sql_id
AAN -
SQL_FULLTEXT Column of v$sqlarea
All,
What do I need to do so that the full text stored in sql_fulltext column of v$sqlarea is displayed.
At the moment, when I run the following sql:
select SQL_FULLTEXT from v$sqlarea
where sql_id='0n6x4f5kaaymb';
I get the output below:
SQL_FULLTEXT
SELECT INSTALLED_APP_ID, ORIGINATED_DATE, APPLICATION_ID, RECEIVED_DATE, EFFECTI
Thanks in advance
BaffySQL> select SQL_FULLTEXT from v$sqlarea
2 where sql_id='2j0qhrtccbz4u'
3 /
SQL_FULLTEXT
SELECT GA.VALUE FROM SYS.SCHEDULER$_GLOBAL_ATTRIBUTE GA, OBJ$ GO WHERE GA.OBJ# =
SQL> set long 999999999
SQL> select SQL_FULLTEXT from v$sqlarea
2 where sql_id='2j0qhrtccbz4u'
3 /
SQL_FULLTEXT
SELECT GA.VALUE FROM SYS.SCHEDULER$_GLOBAL_ATTRIBUTE GA, OBJ$ GO WHERE GA.OBJ# =
GO.OBJ# AND GO.NAME = 'LOG_HISTORY' -
Hi, the following is my question :
1) I know that oracle can keep track each update to the database table like the update command.
e.g. update tableA
set block = 'Y'
where user_id = 'XXX';
But is there any other table i can select the cached SQL other than v$sqlarea and v$sql.
I am able to select update command from 5 days ago using the v$sqlarea. But if i would like to select the SQL command which i executed more than 5 days ago then what should i do ? Is it any parameter that can be set to configure the no of day to store the old sql text in v$sqlarea.
regards,
KongMaybe you can look at auditing?
see http://technet.oracle.com/docs/products/oracle9i/doc_library/release2/server.920/a96521/audit.htm#1108 -
Hello Experts ;
I am testing few things on pl-sql supplies packages (DBMS_SHARED_POOL.PURGE )
but i have few doubts please clear my doubt.
<< On Terminal 1 >>
SQL>desc tab1;
Name Null? Type
NO NUMBER
NAME VARCHAR2(15)
EMAIL VARCHAR2(15)
CITY VARCHAR2(15)
SQL>select count(*) from tab1;
COUNT(*)
300000
SQL>select * from t ab1;
In Process
<< On Terminal 2 >>
SQL. conn /as sysdba
Connected.
SQL>select sql_text,address, hash_value, executions, loads, version_count, invalidations, parse_calls from v$sqlarea
where sql_text ='SELECT * FROM TAB1';
no rows selected
Why i did n't get values in terminal 2 , when query running on terminal 1;
MY DB VRSION IS : 10.2.0.1.0
Thanks in dvance ..@BCV
i got 268 lines ..then i have created spool file . i am pasting output for following query..
SYS>select * From v$sqlarea
2 order by FIRST_LOAD_TIME desc;
SQL_TEXT
--------------------------------------------------------------------------------SQL_FULLTEXT
--------------------------------------------------------------------------------SQL_ID SHARABLE_MEM PERSISTENT_MEM RUNTIME_MEM SORTS VERSION_COUNT
LOADED_VERSIONS OPEN_VERSIONS USERS_OPENING FETCHES EXECUTIONS
PX_SERVERS_EXECUTIONS END_OF_FETCH_COUNT USERS_EXECUTING LOADS
FIRST_LOAD_TIME INVALIDATIONS PARSE_CALLS DISK_READS DIRECT_WRITES
BUFFER_GETS APPLICATION_WAIT_TIME CONCURRENCY_WAIT_TIME CLUSTER_WAIT_TIME
USER_IO_WAIT_TIME PLSQL_EXEC_TIME JAVA_EXEC_TIME ROWS_PROCESSED COMMAND_TYPE
OPTIMIZER_ OPTIMIZER_COST
OPTIMIZER_ENV
--------------------------------------------------------------------------------OPTIMIZER_ENV_HASH_VALUE PARSING_USER_ID PARSING_SCHEMA_ID
PARSING_SCHEMA_NAME KEPT_VERSIONS ADDRESS HASH_VALUE OLD_HASH_VALUE
PLAN_HASH_VALUE MODULE
--------------- ----------------------------------------------------------------MODULE_HASH ACTION
ACTION_HASH SERIALIZABLE_ABORTS
OUTLINE_CATEGORY CPU_TIME
ELAPSED_TIME OUTLINE_SID LAST_ACT R
OBJECT_STATUS LITERAL_HASH_VALUE LAST_LOAD I CHILD_LATCH
SQL_PROFILE PROGRAM_ID
PROGRAM_LINE# EXACT_MATCHING_SIGNATURE FORCE_MATCHING_SIGNATURE LAST_ACTI
BIND_DATA
select * From v$sqlarea order by FIRST_LOAD_TIME desc -
V$sql and v$sqlarea
Go no replies under DB General, trying over here.
I am trying to understand parsing_user_id and child_number in v$sql and how the numbers roll up into v$sqlarea. Here are some examples:
SQL> select hash_value, parsing_user_id, child_number, executions, disk_reads, first_load_time
2 from v$sql
3 where hash_value = 4282625122;
HASH_VALUE PARSING_USER_ID CHILD_NUMBER EXECUTIONS DISK_READS FIRST_LOAD_TIME
4282625122 0 0 525498 0 2003-05-18/01:59:40
4282625122 0 1 507702 0 2003-05-18/01:59:40
4282625122 134 2 436535 68546 2003-05-18/01:59:40
SQL>
SQL> select hash_value, parsing_user_id, executions, disk_reads, first_load_time
2 from v$sqlarea
3 where hash_value = 4282625122;
HASH_VALUE PARSING_USER_ID EXECUTIONS DISK_READS FIRST_LOAD_TIME
4282625122 0 1469735 68546 2003-05-18/01:59:40
SQL>
SQL> select hash_value, parsing_user_id, child_number, executions, disk_reads, first_load_time
2 from v$sql
3 where hash_value = 4256986771;
HASH_VALUE PARSING_USER_ID CHILD_NUMBER EXECUTIONS DISK_READS FIRST_LOAD_TIME
4256986771 119 0 22126 93 2003-05-18/00:51:00
4256986771 28 1 11018 562 2003-05-18/00:51:00
4256986771 26 2 43804 215 2003-05-18/00:51:00
SQL>
SQL> select hash_value, parsing_user_id, executions, disk_reads, first_load_time
2 from v$sqlarea
3 where hash_value = 4256986771;
HASH_VALUE PARSING_USER_ID EXECUTIONS DISK_READS FIRST_LOAD_TIME
4256986771 119 76948 870 2003-05-18/00:51:00
Given that uid 0 is SYS, and that each hash_value identifies the same unique sql statement and SGA address, and the second example shows what I would expect when multiple users execute the same cached sql:
1. Why does the first one report the actual app user (134) associated with child 2, and uid 0 children (0 and 1)?
2. How do the SYS (puid=0) records get created?
3. Why are there no stats other than executions associated with the puid of 0? (I just included disk_reads as an example). Are the numbers in v$sqlarea correct?
Insight appreciated.So, kindly let me know the retention period of the queries in the v$sql or v$sqlarea.They remain in SGA, until Oracle overwrites them.
There is no "rule" on how long or how little they exist. -
V$sqlarea and ROWS_PROCESSED
Hii all
when I looking v$sqlare for a statement that is I suspect to create so much redo, the Statement is updating a table row (there is not index on table)but ROWS PROCESSED' value is almost 138 million but table has only 15.000 row also executions value is 13000 How it could be possible ? Pls explain what is the exact mean is ROW PROCESSED and EXECUTIONS colums in the v$sqlarea ? if there is index on table when updating a table, row_processed could be higher than actual updated rows ?
10.2.0.4 On AIX
Best RegardsThese values are totals across all executions of the statement whilst it has been in the SQL area:
executions:- Total number of executions, totalled over all the child cursors
rows_processed:- Total number of rows processed on behalf of this SQL statement
You could try looking in the AWR data (dba_hist_sqlstat - 10G and above) to view more granular information about this SQL_ID after each snapshot (it records the values for the snapshot period i.e. delta's), if it really is executed so often it will more than likely have been captured by AWR.
Thanks
Paul -
How do I find out what I'm doing in a package ? v$sql ? etc.
I'm running Linux and trying to find out at what point a process is at.
It is running a procedure in a package, lets say. Package_main.main(). If I join v$session to any of v$sql,v$sqlarea,v$sqltext all I get is the sql text relating to the "package_main.main()" call. I want to find out what point in the PL/SQL statck the execution is : what view should I be looking at ?
johnnie dI believe the problem you are describing has been identified as a design feature for 10g+. I have not spent any time looking at the issue.
If you do not need immediate access but want to see what a session was doing you might be able to turn on sql trace for an active session and then review the trace file after you have allowed the trace to run long enough to capture what SQL is being executed.
Being that all SQL would have a child cursor there should be a way to tie sql from within pl/sql being executed to the session executing the stored code. I just have not looked into this. Maybe someone else has.
HTH -- Mark D Powell --
Maybe you are looking for
-
How to send e-mail using java mail api
Hi can anyone tell me how to send mail using the javamail api, in short if possible an example code.
-
Where is the drop down for bookmarks toolbar?
On old version I could hit a drop down to access complete toolbar list for bookmarks. Now drop down has everything but the extended toolbar file. How do I get it back?
-
hi, i had an ipod video, it got stolen,got an itouch 1 64g lost that in flood w /windows laptop. had acct saved on extrl hard drive cant transfer acct. asking for latest version of itunes 11.1 tried downloading and it asked for all my ccard info barr
-
Script to add a new page in LiveCycle
I am new to LiveCycle so please forgive my ignorance. I have 2 things I am trying to do. 1. In my fillable form, I want to have default text in the the form field that appears in light gray and disappears automatically when a user clicks in the field
-
Converting WAV files to MP3 files
I have a USB turntable for converting my vinyl records to digital. When the files are imported to itunes they are large WAV files. I there a way to set up itunes to automatically convert the WAV files to MP3 files?