PL/SQL :: Lag Function Cost Almost All Of CPU Resource

May 24, 2013

select *from v$version where rownum=1;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

prepare data:
CREATE TABLE a AS SELECT LEVEL ID ,decode(mod(LEVEL,10),1,'CODE'||LEVEL) CODE from dual CONNECT BY LEVEL<20001;

sql1:
CREATE TABLE TEST AS
SELECT ID,
NVL(CODE,LAG(CODE ignore nulls) OVER(ORDER BY ID )) CODE
FROM a;

the sql is slow,most of the waits on session is resmgr:cpu quantum and almost all of the cpu resource is occupied

sql2:
CREATE TABLE TEST AS
SELECT ID,
NVL(CODE,last_value(CODE ignore nulls) OVER(ORDER BY ID ROWS BETWEEN UNBOUNDED PRECEDING AND 1 PRECEDING)) CODE
FROM a;

this sql is fast

How lag function is implemented if the offset is not deterministic?

View 10 Replies


ADVERTISEMENT

Application Express Listener :: Using PL/SQL Procedure / Function In Resource Template (listener 1.1.3)

Feb 15, 2013

I'd like to call an existing function/procedure from a resource template. For example, I have a procedure called 'rest' with an out parameter of 'p_out' - how do I use this within a resource template?

At the moment I have defined the template as type 'PL/SQL Block' and with the 'GET' defined as:

begin
myschema.rest(:p_out);
end;

APEX_PUBLIC_USER has been granted 'all' on the procedure. The p_out is populated with a piece of text.

When I call this resource, I get a '500 Internal Error' returned. I've tried adding p_out as an X-APEX-FORWARD parameter, but nothing seems to work.

Query-based templates seem to work OK.

Using Listener 1.1.3 with Tomcat6.

View 0 Replies View Related

SQL & PL/SQL :: Units Of Cost?

Sep 28, 2010

I was questioned in an interview what is the unit of cost and based on what was it calculated.

View 1 Replies View Related

SQL & PL/SQL :: Sum (cost) Basing On ID Entered

Oct 1, 2012

my data :

id cost
aa_aa 100
ab_aa 100
bb_bb 100
ba_bb 100
ab_aa 100

I need to get my data as
if id like 'aa_%' then it should sum cost for ids for aa_aa and ab_aa and print only 1 row with putput as

id cost
aa_aa 300
If id is like 'ab_%' then it should sum up
ids only for ab_aa..
Output as:
id cost
ab_aa 200

View 7 Replies View Related

SQL & PL/SQL :: Finding The Cost Of Query

Sep 2, 2010

I am using oracle 10g, i want to know the cost of query. In the explain plan and by auto trace am able to get some query cost, but i dont know how to calculate the query cost.

How i will know the query is costly and take more time..? But i know about the hash table and nested tables in the explain plan.
Other than this how to calculate the query cost..?

View 5 Replies View Related

SQL & PL/SQL :: Query Is Using More Cost When Executing Using DB Link?

Oct 5, 2010

I am trying to insert data from 9i to 11g using db link with the below query but while doing so the select statement is going for a full table scan even though rowid is used. But when we execute the same select statement without this insert command it is using proper index. Similar issues I am facing for updates.

Query:

INSERT INTO /*+ APPEND */ emp@db_link
select *
from emp where rowid ='AAC2SmAIIAAAHQgAAZ'

View 6 Replies View Related

Performance Tuning :: Low Cost And High Cpu?

Jul 23, 2010

I am facing one performance issue, in which the query cost is very low compare to cpu cost and as a result the cpu always show the high graph.I am also attaching the gv$sql and gv$sql_plan data of this query.

This is the query:

SELECT PTLS.ITEMTYPE , PTLS.ITEMID , PTLS.STAGEID, TS.USERID, SUM(PREVIOUSHOURS) AS PREVIOUSHOURS, MIN(STARTDATE) AS STARTDATE, MAX(STARTDATE) AS ENDDATE FROM PROJECTTIMELOGSSTAGE PTLS, PROJECTTIMESHEETITEM PTSI, TIMESHEET TS WHERE PTLS.PROJECTID = :B2 AND TS.TIMESHEETID = PTSI.TIMESHEETID AND TS.USERID = :B1 AND PTSI.TIMESHEETID = PTLS.TIMESHEETID AND PTSI.ITEMTYPE = PTLS.ITEMTYPE AND PTSI.ITEMID = PTLS.ITEMID AND (PTSI.ISPWFITEM = 'N' OR PTSI.ISPWFITEM IS NULL) AND PTLS.ITEMTYPE NOT IN ('OtherTsk','NewTsk','Loc','Glb') AND (PTLS.ITEMTYPE, PTLS.ITEMID ) IN (SELECT ITEMTYPE, ITEMID FROM PROJECTTIMELOGSSTAGE PTLS1 WHERE PTLS1.PROJECTID = :B2 AND PTLS1.TIMESHEETID = :B3 ) GROUP BY PTLS.ITEMTYPE, PTLS.ITEMID, PTLS.STAGEID, TS.USERID

View 17 Replies View Related

What Is Oracle Cost-Based Optimizer

Jun 3, 2013

what is oracle Cost-Based Optimizer? Any material easy to follow?

View 3 Replies View Related

SQL & PL/SQL :: Strange Cost - Summary Lower Than Ingredients?

Aug 1, 2012

I've been experiencing strange Oracle behavior from time to time when using "explain plan". what could be the reason? (I'm going to create an Oracle ticket when I could find the cause...)

The total cost of a query was low (ex. ~500) while sub-parts of the query has high cost (ex. ~10000).I don't want to provide the query itself as the issue is observed for huge queries (like 2M characters!).The execution plan looks like this:

+- SELECT STATEMENT , ALL_ROWS, Cost 736
|
+--+- WINDOW SORT , Cost 736
|

[code]...

View 5 Replies View Related

Performance Tuning :: Difference Between Cost And Bytes

Aug 4, 2010

I am working on Tuning a Materialized view. I was getting an error saying ORA-12008: error in materialized view refresh path

ORA-12801: error signaled in parallel query server P002, instance hrms-stg-db01:HRSTG1 (1)
ORA-01652: unable to extend temp segment by 16 in tablespace TEMP1.

so i increased the temp size. I am trying out various hints to get it rectified. But i am not sure if i should go for less cost or less bytes.

View 1 Replies View Related

Performance Tuning :: High CPU Cost And Low Optimizer?

Jan 22, 2009

how to reduce the cpu cost for a query at query level.

View 10 Replies View Related

Multi Table Query For A Summary Cost?

Aug 24, 2007

I'm wanting to create a query that will give me a summary of parts and labor from work orders. However there are three tables. work_order, parts, labor. Sometimes there will only be parts, sometimes just labor, or sometimes both. Well my query will only return results when they are on both. Sample query is below. Do I need to create a temp table to gather the data or is there a way to do this with a sub query.

select work_order.wono, sum(parts.cost), sum(labor.cost)
from work_order, parts, labor
where
work_order.wono = parts.wono and
work_order.wono = labor.wono
group by work_order.wono;

View 5 Replies View Related

Performance Tuning :: How To Reduce Cost Of Query

Mar 21, 2013

I have Following wjich takes some minutes to executes i want to be tune so this query Executes fast.

Query :

SELECT a.CHDR_EXCH_CD ,TMHR_EXCH_TM_CD,'S' Sec_type,
round(SUM (Decode(csdt_Depo_Typ,'I',(Cal_Scheme_Rate(csdt_rsm_code,TO_DATE(:P_DT_FR,'DD-MM-RR'),csdt_stsc_cd,csdt_scp_qty)*csdt_scp_qty)-
(Cal_Scheme_Rate(csdt_rsm_code,TO_DATE(:P_DT_FR,'DD-MM-

[Code]...

Explain Plan Result :

Plan
SELECT STATEMENT ALL_ROWS
Cost: 1,669 Bytes: 67 Cardinality: 1
15 HASH GROUP BY
Bytes: 67 Cardinality: 1
14 CONCATENATION

[Code].....

After i see result , no 4 in explain plan result gives TABLE ACCESS FULL . i want to be indexing on that how to do this..

This table MG_COLL_SCP_DTL have index like this

CREATE UNIQUE INDEX CSDT_PK ON MG_COLL_SCP_DTL
(CSDT_CHDR_TRANS_NUM, CSDT_PROD_TYP, CSDT_TRAN_SR_NO, CSDT_CHDR_CDTL_COLL_TYP, CSDT_CHDR_CDTL_COLL_TYP_CD,
CSDT_STSC_CD, CSDT_CHDR_CLNT_CD, CSDT_CHDR_CLNT_TM_CD)

[Code]....

How to Reduce cost ???

View 4 Replies View Related

Server Administration :: To Find Out The Database Is Using Cost Based Analyzer

May 23, 2012

How to find out the database is using Cost based analyzer?

Currently database is set to ALL_ROWS.

SQL> show parameter optimizer_mode

NAME TYPE VALUE
------------------------------------ ----------- -----------
optimizer_mode string ALL_ROWS
SQL>
SQL>

View 3 Replies View Related

Performance Tuning :: Cost Of Query Is Brought Down But Taking Same Time

Sep 1, 2010

For an query, cost was 16Lakhs and was taking 30min, I brought down the cost to 1.5lakhs, but still it is taking 30min.

There were many outer joins and same table has been Used(FROM clause) 5 times in the query. I have introduced WITH clause, and brought down the cost.

View 7 Replies View Related

Performance Tuning :: Cost Calculation For Nested Loop Join

Mar 27, 2012

Following is the query on TPC-H schema.

explain plan for select
count(*)
from
orders,
lineitem
where
o_orderkey= l_orderkey.

The trace 10053 (as shown below) for this query shows nested loop join with Lineitem as outer table and Orders as inner table. It is effectively join on composite index (pk_lineitem) of Lineitem and unique index(Pk_orderkey) of Orders table. The cost calculation formula as given in the book as "outer table cost + cardinality of outer table * inner table cost " fails here. I am not able to understand this.

BASE STATISTICAL INFORMATION
***********************
Table Stats::
Table: LINEITEM Alias: LINEITEM
#Rows: 6001215 #Blks: 109048 AvgRowLen: 124.00
Column (#1): L_ORDERKEY(NUMBER)
AvgLen: 6.00 NDV: 1500000 Nulls: 0 Density: 6.6667e-07 Min: 1 Max: 6000000
[code]....

how the cost has been calculated. This does not follow the traditional nested loop cost formula as mentioned in the book.

View 7 Replies View Related

Server Administration :: CPU Use With Resource Manager

Sep 21, 2011

I have a question:

With this plan active
PLAN GROUP_OR_SUBPLAN TYPE CPU_P1 CPU_P2 CPU_P3
x_PLAN x_APP_GROUP CONSUMER_GROUP 75 0 0
x_PLAN x_BO_HIGH_GROUP CONSUMER_GROUP 10 0 0
x_PLAN x_BO_LOW_GROUP CONSUMER_GROUP 5 0 0
x_PLAN OTHER_GROUPS CONSUMER_GROUP 10 0 0

if there is only an user of X_APP_GROUP that is working in a specified moment, he will use the 100% of CPU or il will be limited at 75% as specified in the plan?

View 1 Replies View Related

Security :: Resource Access Descriptor And SSO

Sep 22, 2010

I am trying to get to where I can add a RAD (Resource Access Descriptor) to allow connection to an oracle database. Right now I have "No Configuration Privilege" when logging onto Oracle Identity Management.

How to I get to the configuration tab? What privilege do I need?

View 1 Replies View Related

SQL & PL/SQL :: Truncate Partition - Resource Busy?

Sep 1, 2010

i have one procedure that run at same time for two different partition.In the begin of the processes i do the truncate partition and after that the insert of data in the partition.Since i have two processes running at the same time, i will fill up data in two different partition.

But it occurred one error :
"ORA-00054: resource busy and acquire with NOWAIT specified"

The problem is caused by the truncate partition. I'm doing two simultaneous execution of the same process, but when one process is doing the truncate other is insert data.How can i do the truncate of this two partition, or insert in to, without get any error. I think the two simultaneous insert is not a problem.

So how can i lock the table in the first truncate and after that release the table for the next truncate?

View 5 Replies View Related

RAC & Failsafe :: CRS-0215 / Could Not Start Resource

Oct 31, 2008

I want to change the processes parameter in RAC system.I am using spfile.I have ASM environment and two instances.

I followed the below steps from first server but i m getting error.

1) connected as sys user
2) alter system set cluster_database=false scope=spfile sid='<firstinstanceid>';
3) exited from oracle
4) stoped second instance from linux.
$ srvctl stop instance -d <DBname> -i <secondinstanceid>
5) Again i connected as sys user.
6) create spfile from pfile;
7) shutting down the db and started.

[code]....

But second instance is not starting and it is giving error.

PRKP-1001 : Error starting instance <sencondinstanceid> on node st-habam-db2

CRS-0215: Could not start resource 'ora.<DBname>.<secondInstanceid>.inst'.

View 5 Replies View Related

SQL & PL/SQL :: Resource Busy While Creating Constraint

Apr 6, 2012

i am working in scott's schema and i want to create foreign key on new table that is "test" table ,structure is----

create table test(id number, name varchar2(20),dno number,pno number);

and now create a foreign key on id column of "test" table reffering the empno of "emp" table which has pk already. but it shows an error-------"ora-ORA-00054-resource busy and acquire with NOWAIT specified or timeout expired"

while i have create the "test" table just 1 min ago.

View 3 Replies View Related

SQL & PL/SQL :: Loading Java Resource In 11gr2?

Jun 5, 2013

am trying to load java resource in oracle llgr2 using load java. It shows resource loaded but I am not able find it in database dictionary. I configured JVM also on database and gave all the neccessary grants. whenever I am trying to encrpt it give me

SQL> HOST loadjava -u scott/scott1234@mock -v -resolve /data1/Encrypt/javasp/KeyAccess.class
arguments: '-u' 'scott/***@cmsmock' '-v' '-resolve' '/data1/Encrypt/javasp/KeyAccess.class'
creating : class javasp/KeyAccess
loading : class javasp/KeyAccess

[code]...

below are the db version details

SQL> select banner from v$version
2 ;
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for IBM/AIX RISC System/6000: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production

View 2 Replies View Related

Oracle Resource Busy - ORA-0054 Error

Jul 21, 2010

A batch job was running for a long time which executes a stored procedure that was doing physical deletes on an oracle table. This job ran for about 3 hrs and is still executing. Meanwhile another job(which was making indexes unusable in another table) has cancelled saying "resource busy and acquire with NOWAIT specified", i think it was ORA-0054! So i killed the first job and reran the second thinking the first one was taking up resources which resulted in the cancel of the second job. Now the second job ran successfully. Both these tables are not related to each other whatsoever...but why was there a cancel?

View 6 Replies View Related

SQL & PL/SQL :: Monitoring Database For Resource Intensive Queries

May 31, 2012

I am database developer and suddenly i have been given a DBA work. I have to monitor database for resource intensive queries , whether i/o is more , process memory and many other stuffs.

Provide me some sql queries or scripts which shows that process are over loaded and memory needs to be allocated, queries are taking long time , i/o operation are more instead of memory.

View 1 Replies View Related

PL/SQL :: Resource Planning And Jobs Grouping In Oracle

Mar 20, 2013

I have a requirement where I need to group sessions which takes time as given below when ran individually .There are a total of 32 sesions.I want to divide them into 7 groups.I want to submit each one of the 7 groups in a job.So there will be seven jobs on the whole.Execution flow will be group 1 completes ,then group 2 starts like that.Actually I don't want to bombard the database at a time with 32 jobs ,hence the idea of grouping 32 jobs among 7 groups.grouping the sessions so that on the whole ,resources are equally allocated among sessions in a group and which in turn makes the process complete faster. I want to achieve parallelism but at the same time database should not be loaded too much.I just want to know is there any good practice from oracle side while doing this type of grouping. I am planning to group the most time taking one with least time taking jobs.

S.NO     Session_Name     DURATION(HH:MM:SEC)
1     Session_1     00:11:56.202368
1     Session_2     00:00:00.058542
1     Session_3     00:00:00.055205
1     Session_4     00:00:00.043454
1     Session_5     00:00:00.039994
2     Session_6     00:08:05.786031
2     Session_7     00:00:00.579035
2     Session_8     00:00:00.537957
[code]...

View 0 Replies View Related

Using DBMS_sqltune Package To Tune Some Resource Intensive Queries

Dec 8, 2010

I am using dbms_sqltune package to tune some resource intensive queries. In this I am looking to know how Sql profile works

I created task for one sql using dbms_sqltune, then in Report it was recommended to accept its sql profile (which will potentially benefits 65%)
then accepted that sql profile with

exec dbms_sqltune.accept_sql_profile(task_name => 'pc1_61d2dhmdwzc8d', replace => TRUE);

and re-executed same query but NO difference in time. Then, what that mentioned potentially benefit 65% is about.

1) Originally query is taking 10 sec to execute, with this 65% i thought that it will execute within 3-4 sec. Is it right?
2)Also, the query for which i have created tuning task has some hardcoded input values, what if i change input values next time, will that profile works with new input values?

FINDINGS SECTION (1 finding)
-------------------------------------------------------------------------------
1- SQL Profile Finding (see explain plans section below)
--------------------------------------------------------
A potentially better execution plan was found for this statement.

Recommendation (estimated benefit: 65.17%)
------------------------------------------
- Consider accepting the recommended SQL profile.
execute dbms_sqltune.accept_sql_profile(task_name => 'pc1_61d2dhmdwzc8d',
replace => TRUE);

View 2 Replies View Related

Getting ORA-00060 - Deadlock Detected While Waiting For Resource While Deleting Datafile?

Nov 18, 2010

I am getting "ORA-00060: deadlock detected while waiting for resource" while deleting a datafile.

when i checked in dba_data_files and V$datafile the ONLINE_STATUS/STATUS is in RECOVER mode.

I do not need this datafile so i tried to drop using the following command ..

ALTER TABLESPACE DATAP_LARGE DROP DATAFILE 'D:\ORACLE\ORADATA\DATAP\DATAP_LARGE_12.DBF';

I checked the Trace file geenrated for the deadlock, the Session which is in question is the session where i ran the command (SQLPLUS).

View 8 Replies View Related

Getting Deadlock Detected While Waiting For Resource Error For Select Query

Nov 4, 2013

i am getting a below error whenever executing the below select query. some times it will show dead lock detected while waiting for resource and terminated...some times it executes and gives result..but all the time it writes an alert to alert log 

Env: Linux / Oracle 11.2.0.3.3..Error from alert log:Errors in file /u01/oracle/oracle/diag/rdbms/bdrdb/bdrdb/trace/bdrdb_p017_6076.trc:ORA-00060: deadlock detected while waiting for resourceORA-10387: parallel query server interrupt (normal)  Trace file info... bdrdb_p017_6076.trc:Trace file /u01/oracle/oracle/diag/rdbms/bdrdb/bdrdb/trace/bdrdb_p017_6076.trcOracle Database 11g Enterprise Edition Release 11.2.0.3.0 - ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsORACLE_HOME = /u01/oracle/oracle/product/11.2.0/dbhome_1System.
[code]....

View 11 Replies View Related

Performance Tuning :: Why There Is No Row Resource Operation Information In Tkprof Output

May 13, 2011

why there is no "Row Source Operation" information when I trace a long and complicated SQL query (It takes at least 25 minutes ro run)?

However, I can get the "Row Source Operation" information for a simple SQL Query.

Here are the tkprof output for a simple query and complicated query:

tkprof Output for a simple query
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.00 0.00 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 13 0.00 0.00 0 16 0 173
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 15 0.00 0.00 0 16 0 173

Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 3139

Rows Row Source Operation
------- ---------------------------------------------------
173 TABLE ACCESS FULL MY_TABLE (cr=16 pr=0 pw=0 time=0 us)

Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 13 0.00 0.00
SQL*Net more data to client 24 0.00 0.00
SQL*Net message from client 13 5.33 5.47

Tkprof output for a complex query
call count cpu elapsed disk query current rows
------- ------ -------- ---------- ---------- ---------- ---------- ----------
Parse 1 0.38 0.40 0 0 0 0
Execute 1 0.00 0.00 0 0 0 0
Fetch 0 0.00 0.00 0 0 0 0
------- ------ -------- ---------- ---------- ---------- ---------- ----------
total 2 0.38 0.40 0 0 0 0

Misses in library cache during parse: 1
Optimizer mode: ALL_ROWS
Parsing user id: 3139

No Row Source Operation information here Elapsed times include waiting on following events:
Event waited on Times Max. Wait Total Waited
---------------------------------------- Waited ---------- ------------
SQL*Net message to client 1 0.00 0.00
db file sequential read 73062 0.25 692.23
db file scattered read 16099 0.18 76.65
latch: shared pool 4 0.02 0.03
latch: cache buffers chains 3 0.04 0.04
latch free 16 0.00 0.00

View 1 Replies View Related

Performance Tuning :: Call From Specified Machine Not Assigned To Database Resource Consumer

Sep 6, 2013

I am using Release 11.2.0.3.0 - 64bit Production version of oracle. Now we are having 3-tier architecture, (firewal/web/app/DB).Now i saw , some of the 'sql' queries, running till ~10hrs in my database and those are part of application(module JDBC THIN CLIENT). After had a talk java guys, they ask to kill the sessions specific to those queries. They are part of search TO, in which user put some large values for the date range and went to other TAB, but these queries gets running infinitely in the database, and user is not interested in the result set.

So how to avoid these things, as because in past, our database has suffered resource contention leading to application slowness. So i was planing to set different timeouts using 'database resource consumer group' for online user request and batch request depending on the app server(that is by machine names) request.

So i have done below set up in my local to test one scenario, in which i will try give a database call from difference machine, and it should get timeout after the specified duration. But its not working , as expected. The calls from the specified machine are not getting assigned to the created 'Consumer group'.

Begin
-- create the pending area
dbms_resource_manager.create_pending_area();
END;
/
BEGIN
-- Create the consumer group

[code]....

After this when i am verifying calls from machine, 'LR9XY7T8' they are belongs to the consumer group 'OTHER_GROUPS' and sql query not getting timed out within 60 seconds as mentioned.

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved