Find a slow query
Hi all,
I have two questions about the SQL tuning:
There are many open sessions for an Oracle database,
(1) How to find the session that runs a slow query?
(2) How to locate / find this slow query so that the query can be tuned?
Thanks a lot.
Hi,
(1) How to find the session that runs a slow query?This can be coming up from the wait events that the sessions are waiting for.So you can check V$session_wait to see that which are the sessions which are waiting for some thing to happen and for that reason have become slow.Also you can take the advantage of ASH in 10g to tell you the same if you want to drill down your search for last few minutes.
(2) How to locate / find this slow query so that the query can be tuned?IF you read Optimizing OralcePerformance, this is the first thing that Carry asks to address and take extreme caution in doing it.Ask the user that which business process is slow.It will vary depending upon the business.There is nothing called ,"we are slow" and there is no such thing that "tune it all".We have to tune the main area or the maximum benefit giving area only.Ask the user which query/report he is running which he wants to get optimized.You can also take advantage or statspack/AWR report to go for the particular query depending upon the wait event.If you know the query than trace the query to see what is happening.I shall suggest 10046 trace forthe query as its more wider and imparts mch more info as compared to tkprof but you can pick what you want/like.
HTH
Aman....
Similar Messages
-
Very Slow Query with CTE inner join
I have 2 tables (heavily simplified here to show relevant columns):
CREATE TABLE tblCharge
(ChargeID int NOT NULL,
ParentChargeID int NULL,
ChargeName varchar(200) NULL)
CREATE TABLE tblChargeShare
(ChargeShareID int NOT NULL,
ChargeID int NOT NULL,
TotalAmount money NOT NULL,
TaxAmount money NULL,
DiscountAmount money NULL,
CustomerID int NOT NULL,
ChargeShareStatusID int NOT NULL)
I have a very basic View to Join them:
CREATE VIEW vwBASEChargeShareRelation as
Select c.ChargeID, ParentChargeID, s.CustomerID, s.TotalAmount, isnull(s.TaxAmount, 0) as TaxAmount, isnull(s.DiscountAmount, 0) as DiscountAmount
from tblCharge c inner join tblChargeShare s
on c.ChargeID = s.ChargeID Where s.ChargeShareStatusID < 3
GO
I then have a view containing a CTE to get the children of the Parent Charge:
ALTER VIEW [vwChargeShareSubCharges] AS
WITH RCTE AS
SELECT ParentChargeId, ChargeID, 1 AS Lvl, ISNULL(TotalAmount, 0) as TotalAmount, ISNULL(TaxAmount, 0) as TaxAmount,
ISNULL(DiscountAmount, 0) as DiscountAmount, CustomerID, ChargeID as MasterChargeID
FROM vwBASEChargeShareRelation Where ParentChargeID is NULL
UNION ALL
SELECT rh.ParentChargeID, rh.ChargeID, Lvl+1 AS Lvl, ISNULL(rh.TotalAmount, 0), ISNULL(rh.TaxAmount, 0), ISNULL(rh.DiscountAmount, 0) , rh.CustomerID
, rc.MasterChargeID
FROM vwBASEChargeShareRelation rh
INNER JOIN RCTE rc ON rh.PArentChargeID = rc.ChargeID and rh.CustomerID = rc.CustomerID
Select MasterChargeID as ChargeID, CustomerID, Sum(TotalAmount) as TotalCharged, Sum(TaxAmount) as TotalTax, Sum(DiscountAmount) as TotalDiscount
from RCTE
Group by MasterChargeID, CustomerID
GO
So far so good, I can query this view and get the total cost for a line item including all children.
The problem occurs when I join this table. The query:
Select t.* from vwChargeShareSubCharges t
inner join
tblChargeShare s
on t.CustomerID = s.CustomerID
and t.MasterChargeID = s.ChargeID
Where s.ChargeID = 1291094
Takes around 30 ms to return a result (tblCharge and Charge Share have around 3.5 million records).
But the query:
Select t.* from vwChargeShareSubCharges t
inner join
tblChargeShare s
on t.CustomerID = s.CustomerID
and t.MasterChargeID = s.ChargeID
Where InvoiceID = 1045854
Takes around 2 minutes to return a result - even though the only charge with that InvoiceID is the same charge as the one used in the previous query.
The same thing occurs if I do the join in the same query that the CTE is defined in.
I ran the execution plan for each query. The first (fast) query looks like this:
The second(slow) query looks like this:
I am at a loss, and my skills at decoding execution plans to resolve this are lacking.
I have separate indexes on tblCharge.ChargeID, tblCharge.ParentChargeID, tblChargeShare.ChargeID, tblChargeShare.InvoiceID, tblChargeShare.ChargeShareStatusID
Any ideas? Tested on SQL 2008R2 and SQL 2012>> The database is linked [sic] to an established app and the column and table names can't be changed. <<
Link? That is a term from pointer chains and network databases, not SQL. I will guess that means the app came back in the old pre-RDBMS days and you are screwed.
>> I am not too worried about the money field [sic], this is used for money and money based calculations so the precision and rounding are acceptable at this level. <<
Field is a COBOL concept; columns are totally different. MONEY is how Sybase mimics the PICTURE clause that puts currency signs, commas, period, etc in a COBOL money field.
Using more than one operation (multiplication or division) on money columns will produce severe rounding errors. A simple way to visualize money arithmetic is to place a ROUND() function calls after
every operation. For example,
Amount = (Portion / total_amt) * gross_amt
can be rewritten using money arithmetic as:
Amount = ROUND(ROUND(Portion/total_amt, 4) *
gross_amt, 4)
Rounding to four decimal places might not seem an
issue, until the numbers you are using are greater
than 10,000.
BEGIN
DECLARE @gross_amt MONEY,
@total_amt MONEY,
@my_part MONEY,
@money_result MONEY,
@float_result FLOAT,
@all_floats FLOAT;
SET @gross_amt = 55294.72;
SET @total_amt = 7328.75;
SET @my_part = 1793.33;
SET @money_result = (@my_part / @total_amt) *
@gross_amt;
SET @float_result = (@my_part / @total_amt) *
@gross_amt;
SET @Retult3 = (CAST(@my_part AS FLOAT)
/ CAST( @total_amt AS FLOAT))
* CAST(FLOAT, @gross_amt AS FLOAT);
SELECT @money_result, @float_result, @all_floats;
END;
@money_result = 13525.09 -- incorrect
@float_result = 13525.0885 -- incorrect
@all_floats = 13530.5038673171 -- correct, with a -
5.42 error
>> The keys are ChargeID(int, identity) and ChargeShareID(int, identity). <<
Sorry, but IDENTITY is not relational and cannot be a key by definition. But it sure works just like a record number in your old COBOL file system.
>> .. these need to be int so that they are assigned by the database and unique. <<
No, the data type of a key is not determined by physical storage, but by logical design. IDENTITY is the number of a parking space in a garage; a VIN is how you identify the automobile.
>> What would you recommend I use as keys? <<
I do not know. I have no specs and without that, I cannot pull a Kabbalah number from the hardware. Your magic numbers can identify Squids, Automobile or Lady Gaga! I would ask the accounting department how they identify a charge.
>> Charge_Share_Status_ID links [sic] to another table which contains the name, formatting [sic] and other information [sic] or a charge share's status, so it is both an Id and a status. <<
More pointer chains! Formatting? Unh? In RDBMS, we use a tiered architecture. That means display formatting is in a presentation layer. A properly created table has cohesion – it does one and only one data element. A status is a state of being that applies
to an entity over a period time (think employment, marriage, etc. status if that is too abstract).
An identifier is based on the Law of Identity from formal logic “To be is to be something in particular” or “A is A” informally. There is no entity here! The Charge_Share_Status table should have the encoded values for a status and perhaps a description if
they are unclear. If the list of values is clear, short and static, then use a CHECK() constraint.
On a scale from 1 to 10, what color is your favorite letter of the alphabet? Yes, this is literally that silly and wrong.
>> I understand what a CTE is; is there a better way to sum all children for a parent hierarchy? <<
There are many ways to represent a tree or hierarchy in SQL. This is called an adjacency list model and it looks like this:
CREATE TABLE OrgChart
(emp_name CHAR(10) NOT NULL PRIMARY KEY,
boss_emp_name CHAR(10) REFERENCES OrgChart(emp_name),
salary_amt DECIMAL(6,2) DEFAULT 100.00 NOT NULL,
<< horrible cycle constraints >>);
OrgChart
emp_name boss_emp_name salary_amt
==============================
'Albert' NULL 1000.00
'Bert' 'Albert' 900.00
'Chuck' 'Albert' 900.00
'Donna' 'Chuck' 800.00
'Eddie' 'Chuck' 700.00
'Fred' 'Chuck' 600.00
This approach will wind up with really ugly code -- CTEs hiding recursive procedures, horrible cycle prevention code, etc. The root of your problem is not knowing that rows are not records, that SQL uses sets and trying to fake pointer chains with some
vague, magical non-relational "id".
This matches the way we did it in old file systems with pointer chains. Non-RDBMS programmers are comfortable with it because it looks familiar -- it looks like records and not rows.
Another way of representing trees is to show them as nested sets.
Since SQL is a set oriented language, this is a better model than the usual adjacency list approach you see in most text books. Let us define a simple OrgChart table like this.
CREATE TABLE OrgChart
(emp_name CHAR(10) NOT NULL PRIMARY KEY,
lft INTEGER NOT NULL UNIQUE CHECK (lft > 0),
rgt INTEGER NOT NULL UNIQUE CHECK (rgt > 1),
CONSTRAINT order_okay CHECK (lft < rgt));
OrgChart
emp_name lft rgt
======================
'Albert' 1 12
'Bert' 2 3
'Chuck' 4 11
'Donna' 5 6
'Eddie' 7 8
'Fred' 9 10
The (lft, rgt) pairs are like tags in a mark-up language, or parens in algebra, BEGIN-END blocks in Algol-family programming languages, etc. -- they bracket a sub-set. This is a set-oriented approach to trees in a set-oriented language.
The organizational chart would look like this as a directed graph:
Albert (1, 12)
Bert (2, 3) Chuck (4, 11)
/ | \
/ | \
/ | \
/ | \
Donna (5, 6) Eddie (7, 8) Fred (9, 10)
The adjacency list table is denormalized in several ways. We are modeling both the Personnel and the Organizational chart in one table. But for the sake of saving space, pretend that the names are job titles and that we have another table which describes the
Personnel that hold those positions.
Another problem with the adjacency list model is that the boss_emp_name and employee columns are the same kind of thing (i.e. identifiers of personnel), and therefore should be shown in only one column in a normalized table. To prove that this is not
normalized, assume that "Chuck" changes his name to "Charles"; you have to change his name in both columns and several places. The defining characteristic of a normalized table is that you have one fact, one place, one time.
The final problem is that the adjacency list model does not model subordination. Authority flows downhill in a hierarchy, but If I fire Chuck, I disconnect all of his subordinates from Albert. There are situations (i.e. water pipes) where this is true, but
that is not the expected situation in this case.
To show a tree as nested sets, replace the nodes with ovals, and then nest subordinate ovals inside each other. The root will be the largest oval and will contain every other node. The leaf nodes will be the innermost ovals with nothing else inside them
and the nesting will show the hierarchical relationship. The (lft, rgt) columns (I cannot use the reserved words LEFT and RIGHT in SQL) are what show the nesting. This is like XML, HTML or parentheses.
At this point, the boss_emp_name column is both redundant and denormalized, so it can be dropped. Also, note that the tree structure can be kept in one table and all the information about a node can be put in a second table and they can be joined on employee
number for queries.
To convert the graph into a nested sets model think of a little worm crawling along the tree. The worm starts at the top, the root, makes a complete trip around the tree. When he comes to a node, he puts a number in the cell on the side that he is visiting
and increments his counter. Each node will get two numbers, one of the right side and one for the left. Computer Science majors will recognize this as a modified preorder tree traversal algorithm. Finally, drop the unneeded OrgChart.boss_emp_name column
which used to represent the edges of a graph.
This has some predictable results that we can use for building queries. The root is always (left = 1, right = 2 * (SELECT COUNT(*) FROM TreeTable)); leaf nodes always have (left + 1 = right); subtrees are defined by the BETWEEN predicate; etc. Here are
two common queries which can be used to build others:
1. An employee and all their Supervisors, no matter how deep the tree.
SELECT O2.*
FROM OrgChart AS O1, OrgChart AS O2
WHERE O1.lft BETWEEN O2.lft AND O2.rgt
AND O1.emp_name = :in_emp_name;
2. The employee and all their subordinates. There is a nice symmetry here.
SELECT O1.*
FROM OrgChart AS O1, OrgChart AS O2
WHERE O1.lft BETWEEN O2.lft AND O2.rgt
AND O2.emp_name = :in_emp_name;
3. Add a GROUP BY and aggregate functions to these basic queries and you have hierarchical reports. For example, the total salaries which each employee controls:
SELECT O2.emp_name, SUM(S1.salary_amt)
FROM OrgChart AS O1, OrgChart AS O2,
Salaries AS S1
WHERE O1.lft BETWEEN O2.lft AND O2.rgt
AND S1.emp_name = O2.emp_name
GROUP BY O2.emp_name;
4. To find the level and the size of the subtree rooted at each emp_name, so you can print the tree as an indented listing.
SELECT O1.emp_name,
SUM(CASE WHEN O2.lft BETWEEN O1.lft AND O1.rgt
THEN O2.sale_amt ELSE 0.00 END) AS sale_amt_tot,
SUM(CASE WHEN O2.lft BETWEEN O1.lft AND O1.rgt
THEN 1 ELSE 0 END) AS subtree_size,
SUM(CASE WHEN O1.lft BETWEEN O2.lft AND O2.rgt
THEN 1 ELSE 0 END) AS lvl
FROM OrgChart AS O1, OrgChart AS O2
GROUP BY O1.emp_name;
5. The nested set model has an implied ordering of siblings which the adjacency list model does not. To insert a new node, G1, under part G. We can insert one node at a time like this:
BEGIN ATOMIC
DECLARE rightmost_spread INTEGER;
SET rightmost_spread
= (SELECT rgt
FROM Frammis
WHERE part = 'G');
UPDATE Frammis
SET lft = CASE WHEN lft > rightmost_spread
THEN lft + 2
ELSE lft END,
rgt = CASE WHEN rgt >= rightmost_spread
THEN rgt + 2
ELSE rgt END
WHERE rgt >= rightmost_spread;
INSERT INTO Frammis (part, lft, rgt)
VALUES ('G1', rightmost_spread, (rightmost_spread + 1));
COMMIT WORK;
END;
The idea is to spread the (lft, rgt) numbers after the youngest child of the parent, G in this case, over by two to make room for the new addition, G1. This procedure will add the new node to the rightmost child position, which helps to preserve the idea
of an age order among the siblings.
6. To convert a nested sets model into an adjacency list model:
SELECT B.emp_name AS boss_emp_name, E.emp_name
FROM OrgChart AS E
LEFT OUTER JOIN
OrgChart AS B
ON B.lft
= (SELECT MAX(lft)
FROM OrgChart AS S
WHERE E.lft > S.lft
AND E.lft < S.rgt);
7. To find the immediate parent of a node:
SELECT MAX(P2.lft), MIN(P2.rgt)
FROM Personnel AS P1, Personnel AS P2
WHERE P1.lft BETWEEN P2.lft AND P2.rgt
AND P1.emp_name = @my_emp_name;
I have a book on TREES & HIERARCHIES IN SQL which you can get at Amazon.com right now. It has a lot of other programming idioms for nested sets, like levels, structural comparisons, re-arrangement procedures, etc.
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL -
SQL tuning for extremely slow query
Hi,
We have a requirement to display sales data by month. The sales data should be summed based on groups. The whole query is dynamically generated so the WHERE clause as well as the GROUP BY columns will be dynamically generated. Please find below the query which has been dynamically generated. The query is extremely slow and is not returning any data even after several minutes.
Please can anyone suggest possible ways of tuning this query? We are evaluating the option of using Materialied Views with Fast Refresh but the number of tables involved in this query runs into several hundreds and creating log in each table would be tedious.
Regards,
Balu
SELECT trantype, cmp, fyr, nam, cno, loc, or#, prd, siz, dat, ter, reg, gra,
mjr, mrk, fiscdat, GROUP_ID, class_id, group_name, class_name,
cmp_sreg, channel, bt_dsc, SUM (CASE fpr
WHEN 1
THEN amt
ELSE 0
END) AS a1,
SUM (CASE fpr
WHEN 2
THEN amt
ELSE 0
END) AS a2, SUM (CASE fpr
WHEN 3
THEN amt
ELSE 0
END) AS a3,
SUM (CASE fpr
WHEN 4
THEN amt
ELSE 0
END) AS a4, SUM (CASE fpr
WHEN 5
THEN amt
ELSE 0
END) AS a5,
SUM (CASE fpr
WHEN 6
THEN amt
ELSE 0
END) AS a6, SUM (CASE fpr
WHEN 7
THEN amt
ELSE 0
END) AS a7,
SUM (CASE fpr
WHEN 8
THEN amt
ELSE 0
END) AS a8, SUM (CASE fpr
WHEN 9
THEN amt
ELSE 0
END) AS a9,
SUM (CASE fpr
WHEN 10
THEN amt
ELSE 0
END) AS a10, SUM (CASE fpr
WHEN 11
THEN amt
ELSE 0
END) AS a11,
SUM (CASE fpr
WHEN 12
THEN amt
ELSE 0
END) AS a12, SUM (CASE fpr
WHEN 1
THEN qty
ELSE 0
END) AS q1,
SUM (CASE fpr
WHEN 2
THEN qty
ELSE 0
END) AS q2, SUM (CASE fpr
WHEN 3
THEN qty
ELSE 0
END) AS q3,
SUM (CASE fpr
WHEN 4
THEN qty
ELSE 0
END) AS q4, SUM (CASE fpr
WHEN 5
THEN qty
ELSE 0
END) AS q5,
SUM (CASE fpr
WHEN 6
THEN qty
ELSE 0
END) AS q6, SUM (CASE fpr
WHEN 7
THEN qty
ELSE 0
END) AS q7,
SUM (CASE fpr
WHEN 8
THEN qty
ELSE 0
END) AS q8, SUM (CASE fpr
WHEN 9
THEN qty
ELSE 0
END) AS q9,
SUM (CASE fpr
WHEN 10
THEN qty
ELSE 0
END) AS q10, SUM (CASE fpr
WHEN 11
THEN qty
ELSE 0
END) AS q11,
SUM (CASE fpr
WHEN 12
THEN qty
ELSE 0
END) AS q12,
SUM (CASE fpr
WHEN 1
THEN (amt - (((frt + mrt + csc)) * qty))
ELSE 0
END
) AS cm1,
SUM (CASE fpr
WHEN 2
THEN (amt - (((frt + mrt + csc)) * qty))
ELSE 0
END
) AS cm2,
SUM (CASE fpr
WHEN 3
THEN (amt - (((frt + mrt + csc)) * qty))
ELSE 0
END
) AS cm3,
SUM (CASE fpr
WHEN 4
THEN (amt - (((frt + mrt + csc)) * qty))
ELSE 0
END
) AS cm4,
SUM (CASE fpr
WHEN 5
THEN (amt - (((frt + mrt + csc)) * qty))
ELSE 0
END
) AS cm5,
SUM (CASE fpr
WHEN 6
THEN (amt - (((frt + mrt + csc)) * qty))
ELSE 0
END
) AS cm6,
SUM (CASE fpr
WHEN 7
THEN (amt - (((frt + mrt + csc)) * qty))
ELSE 0
END
) AS cm7,
SUM (CASE fpr
WHEN 8
THEN (amt - (((frt + mrt + csc)) * qty))
ELSE 0
END
) AS cm8,
SUM (CASE fpr
WHEN 9
THEN (amt - (((frt + mrt + csc)) * qty))
ELSE 0
END
) AS cm9,
SUM (CASE fpr
WHEN 10
THEN (amt - (((frt + mrt + csc)) * qty))
ELSE 0
END
) AS cm10,
SUM (CASE fpr
WHEN 11
THEN (amt - (((frt + mrt + csc)) * qty))
ELSE 0
END
) AS cm11,
SUM (CASE fpr
WHEN 12
THEN (amt - (((frt + mrt + csc)) * qty))
ELSE 0
END
) AS cm12,
SUM (CASE fpr
WHEN 0
THEN (amt - (((lrt + frt + mrt + csc)) * qty))
ELSE 0
END
) AS cml0,
SUM (CASE fpr
WHEN 1
THEN (amt - (((lrt + frt + mrt + csc)) * qty))
ELSE 0
END
) AS cml1,
SUM (CASE fpr
WHEN 2
THEN (amt - (((lrt + frt + mrt + csc)) * qty))
ELSE 0
END
) AS cml2,
SUM (CASE fpr
WHEN 3
THEN (amt - (((lrt + frt + mrt + csc)) * qty))
ELSE 0
END
) AS cml3,
SUM (CASE fpr
WHEN 4
THEN (amt - (((lrt + frt + mrt + csc)) * qty))
ELSE 0
END
) AS cml4,
SUM (CASE fpr
WHEN 5
THEN (amt - (((lrt + frt + mrt + csc)) * qty))
ELSE 0
END
) AS cml5,
SUM (CASE fpr
WHEN 6
THEN (amt - (((lrt + frt + mrt + csc)) * qty))
ELSE 0
END
) AS cml6,
SUM (CASE fpr
WHEN 7
THEN (amt - (((lrt + frt + mrt + csc)) * qty))
ELSE 0
END
) AS cml7,
SUM (CASE fpr
WHEN 8
THEN (amt - (((lrt + frt + mrt + csc)) * qty))
ELSE 0
END
) AS cml8,
SUM (CASE fpr
WHEN 9
THEN (amt - (((lrt + frt + mrt + csc)) * qty))
ELSE 0
END
) AS cml9,
SUM (CASE fpr
WHEN 10
THEN (amt - (((lrt + frt + mrt + csc)) * qty))
ELSE 0
END
) AS cml10,
SUM (CASE fpr
WHEN 11
THEN (amt - (((lrt + frt + mrt + csc)) * qty))
ELSE 0
END
) AS cml11,
SUM (CASE fpr
WHEN 12
THEN (amt - (((lrt + frt + mrt + csc)) * qty))
ELSE 0
END
) AS cml12,
SUM (amt) AS a, SUM (qty) AS q,
SUM ((amt - (((frt + mrt + csc)) * qty))) AS cm,
SUM ((amt - (((lrt + frt + mrt + csc)) * qty))) AS cml
FROM (SELECT ruec_a.seq, ruec_a.trantype, ruec_a.cmp, ruec_a.fyr,
ruec_a.fpr, ruec_a.csc, ruec_a.lrt, ruec_a.mrt, ruec_a.frt,
ruec_a.typ, ruec_a.nam, ruec_a.cno, ruec_a.loc, ruec_a.or#,
ruec_a.prd, ruec_a.bulk_item_no, ruec_a.siz, ruec_a.dat,
NVL (ruec_a.qty, 0) qty, ruec_a.amt, ruec_a.ter, ruec_a.reg,
ruec_a.gra, ruec_a.mjr, ruec_a.mrk, ruec_a.fiscdat,
ruec_a.group_name, ruec_a.class_name, ruec_a.GROUP_ID,
ruec_a.cur, ruec_a.conversion_rate, ruec_a.grpnum,
ruec_a.rgnshi, ruec_a.mktshi, ruec_a.slmshi, ruec_a.mjrshi,
ruec_a.cmpid, ruec_a.chnshi, ruec_a.srgshi, ruec_a.sh_sreg,
ruec_a.cmp_sreg, ruec_a.channel, ruec_a.srgcmp,
ruec_a.biz_typ, ruec_a.bt_dsc, amt / NVL (qty, 1) qty$,
NVL ((amt - ((qty * csc) + (qty * frt) + (qty * mrt))),
0) cm,
NVL ((amt - (((frt + mrt + csc)) * qty)) / NVL (qty, 1),
0
) cm$,
NVL (( (( amt
- ( (qty * csc)
+ (qty * frt)
+ (qty * mrt * 100)
+ (qty * lrt)
/ 100
0
) gp,
((CASE amt
WHEN 0
THEN 0
ELSE NVL (( ( amt
- ( (qty * csc)
+ (qty * frt)
+ (qty * mrt * 100)
+ (qty * lrt)
/ amt
0
END
) pm,
ruec_a.customer_trx_id, ruec_a.customer_trx_line_id,
ruec_a.inventory_item_id, ruec_a.item_id, line_id, header_id,
ruec_a.customer_id, ruec_a.site_use_id, ruec_a.class_id
FROM (SELECT xxsrg.line_number seq, xxsrg.trantype,
xxsrg.co_code cmp, xxsrg.period_year fyr,
xxsrg.period_num fpr, csc_invcur * conv_rate csc,
lrt_invcur * conv_rate lrt,
mrt_invcur * conv_rate mrt,
xxsrg.frt_invcur * conv_rate frt,
xxsrg.inv_class typ, xxsrg.site_name nam,
xxsrg.customer_number cno, xxsrg.site_number loc,
xxsrg.ct_reference "OR#", xxsrg.item_no prd,
xxsrg.bulk_item_no, xxsrg.container_type siz,
xxsrg.trx_date dat, qty,
xxsrg.amt_invcur * conv_rate amt,
xxsrg.sales_territory_name ter,
xxsrg.sales_region_name reg,
xxsrg.customer_group_name gra,
xxsrg.major_market_name mjr,
xxsrg.minor_market_name mrk, xxsrg.trx_date fiscdat,
xxsrg.group_name group_name,
xxsrg.class_name class_name,
NVL (xxsrg.GROUP_ID, 0) GROUP_ID, xxsrg.inv_cur cur,
conv_rate conversion_rate,
xxsrg.customer_group_code grpnum,
xxsrg.sales_region_code rgnshi,
xxsrg.minor_market_id mktshi,
xxsrg.salesrep_id slmshi,
xxsrg.major_market_id mjrshi,
xxsrg.organization_id cmpid,
xxsrg.sales_channel_code chnshi, xxsrg.ssr_id srgshi,
xxsrg.ssr_name sh_sreg, xxsrg.psr_name cmp_sreg,
xxsrg.sales_channel_code channel,
xxsrg.psr_id srgcmp, xxsrg.biz_typ,
xxsrg.biz_typ_dsc bt_dsc, xxsrg.customer_trx_id,
xxsrg.customer_trx_line_id, xxsrg.inventory_item_id,
xxsrg.item_id, xxsrg.line_id, xxsrg.customer_id,
xxsrg.site_use_id, 0 class_id, 0 header_id
FROM (SELECT xxsrg.*,
CASE
WHEN 'CAD' = xxsrg.inv_cur
THEN 1
ELSE xxaoc_int_srg_util.get_dly_rate
(xxsrg.inv_cur,
'CAD',
xxsrg.trx_date
END conv_rate,
CASE
WHEN 'KG' = 'LB'
THEN xxsrg.qty_lbs
ELSE xxsrg.qty_kgs
END qty
FROM apps.xxaoc_bs_srg_details_vw xxsrg) xxsrg) ruec_a
WHERE (fiscdat >= '01-APR-06' AND fiscdat <= '01-APR-09')
AND (prd LIKE '%H864%')
AND grpnum IN (274, 275)
AND class_id IN (54)
AND GROUP_ID IN (10)
AND mjrshi IN ('4')
AND mktshi IN ('21')
AND rgnshi IN ('ER')
AND slmshi IN (10045)
AND cmpid IN (462)) ruec_a
GROUP BY trantype,
cmp,
fyr,
nam,
cno,
loc,
or#,
prd,
siz,
dat,
ter,
reg,
gra,
mjr,
mrk,
fiscdat,
GROUP_ID,
class_id,
group_name,
class_name,
GROUP_ID,
class_id,
chnshi,
srgshi,
sh_sreg,
cmp_sreg,
channel,
srgcmp,
biz_typ,
bt_dscThe database version is 10.2.0.3.0. Explain Plan is provided below please:
Plan
SELECT STATEMENT CHOOSECost: 435 Bytes: 10,402 Cardinality: 1
182 SORT GROUP BY Cost: 435 Bytes: 10,402 Cardinality: 1
181 VIEW SRG. Cost: 409 Bytes: 10,402 Cardinality: 1
180 FILTER
166 NESTED LOOPS Cost: 399 Bytes: 10,736 Cardinality: 1
163 NESTED LOOPS OUTER Cost: 396 Bytes: 10,693 Cardinality: 1
160 HASH JOIN OUTER Cost: 393 Bytes: 10,646 Cardinality: 1
117 HASH JOIN Cost: 299 Bytes: 10,636 Cardinality: 1
32 HASH JOIN Cost: 240 Bytes: 299 Cardinality: 1
27 FILTER
26 NESTED LOOPS OUTER Cost: 22 Bytes: 3,060 Cardinality: 12
23 HASH JOIN OUTER Cost: 19 Bytes: 232 Cardinality: 1
18 NESTED LOOPS OUTER Cost: 12 Bytes: 216 Cardinality: 1
15 VIEW VIEW APPS.XXAOC_RA_CUST_TRX_LINES_VW Cost: 9 Bytes: 147 Cardinality: 1
14 FILTER
10 FILTER
9 NESTED LOOPS Cost: 5 Bytes: 195 Cardinality: 1
6 NESTED LOOPS Cost: 4 Bytes: 171 Cardinality: 1
4 NESTED LOOPS Cost: 4 Bytes: 163 Cardinality: 1
1 TABLE ACCESS FULL TABLE AR.RA_CUSTOMER_TRX_LINES_ALL Cost: 3 Bytes: 34 Cardinality: 1
3 TABLE ACCESS BY INDEX ROWID TABLE AR.RA_CUSTOMER_TRX_ALL Cost: 1 Bytes: 129 Cardinality: 1
2 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.RA_CUSTOMER_TRX_U1 Cardinality: 1
5 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.RA_BATCH_SOURCES_U2 Bytes: 8 Cardinality: 1
8 TABLE ACCESS BY INDEX ROWID TABLE AR.RA_CUST_TRX_TYPES_ALL Cost: 1 Bytes: 24 Cardinality: 1
7 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.RA_CUST_TRX_TYPES_U1 Cardinality: 1
13 COUNT STOPKEY
12 TABLE ACCESS BY INDEX ROWID TABLE INV.MTL_SYSTEM_ITEMS_B Cost: 4 Bytes: 22 Cardinality: 1
11 INDEX RANGE SCAN INDEX (UNIQUE) INV.MTL_SYSTEM_ITEMS_B_U1 Cost: 3 Cardinality: 1
17 TABLE ACCESS BY INDEX ROWID TABLE APPLSYS.FND_LOOKUP_VALUES Cost: 3 Bytes: 69 Cardinality: 1
16 INDEX RANGE SCAN INDEX (UNIQUE) APPLSYS.FND_LOOKUP_VALUES_U1 Cost: 2 Cardinality: 1
22 VIEW VIEW APPS.CM_CLDR_HDR_VL Cost: 6 Bytes: 1,632 Cardinality: 102
21 NESTED LOOPS Cost: 6 Bytes: 2,346 Cardinality: 102
19 TABLE ACCESS FULL TABLE GMF.CM_CLDR_HDR_B Cost: 6 Bytes: 1,632 Cardinality: 102
20 INDEX RANGE SCAN INDEX GMF.CM_CLDR_HDR_TL_PK Bytes: 7 Cardinality: 1
25 TABLE ACCESS BY INDEX ROWID TABLE GMF.CM_CLDR_DTL Cost: 3 Bytes: 276 Cardinality: 12
24 INDEX RANGE SCAN INDEX (UNIQUE) GMF.CM_CLDR_DTL_PK Cost: 1 Cardinality: 12
31 VIEW VIEW APPS.XXAOC_IC_ITEM_MST_VW Cost: 217 Bytes: 82,632 Cardinality: 1,878
30 NESTED LOOPS Cost: 217 Bytes: 61,974 Cardinality: 1,878
28 TABLE ACCESS FULL TABLE GMI.IC_ITEM_MST_B Cost: 217 Bytes: 46,950 Cardinality: 1,878
29 INDEX UNIQUE SCAN INDEX (UNIQUE) GMI.IC_ITEM_MST_TL_PK Bytes: 8 Cardinality: 1
116 VIEW VIEW APPS.XXAOC_BS_CUST_SITE_VW Cost: 58 Bytes: 10,337 Cardinality: 1
115 SORT ORDER BY Cost: 58 Bytes: 1,149 Cardinality: 1
114 FILTER
113 NESTED LOOPS OUTER Cost: 33 Bytes: 1,149 Cardinality: 1
110 FILTER
109 NESTED LOOPS OUTER Cost: 31 Bytes: 1,130 Cardinality: 1
106 NESTED LOOPS OUTER Cost: 30 Bytes: 1,111 Cardinality: 1
104 NESTED LOOPS OUTER Cost: 29 Bytes: 1,088 Cardinality: 1
101 NESTED LOOPS Cost: 29 Bytes: 1,041 Cardinality: 1
99 NESTED LOOPS OUTER Cost: 29 Bytes: 1,037 Cardinality: 1
97 NESTED LOOPS Cost: 28 Bytes: 1,001 Cardinality: 1
94 NESTED LOOPS Cost: 27 Bytes: 910 Cardinality: 1
92 NESTED LOOPS Cost: 26 Bytes: 902 Cardinality: 1
89 NESTED LOOPS Cost: 25 Bytes: 796 Cardinality: 1
86 NESTED LOOPS Cost: 24 Bytes: 773 Cardinality: 1
83 NESTED LOOPS OUTER Cost: 23 Bytes: 678 Cardinality: 1
81 NESTED LOOPS Cost: 23 Bytes: 675 Cardinality: 1
78 NESTED LOOPS OUTER Cost: 22 Bytes: 666 Cardinality: 1
76 NESTED LOOPS OUTER Cost: 22 Bytes: 662 Cardinality: 1
70 NESTED LOOPS OUTER Cost: 22 Bytes: 649 Cardinality: 1
64 NESTED LOOPS OUTER Cost: 22 Bytes: 636 Cardinality: 1
54 NESTED LOOPS OUTER Cost: 21 Bytes: 609 Cardinality: 1
52 NESTED LOOPS OUTER Cost: 20 Bytes: 573 Cardinality: 1
50 NESTED LOOPS OUTER Cost: 18 Bytes: 515 Cardinality: 1
47 NESTED LOOPS OUTER Cost: 17 Bytes: 457 Cardinality: 1
45 NESTED LOOPS OUTER Cost: 15 Bytes: 421 Cardinality: 1
43 NESTED LOOPS Cost: 13 Bytes: 385 Cardinality: 1
40 NESTED LOOPS Cost: 12 Bytes: 290 Cardinality: 1
37 NESTED LOOPS OUTER Cost: 11 Bytes: 237 Cardinality: 1
35 HASH JOIN Cost: 10 Bytes: 143 Cardinality: 1
33 TABLE ACCESS FULL TABLE AR.RA_TERRITORIES Cost: 3 Bytes: 34 Cardinality: 1
34 TABLE ACCESS FULL TABLE AR.HZ_CUST_SITE_USES_ALL Cost: 6 Bytes: 11,336 Cardinality: 104
36 INDEX RANGE SCAN INDEX (UNIQUE) JTF.JTF_RS_SALESREPS_U1 Cost: 1 Cardinality: 11
39 TABLE ACCESS BY INDEX ROWID TABLE AR.HZ_CUST_ACCT_SITES_ALL Cost: 1 Bytes: 53 Cardinality: 1
38 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.HZ_CUST_ACCT_SITES_U1 Cardinality: 1
42 TABLE ACCESS BY INDEX ROWID TABLE AR.HZ_CUST_ACCOUNTS Cost: 1 Bytes: 95 Cardinality: 1
41 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.HZ_CUST_ACCOUNTS_U1 Cardinality: 1
44 INDEX RANGE SCAN INDEX (UNIQUE) APPLSYS.FND_LOOKUP_VALUES_U1 Cost: 2 Bytes: 36 Cardinality: 1
46 INDEX RANGE SCAN INDEX (UNIQUE) APPLSYS.FND_LOOKUP_VALUES_U1 Cost: 2 Bytes: 36 Cardinality: 1
49 TABLE ACCESS BY INDEX ROWID TABLE APPLSYS.FND_LOOKUP_VALUES Cost: 1 Bytes: 58 Cardinality: 1
48 INDEX UNIQUE SCAN INDEX (UNIQUE) APPLSYS.FND_LOOKUP_VALUES_U1 Cost: 1 Cardinality: 1
51 INDEX UNIQUE SCAN INDEX (UNIQUE) APPLSYS.FND_LOOKUP_VALUES_U1 Cost: 1 Cardinality: 1
53 INDEX UNIQUE SCAN INDEX (UNIQUE) APPLSYS.FND_LOOKUP_VALUES_U1 Cost: 1 Bytes: 36 Cardinality: 1
63 VIEW PUSHED PREDICATE VIEW APPS.RA_SALESREPS Cost: 1 Bytes: 27 Cardinality: 1
62 NESTED LOOPS Cost: 4 Bytes: 59 Cardinality: 1
59 NESTED LOOPS Cost: 3 Bytes: 22 Cardinality: 1
56 TABLE ACCESS BY INDEX ROWID TABLE JTF.JTF_RS_SALESREPS Cost: 2 Bytes: 11 Cardinality: 1
55 INDEX RANGE SCAN INDEX (UNIQUE) JTF.JTF_RS_SALESREPS_U1 Cost: 1 Cardinality: 1
58 TABLE ACCESS BY INDEX ROWID TABLE JTF.JTF_RS_RESOURCE_EXTNS Cost: 1 Bytes: 11 Cardinality: 1
57 INDEX UNIQUE SCAN INDEX (UNIQUE) JTF.JTF_RS_RESOURCE_EXTNS_U1 Cardinality: 1
61 INLIST ITERATOR
60 INDEX UNIQUE SCAN INDEX (UNIQUE) JTF.JTF_RS_EXTNS_U1 Cardinality: 1
69 VIEW PUSHED PREDICATE VIEW APPS.OE_PRICE_LISTS_115_VL Bytes: 13 Cardinality: 1
68 NESTED LOOPS Cost: 1 Bytes: 62 Cardinality: 1
66 TABLE ACCESS BY INDEX ROWID TABLE QP.QP_LIST_HEADERS_B Cost: 1 Bytes: 45 Cardinality: 1
65 INDEX UNIQUE SCAN INDEX (UNIQUE) QP.QP_LIST_HEADERS_B_PK Cardinality: 1
67 INDEX UNIQUE SCAN INDEX (UNIQUE) QP.QP_LIST_HEADERS_TL_PK Bytes: 17 Cardinality: 1
75 VIEW PUSHED PREDICATE VIEW APPS.OE_ORDER_TYPES_115 Bytes: 13 Cardinality: 1
74 NESTED LOOPS Cost: 1 Bytes: 43 Cardinality: 1
72 TABLE ACCESS BY INDEX ROWID TABLE ONT.OE_TRANSACTION_TYPES_ALL Cost: 1 Bytes: 26 Cardinality: 1
71 INDEX UNIQUE SCAN INDEX (UNIQUE) ONT.OE_TRANSACTION_TYPES_ALL_U1 Cardinality: 1
73 INDEX UNIQUE SCAN INDEX (UNIQUE) ONT.OE_TRANSACTION_TYPES_TL_U1 Bytes: 17 Cardinality: 1
77 INDEX UNIQUE SCAN INDEX (UNIQUE) HR.HR_ORGANIZATION_UNITS_PK Bytes: 4 Cardinality: 1
80 TABLE ACCESS BY INDEX ROWID TABLE AR.HZ_CUSTOMER_PROFILES Cost: 1 Bytes: 9 Cardinality: 1
79 INDEX RANGE SCAN INDEX AR.HZ_CUSTOMER_PROFILES_N1 Cardinality: 1
82 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.HZ_CUST_PROFILE_CLASSES_U1 Bytes: 3 Cardinality: 1
85 TABLE ACCESS BY INDEX ROWID TABLE AR.HZ_CUST_ACCOUNTS Cost: 1 Bytes: 95 Cardinality: 1
84 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.HZ_CUST_ACCOUNTS_U1 Cardinality: 1
88 TABLE ACCESS BY INDEX ROWID TABLE AR.HZ_PARTY_SITES Cost: 1 Bytes: 23 Cardinality: 1
87 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.HZ_PARTY_SITES_U1 Cardinality: 1
91 TABLE ACCESS BY INDEX ROWID TABLE AR.HZ_LOCATIONS Cost: 1 Bytes: 106 Cardinality: 1
90 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.HZ_LOCATIONS_U1 Cardinality: 1
93 INDEX RANGE SCAN INDEX AR.HZ_LOC_ASSIGNMENTS_N1 Cost: 1 Bytes: 8 Cardinality: 1
96 TABLE ACCESS BY INDEX ROWID TABLE AR.HZ_PARTIES Cost: 1 Bytes: 91 Cardinality: 1
95 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.HZ_PARTIES_U1 Cardinality: 1
98 INDEX UNIQUE SCAN INDEX (UNIQUE) APPLSYS.FND_LOOKUP_VALUES_U1 Cost: 1 Bytes: 36 Cardinality: 1
100 INDEX UNIQUE SCAN INDEX (UNIQUE) AR.HZ_PARTIES_U1 Bytes: 4 Cardinality: 1
103 TABLE ACCESS BY INDEX ROWID TABLE AR.HZ_CONTACT_PREFERENCES Bytes: 47 Cardinality: 1
102 INDEX RANGE SCAN INDEX AR.HZ_CONTACT_PREFERENCES_N1 Cardinality: 1
105 INDEX RANGE SCAN INDEX AR.HZ_CONTACT_POINTS_N6 Cost: 1 Bytes: 23 Cardinality: 1
108 TABLE ACCESS BY INDEX ROWID TABLE AR.HZ_ORGANIZATION_PROFILES Cost: 1 Bytes: 19 Cardinality: 1
107 INDEX RANGE SCAN INDEX AR.HZ_ORGANIZATION_PROFILES_N1 Cardinality: 1
112 TABLE ACCESS BY INDEX ROWID TABLE AR.HZ_PERSON_PROFILES Cost: 2 Bytes: 19 Cardinality: 1
111 INDEX RANGE SCAN INDEX AR.HZ_PERSON_PROFILES_N1 Cost: 1 Cardinality: 1
159 VIEW VIEW APPS.XXAOC_SALES_REGION_VW Cost: 94 Bytes: 40 Cardinality: 4
158 SORT ORDER BY Cost: 94 Bytes: 2,736 Cardinality: 4
157 VIEW VIEW APPS.XXAOC_CT_KFF_VW Cost: 69 Bytes: 2,736 Cardinality: 4
156 SORT ORDER BY Cost: 69 Bytes: 800 Cardinality: 4
155 CONCATENATION
127 MERGE JOIN CARTESIAN Cost: 11 Bytes: 200 Cardinality: 1
123 NESTED LOOPS Cost: 5 Bytes: 82 Cardinality: 1
120 NESTED LOOPS Cost: 4 Bytes: 54 Cardinality: 1
118 TABLE ACCESS FULL TABLE APPLSYS.FND_ID_FLEX_SEGMENTS Cost: 4 Bytes: 28 Cardinality: 1
119 INDEX UNIQUE SCAN INDEX (UNIQUE) APPLSYS.FND_ID_FLEX_SEGMENTS_TL_U1 Bytes: 26 Cardinality: 1
122 TABLE ACCESS BY INDEX ROWID TABLE APPLSYS.FND_FLEX_VALUE_SETS Cost: 1 Bytes: 28 Cardinality: 1
121 INDEX UNIQUE SCAN INDEX (UNIQUE) APPLSYS.FND_FLEX_VALUE_SETS_U1 Cardinality: 1
126 BUFFER SORT Cost: 10 Bytes: 2,714 Cardinality: 23
125 TABLE ACCESS BY INDEX ROWID TABLE APPLSYS.FND_LOOKUP_VALUES Cost: 6 Bytes: 2,714 Cardinality: 23
124 INDEX RANGE SCAN INDEX (UNIQUE) APPLSYS.FND_LOOKUP_VALUES_U1 Cost: 2 Cardinality: 23
136 TABLE ACCESS BY INDEX ROWID TABLE APPLSYS.FND_LOOKUP_VALUES Cost: 6 Bytes: 2,714 Cardinality: 23
135 NESTED LOOPS Cost: 11 Bytes: 200 Cardinality: 1
133 NESTED LOOPS Cost: 5 Bytes: 82 Cardinality: 1
130 NESTED LOOPS Cost: 4 Bytes: 54 Cardinality: 1
128 TABLE ACCESS FULL TABLE APPLSYS.FND_ID_FLEX_SEGMENTS Cost: 4 Bytes: 28 Cardinality: 1
-
SharePoint 2010 Slow query duration when setting metadata on folder
I'm getting "Slow Query Duration" when I programmatically set a default value for a default field to apply to documents at a specified location on a SP 2010 library.
It has nothing to do with performance most probably as I'm getting this working with a folder within a library with only a 1 document on a UAT environment. Front-end: AMD Opteron 6174 2.20GHz x 2 + 8gb RAM, Back-end: AMD Opteron 6174 2.20GHz x 2 + 16gb
RAM.
The specific line of code causing this is:
folderMetadata.SetFieldDefault(createdFolder, fieldData.Field.InternalName, thisFieldTextValue);
What SP says:
02/17/2014 16:29:03.24 w3wp.exe (0x10D0) 0x0DB0 SharePoint Foundation Database fa42 Monitorable A large block of literal text was sent to sql. This can result in blocking in sql and excessive memory use on the front end. Verify that no binary parameters are
being passed as literals, and consider breaking up batches into smaller components. If this request is for a SharePoint list or list item, you may be able to resolve this by reducing the number of fields.
02/17/2014 16:29:03.24 w3wp.exe (0x10D0) 0x0DB0 SharePoint Foundation Database fa43 High Slow Query Duration: 254.705556153086
02/17/2014 16:29:03.26 w3wp.exe (0x10D0) 0x0DB0 SharePoint Foundation Database fa44 High Slow Query StackTrace-Managed: at Microsoft.SharePoint.Utilities.SqlSession.OnPostExecuteCommand(SqlCommand command, SqlQueryData monitoringData) at Microsoft.SharePoint.Utilities.SqlSession.ExecuteReader(SqlCommand
command, CommandBehavior behavior, SqlQueryData monitoringData, Boolean retryForDeadLock) at Microsoft.SharePoint.SPSqlClient.ExecuteQueryInternal(Boolean retryfordeadlock) at Microsoft.SharePoint.SPSqlClient.ExecuteQuery(Boolean retryfordeadlock) at Microsoft.SharePoint.Library.SPRequestInternalClass.PutFile(String
bstrUrl, String bstrWebRelativeUrl, Object punkFile, Int32 cbFile, Object punkFFM, PutFileOpt PutFileOpt, String bstrCreatedBy, String bstrModifiedBy, Int32 iCreatedByID, Int32 iModifiedByID, Object varTimeCreated, Object varTimeLastModified, Obje...
02/17/2014 16:29:03.26* w3wp.exe (0x10D0) 0x0DB0 SharePoint Foundation Database fa44 High ...ct varProperties, String bstrCheckinComment, Byte partitionToCheck, Int64 fragmentIdToCheck, String bstrCsvPartitionsToDelete, String bstrLockIdMatch, String bstEtagToMatch,
Int32 lockType, String lockId, Int32 minutes, Int32 fRefreshLock, Int32 bValidateReqFields, Guid gNewDocId, UInt32& pdwVirusCheckStatus, String& pVirusCheckMessage, String& pEtagReturn, Byte& piLevel, Int32& pbIgnoredReqProps) at Microsoft.SharePoint.Library.SPRequest.PutFile(String
bstrUrl, String bstrWebRelativeUrl, Object punkFile, Int32 cbFile, Object punkFFM, PutFileOpt PutFileOpt, String bstrCreatedBy, String bstrModifiedBy, Int32 iCreatedByID, Int32 iModifiedByID, Object varTimeCreated, Object varTimeLastModified, Object varProperties,
String bstrCheckinComment, Byte partitionToCheck, Int64 fragmentIdToCheck...
02/17/2014 16:29:03.26* w3wp.exe (0x10D0) 0x0DB0 SharePoint Foundation Database fa44 High ..., String bstrCsvPartitionsToDelete, String bstrLockIdMatch, String bstEtagToMatch, Int32 lockType, String lockId, Int32 minutes, Int32 fRefreshLock, Int32 bValidateReqFields,
Guid gNewDocId, UInt32& pdwVirusCheckStatus, String& pVirusCheckMessage, String& pEtagReturn, Byte& piLevel, Int32& pbIgnoredReqProps) at Microsoft.SharePoint.SPFile.SaveBinaryStreamInternal(Stream file, String checkInComment, Boolean checkRequiredFields,
Boolean autoCheckoutOnInvalidData, Boolean bIsMigrate, Boolean bIsPublish, Boolean bForceCreateVersion, String lockIdMatch, SPUser modifiedBy, DateTime timeLastModified, Object varProperties, SPFileFragmentPartition partitionToCheck, SPFileFragmentId fragmentIdToCheck,
SPFileFragmentPartition[] partitionsToDelete, Stream formatMetadata, String etagToMatch, Boolea...
02/17/2014 16:29:03.26* w3wp.exe (0x10D0) 0x0DB0 SharePoint Foundation Database fa44 High ...n bSyncUpdate, SPLockType lockType, String lockId, TimeSpan lockTimeout, Boolean refreshLock, Boolean requireWebFilePermissions, Boolean failIfRequiredCheckout, Boolean
validateReqFields, Guid newDocId, SPVirusCheckStatus& virusCheckStatus, String& virusCheckMessage, String& etagReturn, Boolean& ignoredRequiredProps) at Microsoft.SharePoint.SPFile.SaveBinary(Stream file, Boolean checkRequiredFields, Boolean
createVersion, String etagMatch, String lockIdMatch, Stream fileFormatMetaInfo, Boolean requireWebFilePermissions, String& etagNew) at Microsoft.SharePoint.SPFile.SaveBinary(Byte[] file) at Microsoft.Office.DocumentManagement.MetadataDefaults.Update()
at TWINSWCFAPI.LibraryManager.CreatePathFromFolderCollection(String fullPathUrl, SPListItem item, SPWeb web, Dictionary2...
02/17/2014 16:29:03.26* w3wp.exe (0x10D0) 0x0DB0 SharePoint Foundation Database fa44 High ... folderToCreate, Boolean setDefaultValues, Boolean mainFolder) at TWINSWCFAPI.LibraryManager.CreatePathFromFolderCollection(String fullPathUrl, List1 resultDataList,
SPListItem item, SPWeb web, Boolean setDefaultValues, Boolean mainFolder) at TWINSWCFAPI.LibraryManager.CreateExtraFolders(List1
pathResultDataList, List1 resultDataList, String fullPathUrl, SPWeb web, SPListItem item, Boolean setDefaultValues) at TWINSWCFAPI.LibraryManager.CreateFolders(SPWeb web, List1
pathResultDataList, SPListItem item, String path, Boolean setDefaultValues) at TWINSWCFAPI.LibraryManager.MoveFileAfterMetaChange(SPListItem item) at TWINSWCFAPI.DocMetadataChangeEventReceiver.DocMetadataChangeEventReceiver.FileDocument(SPWeb web, SPListItem
listItem) at TWINSWCFAPI.DocMetadataChang...
02/17/2014 16:29:03.26* w3wp.exe (0x10D0) 0x0DB0 SharePoint Foundation Database fa44 High ...eEventReceiver.DocMetadataChangeEventReceiver.ItemCheckedIn(SPItemEventProperties properties) at Microsoft.SharePoint.SPEventManager.RunItemEventReceiver(SPItemEventReceiver
receiver, SPUserCodeInfo userCodeInfo, SPItemEventProperties properties, SPEventContext context, String receiverData) at Microsoft.SharePoint.SPEventManager.RunItemEventReceiverHelper(Object receiver, SPUserCodeInfo userCodeInfo, Object properties, SPEventContext
context, String receiverData) at Microsoft.SharePoint.SPEventManager.<>c__DisplayClassc1.b__6() at Microsoft.SharePoint.SPSecurity.RunAsUser(SPUserToken userToken, Boolean bResetContext, WaitCallback code, Object param) at Microsoft.SharePoint.SPEventManager.InvokeEventReceivers[ReceiverType](SPUserToken
userToken, Gu...
02/17/2014 16:29:03.26* w3wp.exe (0x10D0) 0x0DB0 SharePoint Foundation Database fa44 High ...id tranLockerId, RunEventReceiver runEventReceiver, Object receivers, Object properties, Boolean checkCancel) at Microsoft.SharePoint.SPEventManager.InvokeEventReceivers[ReceiverType](Byte[]
userTokenBytes, Guid tranLockerId, RunEventReceiver runEventReceiver, Object receivers, Object properties, Boolean checkCancel) at Microsoft.SharePoint.SPEventManager.HandleEventCallback[ReceiverType,PropertiesType](Object callbackData) at Microsoft.SharePoint.Utilities.SPThreadPool.WaitCallbackWrapper(Object
state) at System.Threading.ExecutionContext.runTryCode(Object userData) at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) at System.Threading.ExecutionContext.Run(ExecutionContext
execu...
02/17/2014 16:29:03.26* w3wp.exe (0x10D0) 0x0DB0 SharePoint Foundation Database fa44 High ...tionContext, ContextCallback callback, Object state) at System.Threading._ThreadPoolWaitCallback.PerformWaitCallbackInternal(_ThreadPoolWaitCallback tpWaitCallBack)
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback(Object state)
02/17/2014 16:29:03.26 w3wp.exe (0x10D0) 0x0DB0 SharePoint Foundation Database tzku High ConnectionString: 'Data Source=PFC-SQLUAT-202;Initial Catalog=TWINSDMS_LondonDivision_Content;Integrated Security=True;Enlist=False;Asynchronous Processing=False;Connect
Timeout=15' ConnectionState: Open ConnectionTimeout: 15
02/17/2014 16:29:03.26 w3wp.exe (0x10D0) 0x0DB0 SharePoint Foundation Database tzkv High SqlCommand: 'DECLARE @@iRet int;BEGIN TRAN EXEC @@iRet = proc_WriteChunkToAllDocStreams @wssp0, @wssp1, @wssp2, @wssp3, @wssp4, @wssp5, @wssp6;IF @@iRet <> 0 GOTO
done; DECLARE @@S uniqueidentifier; DECLARE @@W uniqueidentifier; DECLARE @@DocId uniqueidentifier; DECLARE @@DoclibRowId int; DECLARE @@Level tinyint; DECLARE @@DocUIVersion int;DECLARE @@IsCurrentVersion bit; DECLARE @DN nvarchar(256); DECLARE @LN nvarchar(128);
DECLARE @FU nvarchar(260); SET @DN=@wssp7;SET @@iRet=0; ;SET @LN=@wssp8;SET @FU=@wssp9;SET @@S=@wssp10;SET @@W=@wssp11;SET @@DocUIVersion = 512;IF @@iRet <> 0 GOTO done; ;SET @@Level =@wssp12; EXEC @@iRet = proc_UpdateDocument @@S, @@W, @DN, @LN, @wssp13,
@wssp14, @wssp15, @wssp16, @wssp17, @wssp18, @wssp19, @wssp20, @wssp21, @wssp22, @wssp23, @wssp24, @wssp25, @wssp26,...
02/17/2014 16:29:03.26* w3wp.exe (0x10D0) 0x0DB0 SharePoint Foundation Database tzkv High ... @wssp27, @wssp28, @wssp29, @wssp30, @wssp31, @wssp32, @wssp33, @wssp34, @wssp35, @wssp36, @wssp37, @wssp38, @wssp39, @wssp40, @wssp41, @wssp42, @wssp43, @wssp44, @wssp45,
@wssp46, @wssp47, @wssp48, @wssp49, @wssp50, @wssp51, @@DocId OUTPUT, @@Level OUTPUT , @@DoclibRowId OUTPUT,@wssp52 OUTPUT,@wssp53 OUTPUT,@wssp54 OUTPUT,@wssp55 OUTPUT ; IF @@iRet <> 0 GOTO done; EXEC @@iRet = proc_TransferStream @@S, @@DocId, @@Level,
@wssp56, @wssp57, @wssp58; IF @@iRet <> 0 GOTO done; EXEC proc_AL @@S,@DN,@LN,@@Level,0,N'London/Broking/Documents/E/E _ E Foods Corporation',N'2012',72,85,83,1,N'';EXEC proc_AL @@S,@DN,@LN,@@Level,1,N'London/Broking/Documents/E',N'E _ E Foods Corporation',72,85,83,1,N'';EXEC
proc_AL @@S,@DN,@LN,@@Level,2,N'London/Broking/Documents/E/E _ E Foods Corporation',N'2013',72,85,...
02/17/2014 16:29:03.26* w3wp.exe (0x10D0) 0x0DB0 SharePoint Foundation Database tzkv High ...83,1,N'';EXEC proc_AL @@S,@DN,@LN,@@Level,3,N'London/Broking/Documents/E/E _ E Foods Corporation/2013',N'QA11G029601',72,85,83,1,N'';EXEC proc_AL @@S,@DN,@LN,@@Level,4,N'London/Broking/Documents/K',N'Konig
_ Reeker',72,85,83,1,N'';EXEC proc_AL @@S,@DN,@LN,@@Level,5,N'London/Broking/Documents/K/Konig _ Reeker',N'2012',72,85,83,1,N'';EXEC proc_AL @@S,@DN,@LN,@@Level,6,N'London/Broking/Documents/K/Konig _ Reeker/2012',N'QA12E013201',72,85,83,1,N'';EXEC proc_AL
@@S,@DN,@LN,@@Level,7,N'London/Broking/Documents/K/Konig _ Reeker/2012',N'A12EL00790',72,85,83,1,N'';EXEC proc_AL @@S,@DN,@LN,@@Level,8,N'London/Broking/Documents/K/Konig _ Reeker/2012',N'A12DA00720',72,85,83,1,N'';EXEC proc_AL @@S,@DN,@LN,@@Level,9,N'London/Broking/Documents/K/Konig
_ Reeker/2012',N'A12DC00800',72,85,83,1,N'';EXEC proc...
02/17/2014 16:29:03.26* w3wp.exe (0x10D0) 0x0DB0 SharePoint Foundation Database tzkv High ..._AL @@S,@DN,@LN,@@Level,10,N'London/Broking/Documents/A',N'Ace European Group Limited',72,85,83,1,N'';EXEC proc_AL @@S,@DN,@LN,@@Level,11,N'London/Broking/Documents/A/Ace
European Group Limited',N'2012',72,85,83,1,N'';EXEC proc_AL @@S,@DN,@LN,@@Level,12,N'London/Broking/Documents/A/Ace European Group Limited/2012',N'JXB88435',72,85,83,1,N'';EXEC proc_AL @@S,@DN,@LN,@@Level,13,N'London/Broking/Documents/A/Ace European Group
Limited/2012/JXB88435/Closings',N'PRM 1',72,85,83,1,N'';EXEC proc_AL @@S,@DN,@LN,@@Level,14,N'London/Broking/Documents/A/Ace European Group Limited/2012/JXB88435/Closings',N'PRM 2',72,85,83,1,N'';EXEC proc_AL @@S,@DN,@LN,@@Level,15,N'London/Broking/Documents/C',N'C
Moore-Gordon',72,85,83,1,N'';EXEC proc_AL @@S,@DN,@LN,@@Level,16,N'London/Broking/Documents/C/C Moore-Gordo...
02/17/2014 16:29:03.26* w3wp.exe (0x10D0) 0x0DB0 SharePoint Foundation Database tzkv High ...n',N'2012',72,85,83,1,N'';EXEC proc_AL @@S,@DN,@LN,@@Level,17,N'London/Broking/Documents/C/C Moore-Gordon/2012',N'QY13P700201',72,85,83,1,N'';EXEC proc_AL @@S,@DN,@LN,@@Level,18,N'London/Broking/Documents/C/C
Moore-Gordon',N'2013',72,85,83,1,N'';EXEC proc_AL @@S,@DN,@LN,@@Level,19,N'London/Broking/Documents/C/C Moore-Gordon/2013',N'Y13PF07010',72,85,83,1,N'';EXEC proc_AL @@S,@DN,@LN,@@Level,20,N'London/Broking/Documents/A/Ace European Group Limited/2012/JXB88435/Closings',N'ARP
7',72,85,83,1,N'';EXEC proc_AL @@S,@DN,@LN,@@Level,21,N'London/Broking/Documents/A/Ace European Group Limited/2012/JXB88435/Closings',N'ARP 8',72,85,83,1,N'';EXEC proc_AL . . .
Thanks in advance ASharePoint and SQL Server installed on same server or how is the setup?
i would start to enable the developer dashboard, analyze the report of the developer dashboard...
you will see if any webpart, or page or sql server query taking too much time.
http://www.sharepoint-journey.com/developer-dashboard-in-sharepoint-2013.html
Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog -
ADF: How to find out which query has taken what time?
Hi,
I have an ADF application which has many SQL queried running on each button click/page load, so how to find out which query is taking what amount of time? So that i can identify the long running queries and modify them to improve the application performance.
Thanks in advance.Hi,
As suggested by Timo,you need to start tracing on oracle.jbo package for getting the SQL queries.But I think the second option suggested by him would be better.You will have to override executeQueryForCollection method in VO Impl class .Pseudo code would be
@Override
Take start time
super.executeQueryForCollection
Take end time -
How to find out the query is accessing the DB tables or not
Hi Gurus ,
How to find out the query is accessing the DB tables or not.
Where exactly we will find this information in SAP BW.
I know that this information we can find in ST03. But where exactly we will find the query information along with DB information?Lakshmi
Activate BI Technical Content for Query analysis and run query against that.
Hope this helps
Thanks
sat -
Why is the finder so slow to update?
Why is my finder so slow to update. For example, if I download a file (using Safari), I can't find it on the desktop. If I use Find at the Finder level, it says it's there, but I can't see it.
Same thing happens with Mail, trying to attach a PDF I just made. Mail can't see it.
I love all the wondrous glitz of OSX, but wouldn't it be nice if it could do the basic stuff as well as System 6? At the rate Apple's going, we'll probably get a breathless announcement about a spanking-new OS called Snail, which doesn't do anything but look pretty.Stu Ducklow
Why is my finder so slow to update. For example, if I
download a file (using Safari), I can't find it on
the desktop. If I use Find at the Finder level, it
says it's there, but I can't see it.
Same thing happens with Mail, trying to attach a PDF
I just made. Mail can't see it.
I love all the wondrous glitz of OSX, but wouldn't it
be nice if it could do the basic stuff as well as
System 6? At the rate Apple's going, we'll probably
get a breathless announcement about a spanking-new OS
called Snail, which doesn't do anything but look
pretty.
Stu,
Did you ever get an answer to this? My finder is pathetically slow to update, a minor irritation a dozen times a day. System 9 never had this problem. Is there a way to get my expensive computer to do this simple task? Is there any news on this?
thanks, -
Hi,
I have a query which fetches around 100 records from a table which has approximately 30 million records. Unfortunately, I have to use the same table and can't go ahead with a new table.
The query executes within a second from RapidSQL. The problem I'm facing is it takes more than 10 minutes when I run it through the Java application. It doesn't throw any exceptions, it executes properly.
The query:
SELECT aaa, bbb, SUM(ccc), SUM(ddd), etc
FROM MyTable
WHERE SomeDate= date_entered_by_user AND SomeString IN ("aaa","bbb")
GROUP BY aaa,bbbI have an existing clustered index on SomeDate and SomeString fields.
To check I replaced the where clause with
WHERE SomeDate= date_entered_by_user AND SomeString = "aaa"No improvements.
What could be the problem?
Thank you,
LoboIt's hard for me to see how a stored proc will address this problem. I don't think it changes anything. Can you explain? The problem is slow query execution time. One way to speed up the execution time inside the RDBMS is to streamline the internal operations inside the interpreter.
When the engine receives a command to execute a SQL statement, it does a few things before actually executing the statement. These things take time. First, it checks to make sure there are no syntax errors in the SQL statement. Second, it checks to make sure all of the tables, columns and relationships "are in order." Third, it formulates an execution plan. This last step takes the most time out of the three. But, they all take time. The speed of these processes may vary from product to product.
When you create a stored procedure in a RDBMS, the processes above occur when you create the procedure. Most importantly, once an execution plan is created it is stored and reused whenever the stored procedure is ran. So, whenever an application calls the stored procedure, the execution plan has already been created. The engine does not have to anaylze the SELECT|INSERT|UPDATE|DELETE statements and create the plan (over and over again).
The stored execution plan will enable the engine to execute the query faster.
/> -
How to find out sender query by using receiver query in RRI
Hi,
I have do some assignment settings .I know receiver query name ,but i don't know sender query name .
please suggest me how to find out sender query name .
is there any table /t-code ?
Thanks,
EDK.....Hello,
If the receiver query is web report, then goto table RSBBSQUERY and in RONAM field put the web report name.
You will get the sender query UID in the field ELTUID.
Now take this UID and goto table RSRREPDIR and put this UID in COMPUID and you will get the query name.
If the reciever query is bex query then get the UUID as above from RSRREPDIR by providin the tech name and then go to table RSBBSQUERY to get the UID of the sender query.
Regards
Shashank -
Slow Query Using index. Fast with full table Scan.
Hi;
(Thanks for the links)
Here's my question correctly formated.
The query:
SELECT count(1)
from ehgeoconstru ec
where ec.TYPE='BAR'
AND ( ec.birthDate <= TO_DATE('2009-10-06 11:52:12', 'YYYY-MM-DD HH24:MI:SS') )
and deathdate is null
and substr(ec.strgfd, 1, length('[CIMText')) <> '[CIMText'Runs on 32 seconds!
Same query, but with one extra where clause:
SELECT count(1)
from ehgeoconstru ec
where ec.TYPE='BAR'
and ( (ec.contextVersion = 'REALWORLD') --- ADDED HERE
AND ( ec.birthDate <= TO_DATE('2009-10-06 11:52:12', 'YYYY-MM-DD HH24:MI:SS') ) )
and deathdate is null
and substr(ec.strgfd, 1, length('[CIMText')) <> '[CIMText'This runs in 400 seconds.
It should return data from one table, given the conditions.
The version of the database is Oracle9i Release 9.2.0.7.0
These are the parameters relevant to the optimizer:
SQL> show parameter optimizer
NAME TYPE VALUE
optimizer_dynamic_sampling integer 1
optimizer_features_enable string 9.2.0
optimizer_index_caching integer 99
optimizer_index_cost_adj integer 10
optimizer_max_permutations integer 2000
optimizer_mode string CHOOSE
SQL> Here is the output of EXPLAIN PLAN for the first fast query:
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes | Cost |
| 0 | SELECT STATEMENT | | | | |
| 1 | SORT AGGREGATE | | | | |
|* 2 | TABLE ACCESS FULL | EHCONS | | | |
Predicate Information (identified by operation id):
PLAN_TABLE_OUTPUT
2 - filter(SUBSTR("EC"."strgfd",1,8)<>'[CIMText' AND "EC"."DEATHDATE"
IS NULL AND "EC"."BIRTHDATE"<=TO_DATE('2009-10-06 11:52:12', 'yyyy
-mm-dd
hh24:mi:ss') AND "EC"."TYPE"='BAR')
Note: rule based optimizationHere is the output of EXPLAIN PLAN for the slow query:
PLAN_TABLE_OUTPUT
| |
| 1 | SORT AGGREGATE | | |
| |
|* 2 | TABLE ACCESS BY INDEX ROWID| ehgeoconstru | |
| |
|* 3 | INDEX RANGE SCAN | ehgeoconstru_VSN | |
| |
PLAN_TABLE_OUTPUT
Predicate Information (identified by operation id):
2 - filter(SUBSTR("EC"."strgfd",1,8)<>'[CIMText' AND "EC"."DEATHDATE" IS
NULL AND "EC"."TYPE"='BAR')
PLAN_TABLE_OUTPUT
3 - access("EC"."CONTEXTVERSION"='REALWORLD' AND "EC"."BIRTHDATE"<=TO_DATE('2
009-10-06
11:52:12', 'yyyy-mm-dd hh24:mi:ss'))
filter("EC"."BIRTHDATE"<=TO_DATE('2009-10-06 11:52:12', 'yyyy-mm-dd hh24:
mi:ss'))
Note: rule based optimizationThe TKPROF output for this slow statement is:
TKPROF: Release 9.2.0.7.0 - Production on Tue Nov 17 14:46:32 2009
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Trace file: gen_ora_3120.trc
Sort options: prsela exeela fchela
count = number of times OCI procedure was executed
cpu = cpu time in seconds executing
elapsed = elapsed time in seconds executing
disk = number of physical reads of buffers from disk
query = number of buffers gotten for consistent read
current = number of buffers gotten in current mode (usually for update)
rows = number of rows processed by the fetch or execute call
SELECT count(1)
from ehgeoconstru ec
where ec.TYPE='BAR'
and ( (ec.contextVersion = 'REALWORLD')
AND ( ec.birthDate <= TO_DATE('2009-10-06 11:52:12', 'YYYY-MM-DD HH24:MI:SS') ) )
and deathdate is null
and substr(ec.strgfd, 1, length('[CIMText')) <> '[CIMText'
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 2 0.00 538.12 162221 1355323 0 1
total 4 0.00 538.12 162221 1355323 0 1
Misses in library cache during parse: 0
Optimizer goal: CHOOSE
Parsing user id: 153
Rows Row Source Operation
1 SORT AGGREGATE
27747 TABLE ACCESS BY INDEX ROWID OBJ#(73959)
2134955 INDEX RANGE SCAN OBJ#(73962) (object id 73962)
alter session set sql_trace=true
call count cpu elapsed disk query current rows
Parse 0 0.00 0.00 0 0 0 0
Execute 1 0.00 0.02 0 0 0 0
Fetch 0 0.00 0.00 0 0 0 0
total 1 0.00 0.02 0 0 0 0
Misses in library cache during parse: 0
Misses in library cache during execute: 1
Optimizer goal: CHOOSE
Parsing user id: 153
OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
Parse 1 0.00 0.00 0 0 0 0
Execute 2 0.00 0.02 0 0 0 0
Fetch 2 0.00 538.12 162221 1355323 0 1
total 5 0.00 538.15 162221 1355323 0 1
Misses in library cache during parse: 0
Misses in library cache during execute: 1
OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
call count cpu elapsed disk query current rows
Parse 0 0.00 0.00 0 0 0 0
Execute 0 0.00 0.00 0 0 0 0
Fetch 0 0.00 0.00 0 0 0 0
total 0 0.00 0.00 0 0 0 0
Misses in library cache during parse: 0
2 user SQL statements in session.
0 internal SQL statements in session.
2 SQL statements in session.
Trace file: gen_ora_3120.trc
Trace file compatibility: 9.02.00
Sort options: prsela exeela fchela
2 sessions in tracefile.
2 user SQL statements in trace file.
0 internal SQL statements in trace file.
2 SQL statements in trace file.
2 unique SQL statements in trace file.
94 lines in trace file.Edited by: PauloSMO on 17/Nov/2009 4:21
Edited by: PauloSMO on 17/Nov/2009 7:07
Edited by: PauloSMO on 17/Nov/2009 7:38 - Changed title to be more correct.Although your optimizer_mode is choose, it appears that there are no statistics gathered on ehgeoconstru. The lack of cost estimate and estimated row counts from each step of the plan, and the "Note: rule based optimization" at the end of both plans would tend to confirm this.
Optimizer_mode choose means that if statistics are gathered then it will use the CBO, but if no statistics are present in any of the tables in the query, then the Rule Based Optimizer will be used. The RBO tends to be index happy at the best of times. I'm guessing that the index ehgeoconstru_VSN has contextversion as the leading column and also includes birthdate.
You can either gather statistics on the table (if all of the other tables have statistics) using dbms_stats.gather_table_stats, or hint the query to use a full scan instead of the index. Another alternative would be to apply a function or operation against the contextversion to preclude the use of the index. something like this:
SELECT COUNT(*)
FROM ehgeoconstru ec
WHERE ec.type='BAR' and
ec.contextVersion||'' = 'REALWORLD'
ec.birthDate <= TO_DATE('2009-10-06 11:52:12', 'YYYY-MM-DD HH24:MI:SS') and
deathdate is null and
SUBSTR(ec.strgfd, 1, LENGTH('[CIMText')) <> '[CIMText'or perhaps UPPER(ec.contextVersion) if that would not change the rows returned.
John -
Stumbled on the slow query, Can any one look into it, Y it is so slow
I just stumbled on the slow query . Can any one please guess why this querie is so slow, do i need to change anything in it
Pid=32521 Tid=2884070320 03/26/2011 07:54:19.176 - Cursor wm09_2_49107 took 27996 ms elapsed time and 27995 ms db time for 1 fetches. sql string:
SELECT ALLOC_INVN_DTL.ALLOC_INVN_DTL_ID, ALLOC_INVN_DTL.WHSE, ALLOC_INVN_DTL.SKU_ID, ALLOC_INVN_DTL.INVN_TYPE, ALLOC_INVN_DTL.PROD_STAT, ALLOC_INVN_DTL.BATCH_NBR, ALLOC_INVN_DTL.SKU_ATTR_1, ALLOC_INVN_DTL.SKU_ATTR_2, ALLOC_INVN_DTL.SKU_ATTR_3, ALLOC_INVN_DTL.SKU_ATTR_4, ALLOC_INVN_DTL.SKU_ATTR_5, ALLOC_INVN_DTL.CNTRY_OF_ORGN, ALLOC_INVN_DTL.ALLOC_INVN_CODE, ALLOC_INVN_DTL.CNTR_NBR, ALLOC_INVN_DTL.TRANS_INVN_TYPE, ALLOC_INVN_DTL.PULL_LOCN_ID, ALLOC_INVN_DTL.INVN_NEED_TYPE, ALLOC_INVN_DTL.TASK_TYPE, ALLOC_INVN_DTL.TASK_PRTY, ALLOC_INVN_DTL.TASK_BATCH, ALLOC_INVN_DTL.ALLOC_UOM, ALLOC_INVN_DTL.ALLOC_UOM_QTY, ALLOC_INVN_DTL.QTY_PULLD, ALLOC_INVN_DTL.FULL_CNTR_ALLOCD, ALLOC_INVN_DTL.ORIG_REQMT, ALLOC_INVN_DTL.QTY_ALLOC, ALLOC_INVN_DTL.DEST_LOCN_ID, ALLOC_INVN_DTL.TASK_GENRTN_REF_CODE, ALLOC_INVN_DTL.TASK_GENRTN_REF_NBR, ALLOC_INVN_DTL.TASK_CMPL_REF_CODE, ALLOC_INVN_DTL.TASK_CMPL_REF_NBR, ALLOC_INVN_DTL.ERLST_START_DATE_TIME, ALLOC_INVN_DTL.LTST_START_DATE_TIME, ALLOC_INVN_DTL.LTST_CMPL_DATE_TIME, ALLOC_INVN_DTL.NEED_ID, ALLOC_INVN_DTL.STAT_CODE, ALLOC_INVN_DTL.CREATE_DATE_TIME, ALLOC_INVN_DTL.MOD_DATE_TIME, ALLOC_INVN_DTL.USER_ID, ALLOC_INVN_DTL.PKT_CTRL_NBR, ALLOC_INVN_DTL.REQD_INVN_TYPE, ALLOC_INVN_DTL.REQD_PROD_STAT, ALLOC_INVN_DTL.REQD_BATCH_NBR, ALLOC_INVN_DTL.REQD_SKU_ATTR_1, ALLOC_INVN_DTL.REQD_SKU_ATTR_2, ALLOC_INVN_DTL.REQD_SKU_ATTR_3, ALLOC_INVN_DTL.REQD_SKU_ATTR_4, ALLOC_INVN_DTL.REQD_SKU_ATTR_5, ALLOC_INVN_DTL.REQD_CNTRY_OF_ORGN, ALLOC_INVN_DTL.PKT_SEQ_NBR, ALLOC_INVN_DTL.CARTON_NBR, ALLOC_INVN_DTL.CARTON_SEQ_NBR, ALLOC_INVN_DTL.PIKR_NBR, ALLOC_INVN_DTL.PULL_LOCN_SEQ_NBR, ALLOC_INVN_DTL.DEST_LOCN_SEQ_NBR, ALLOC_INVN_DTL.TASK_CMPL_REF_NBR_SEQ, ALLOC_INVN_DTL.SUBSTITUTION_FLAG, ALLOC_INVN_DTL.MISC_ALPHA_FIELD_1, ALLOC_INVN_DTL.MISC_ALPHA_FIELD_2, ALLOC_INVN_DTL.MISC_ALPHA_FIELD_3, ALLOC_INVN_DTL.CD_MASTER_ID FROM ALLOC_INVN_DTL WHERE ( ( ( ( ( ( ALLOC_INVN_DTL.TASK_CMPL_REF_CODE = :1 ) AND ( ALLOC_INVN_DTL.TASK_CMPL_REF_NBR = :2 ) ) AND ( ALLOC_INVN_DTL.SKU_ID = :3 ) ) AND ( ALLOC_INVN_DTL.CNTR_NBR = :4 ) ) AND ( ALLOC_INVN_DTL.STAT_CODE < 1 ) ) AND ( ALLOC_INVN_DTL.PULL_LOCN_ID IS NULL ) )
input variables
1: Address(0xabe74300) Length(0) Type(8) "2" - No Indicator
2: Address(0x8995474) Length(0) Type(8) "PERP014119" - No Indicator
3: Address(0xab331f1c) Length(0) Type(8) "MB57545217" - No Indicator
4: Address(0xab31e32c) Length(0) Type(8) "T0000000000000078257" - No Indicator784786 wrote:
I just stumbled on the slow query . Can any one please guess why this querie is so slow, do i need to change anything in it
Pid=32521 Tid=2884070320 03/26/2011 07:54:19.176 - Cursor wm09_2_49107 took 27996 ms elapsed time and 27995 ms db time for 1 fetches. sql string:
SELECT ALLOC_INVN_DTL.ALLOC_INVN_DTL_ID, ALLOC_INVN_DTL.WHSE, ALLOC_INVN_DTL.SKU_ID, ALLOC_INVN_DTL.INVN_TYPE, ALLOC_INVN_DTL.PROD_STAT, ALLOC_INVN_DTL.BATCH_NBR, ALLOC_INVN_DTL.SKU_ATTR_1, ALLOC_INVN_DTL.SKU_ATTR_2, ALLOC_INVN_DTL.SKU_ATTR_3, ALLOC_INVN_DTL.SKU_ATTR_4, ALLOC_INVN_DTL.SKU_ATTR_5, ALLOC_INVN_DTL.CNTRY_OF_ORGN, ALLOC_INVN_DTL.ALLOC_INVN_CODE, ALLOC_INVN_DTL.CNTR_NBR, ALLOC_INVN_DTL.TRANS_INVN_TYPE, ALLOC_INVN_DTL.PULL_LOCN_ID, ALLOC_INVN_DTL.INVN_NEED_TYPE, ALLOC_INVN_DTL.TASK_TYPE, ALLOC_INVN_DTL.TASK_PRTY, ALLOC_INVN_DTL.TASK_BATCH, ALLOC_INVN_DTL.ALLOC_UOM, ALLOC_INVN_DTL.ALLOC_UOM_QTY, ALLOC_INVN_DTL.QTY_PULLD, ALLOC_INVN_DTL.FULL_CNTR_ALLOCD, ALLOC_INVN_DTL.ORIG_REQMT, ALLOC_INVN_DTL.QTY_ALLOC, ALLOC_INVN_DTL.DEST_LOCN_ID, ALLOC_INVN_DTL.TASK_GENRTN_REF_CODE, ALLOC_INVN_DTL.TASK_GENRTN_REF_NBR, ALLOC_INVN_DTL.TASK_CMPL_REF_CODE, ALLOC_INVN_DTL.TASK_CMPL_REF_NBR, ALLOC_INVN_DTL.ERLST_START_DATE_TIME, ALLOC_INVN_DTL.LTST_START_DATE_TIME, ALLOC_INVN_DTL.LTST_CMPL_DATE_TIME, ALLOC_INVN_DTL.NEED_ID, ALLOC_INVN_DTL.STAT_CODE, ALLOC_INVN_DTL.CREATE_DATE_TIME, ALLOC_INVN_DTL.MOD_DATE_TIME, ALLOC_INVN_DTL.USER_ID, ALLOC_INVN_DTL.PKT_CTRL_NBR, ALLOC_INVN_DTL.REQD_INVN_TYPE, ALLOC_INVN_DTL.REQD_PROD_STAT, ALLOC_INVN_DTL.REQD_BATCH_NBR, ALLOC_INVN_DTL.REQD_SKU_ATTR_1, ALLOC_INVN_DTL.REQD_SKU_ATTR_2, ALLOC_INVN_DTL.REQD_SKU_ATTR_3, ALLOC_INVN_DTL.REQD_SKU_ATTR_4, ALLOC_INVN_DTL.REQD_SKU_ATTR_5, ALLOC_INVN_DTL.REQD_CNTRY_OF_ORGN, ALLOC_INVN_DTL.PKT_SEQ_NBR, ALLOC_INVN_DTL.CARTON_NBR, ALLOC_INVN_DTL.CARTON_SEQ_NBR, ALLOC_INVN_DTL.PIKR_NBR, ALLOC_INVN_DTL.PULL_LOCN_SEQ_NBR, ALLOC_INVN_DTL.DEST_LOCN_SEQ_NBR, ALLOC_INVN_DTL.TASK_CMPL_REF_NBR_SEQ, ALLOC_INVN_DTL.SUBSTITUTION_FLAG, ALLOC_INVN_DTL.MISC_ALPHA_FIELD_1, ALLOC_INVN_DTL.MISC_ALPHA_FIELD_2, ALLOC_INVN_DTL.MISC_ALPHA_FIELD_3, ALLOC_INVN_DTL.CD_MASTER_ID FROM ALLOC_INVN_DTL WHERE ( ( ( ( ( ( ALLOC_INVN_DTL.TASK_CMPL_REF_CODE = :1 ) AND ( ALLOC_INVN_DTL.TASK_CMPL_REF_NBR = :2 ) ) AND ( ALLOC_INVN_DTL.SKU_ID = :3 ) ) AND ( ALLOC_INVN_DTL.CNTR_NBR = :4 ) ) AND ( ALLOC_INVN_DTL.STAT_CODE < 1 ) ) AND ( ALLOC_INVN_DTL.PULL_LOCN_ID IS NULL ) )
input variables
1: Address(0xabe74300) Length(0) Type(8) "2" - No Indicator
2: Address(0x8995474) Length(0) Type(8) "PERP014119" - No Indicator
3: Address(0xab331f1c) Length(0) Type(8) "MB57545217" - No Indicator
4: Address(0xab31e32c) Length(0) Type(8) "T0000000000000078257" - No IndicatorWithout more information I cannot tell you why it is slow, but I can certainly tell you why it is impossible to read.
Just because sql allows unformatted query text does not mean it is a good idea. Why not bring some sanity to this for your own sake, not to mention that of people from whom you are expecting to actually read and analyze this mess. I wish someone could explain to me why people write these long stream-of-consciousness queries.
When posting to this forum you should use the code tags to bracket your code and preserve the formatting. Then the code should actually be formatted:
SELECT
ALLOC_INVN_DTL.ALLOC_INVN_DTL_ID,
ALLOC_INVN_DTL.WHSE,
ALLOC_INVN_DTL.SKU_ID,
ALLOC_INVN_DTL.INVN_TYPE,
ALLOC_INVN_DTL.PROD_STAT,
ALLOC_INVN_DTL.BATCH_NBR,
ALLOC_INVN_DTL.SKU_ATTR_1,
ALLOC_INVN_DTL.SKU_ATTR_2,
ALLOC_INVN_DTL.SKU_ATTR_3,
ALLOC_INVN_DTL.SKU_ATTR_4,
ALLOC_INVN_DTL.SKU_ATTR_5,
ALLOC_INVN_DTL.CNTRY_OF_ORGN,
ALLOC_INVN_DTL.ALLOC_INVN_CODE,
ALLOC_INVN_DTL.CNTR_NBR,
ALLOC_INVN_DTL.TRANS_INVN_TYPE,
ALLOC_INVN_DTL.PULL_LOCN_ID,
ALLOC_INVN_DTL.INVN_NEED_TYPE,
ALLOC_INVN_DTL.TASK_TYPE,
ALLOC_INVN_DTL.TASK_PRTY,
ALLOC_INVN_DTL.TASK_BATCH,
ALLOC_INVN_DTL.ALLOC_UOM,
ALLOC_INVN_DTL.ALLOC_UOM_QTY,
ALLOC_INVN_DTL.QTY_PULLD,
ALLOC_INVN_DTL.FULL_CNTR_ALLOCD,
ALLOC_INVN_DTL.ORIG_REQMT,
ALLOC_INVN_DTL.QTY_ALLOC,
ALLOC_INVN_DTL.DEST_LOCN_ID,
ALLOC_INVN_DTL.TASK_GENRTN_REF_CODE,
ALLOC_INVN_DTL.TASK_GENRTN_REF_NBR,
ALLOC_INVN_DTL.TASK_CMPL_REF_CODE,
ALLOC_INVN_DTL.TASK_CMPL_REF_NBR,
ALLOC_INVN_DTL.ERLST_START_DATE_TIME,
ALLOC_INVN_DTL.LTST_START_DATE_TIME,
ALLOC_INVN_DTL.LTST_CMPL_DATE_TIME,
ALLOC_INVN_DTL.NEED_ID,
ALLOC_INVN_DTL.STAT_CODE,
ALLOC_INVN_DTL.CREATE_DATE_TIME,
ALLOC_INVN_DTL.MOD_DATE_TIME,
ALLOC_INVN_DTL.USER_ID,
ALLOC_INVN_DTL.PKT_CTRL_NBR,
ALLOC_INVN_DTL.REQD_INVN_TYPE,
ALLOC_INVN_DTL.REQD_PROD_STAT,
ALLOC_INVN_DTL.REQD_BATCH_NBR,
ALLOC_INVN_DTL.REQD_SKU_ATTR_1,
ALLOC_INVN_DTL.REQD_SKU_ATTR_2,
ALLOC_INVN_DTL.REQD_SKU_ATTR_3,
ALLOC_INVN_DTL.REQD_SKU_ATTR_4,
ALLOC_INVN_DTL.REQD_SKU_ATTR_5,
ALLOC_INVN_DTL.REQD_CNTRY_OF_ORGN,
ALLOC_INVN_DTL.PKT_SEQ_NBR,
ALLOC_INVN_DTL.CARTON_NBR,
ALLOC_INVN_DTL.CARTON_SEQ_NBR,
ALLOC_INVN_DTL.PIKR_NBR,
ALLOC_INVN_DTL.PULL_LOCN_SEQ_NBR,
ALLOC_INVN_DTL.DEST_LOCN_SEQ_NBR,
ALLOC_INVN_DTL.TASK_CMPL_REF_NBR_SEQ,
ALLOC_INVN_DTL.SUBSTITUTION_FLAG,
ALLOC_INVN_DTL.MISC_ALPHA_FIELD_1,
ALLOC_INVN_DTL.MISC_ALPHA_FIELD_2,
ALLOC_INVN_DTL.MISC_ALPHA_FIELD_3,
ALLOC_INVN_DTL.CD_MASTER_ID
FROM ALLOC_INVN_DTL
WHERE (
( ALLOC_INVN_DTL.TASK_CMPL_REF_CODE = :1
AND ( ALLOC_INVN_DTL.TASK_CMPL_REF_NBR = :2
AND ( ALLOC_INVN_DTL.SKU_ID = :3
AND ( ALLOC_INVN_DTL.CNTR_NBR = :4
AND ( ALLOC_INVN_DTL.STAT_CODE < 1
AND ( ALLOC_INVN_DTL.PULL_LOCN_ID IS NULL
)Now, since you are only selecting from one table, there is no need to clutter up the query by qualifying every column name with the table name. Let's simplify with this:
SELECT
ALLOC_INVN_DTL_ID,
WHSE,
SKU_ID,
INVN_TYPE,
PROD_STAT,
BATCH_NBR,
SKU_ATTR_1,
SKU_ATTR_2,
SKU_ATTR_3,
SKU_ATTR_4,
SKU_ATTR_5,
CNTRY_OF_ORGN,
ALLOC_INVN_CODE,
CNTR_NBR,
TRANS_INVN_TYPE,
PULL_LOCN_ID,
INVN_NEED_TYPE,
TASK_TYPE,
TASK_PRTY,
TASK_BATCH,
ALLOC_UOM,
ALLOC_UOM_QTY,
QTY_PULLD,
FULL_CNTR_ALLOCD,
ORIG_REQMT,
QTY_ALLOC,
DEST_LOCN_ID,
TASK_GENRTN_REF_CODE,
TASK_GENRTN_REF_NBR,
TASK_CMPL_REF_CODE,
TASK_CMPL_REF_NBR,
ERLST_START_DATE_TIME,
LTST_START_DATE_TIME,
LTST_CMPL_DATE_TIME,
NEED_ID,
STAT_CODE,
CREATE_DATE_TIME,
MOD_DATE_TIME,
USER_ID,
PKT_CTRL_NBR,
REQD_INVN_TYPE,
REQD_PROD_STAT,
REQD_BATCH_NBR,
REQD_SKU_ATTR_1,
REQD_SKU_ATTR_2,
REQD_SKU_ATTR_3,
REQD_SKU_ATTR_4,
REQD_SKU_ATTR_5,
REQD_CNTRY_OF_ORGN,
PKT_SEQ_NBR,
CARTON_NBR,
CARTON_SEQ_NBR,
PIKR_NBR,
PULL_LOCN_SEQ_NBR,
DEST_LOCN_SEQ_NBR,
TASK_CMPL_REF_NBR_SEQ,
SUBSTITUTION_FLAG,
MISC_ALPHA_FIELD_1,
MISC_ALPHA_FIELD_2,
MISC_ALPHA_FIELD_3,
CD_MASTER_ID
FROM ALLOC_INVN_DTL
WHERE (
( TASK_CMPL_REF_CODE = :1
AND ( TASK_CMPL_REF_NBR = :2
AND ( SKU_ID = :3
AND ( CNTR_NBR = :4
AND ( STAT_CODE < 1
AND ( PULL_LOCN_ID IS NULL
)And finally, your WHERE clause is a simple string of AND conditions, there was no need to complicate it with all of the nested parentheses. Much simpler:
WHERE ALLOC_INVN_DTL.TASK_CMPL_REF_CODE = :1
AND ALLOC_INVN_DTL.TASK_CMPL_REF_NBR = :2
AND ALLOC_INVN_DTL.SKU_ID = :3
AND ALLOC_INVN_DTL.CNTR_NBR = :4
AND ALLOC_INVN_DTL.STAT_CODE < 1
AND ALLOC_INVN_DTL.PULL_LOCN_ID IS NULL
None of the above makes a whit of difference in your query performance, but if you worked in my office, I would make you clean it up before I even attempted to do a performance analysis.
Edited by: EdStevens on Mar 26, 2011 2:14 PM -
Unable to find the Taxonomy Query Editor
As said at point 5 on the netweaver help it try to find the taxonomy query editor but without success
http://help.sap.com/saphelp_nw04/helpdata/en/6c/5145b1d1de11d6b2cc00508b6b8b11/frameset.htm
What is the full navigational path to access them ?
Thank's
Laurent.Hi LAurent,
in a SAP NetWeaver '04 PPortal, the path would be <i>Content Management - Classification - Taxonomy Query Builder</i>. That is, if you have a role assigned to your user that contains <i>Content Management</i>.
Regards,
Karsten -
To Find the SAP Query from the tranaction code or the program name
Hi,
I have a situation wherein I have to modify the sap query associated with an transaction code.But the problem is that I am unable to find the SAP Query.
<b>Please let me know how to find the SAP query from the transaction code or the program name.</b>
Thanks and Regards,
RupeshHi Rupesh,
1 use FM
RSAQ_DECODE_REPORT_NAME
2. This is one of the best and easiest way.
3. It will provide u the following info.
WORKSPACE
USERGROUP
QUERY
CLIENT
4. Thru TCode U must know the program name first.
This can be discovered using SE93.
Hope it helps.
Regards,
Amit M. -
How to find last executed query
Hello,
I want to find the last executed query in the Oracle database.
Can anybody help me, how can I find last fired query.
I am using following query for it, but it gives me the same query as in the result.
SELECT SQL_TEXT FROM V$SQL
WHERE ADDRESS = (SELECT SQL_ADDRESS
FROM V$SESSION
WHERE AUDSID = USERENV('SESSIONID'))
Please help me.Thanks.Hi,
select sa.sql_text,ss.username
from v$session ss, v$sqlarea sa
where sa.hash_value = ss.prev_hash_value
SQL> /
SQL_TEXT
USERNAME
DELETE FROM T
HR
GRANT SELECT ON T TO
HR
SELECT COUNT(*) FROM HR.T
SCOTT
SQL_TEXT
USERNAME
select sa.sql_text,ss.username from v$session ss, v$sqlarea sa where sa.hash_val
ue = ss.prev_hash_value
SYSregards
Taj
Message was edited by:
Mohammad Taj -
How do I find out which query are running??
My client is connecting to the database and running application through the web. From the Unix system, I know his job took 99% of CPU time and running for 1 hour already. Is there anyway I can find out which query are running in the Oracle?? So I can tune this query?? thanks..
Hi,
You can use the following query to identify it.
set linesize 100
set pagesize 100
SELECT substr(sql_text,1,40) sql,executions, rows_processed,
rows_processed/executions "Rows/Exec",
hash_value,address
FROM V$SQLAREA WHERE executions > 100 AND rownum <= 10
ORDER BY executions DESC;
Rgds,
Dhana
Maybe you are looking for
-
Help with 2 simultaneous internal users trying to VPN (Cisco s/w) to extern
Hello all, We are a small office running Small Business Server 2003 - which means we're running the ISA 2004 firewall. An external company has provided us with Cisco VPN software (ver403a) to access their network/secure web site. A single user has be
-
Hi Gurus When downloading any pdf file from the web using adobe Reader X the file name dialog box populates with incorrect file name compared to the saved file name of the document downloaded. Clarity 1. Download any pdf file from the web 2. Click Fi
-
Integrate or connect SAP system to non-SAP system
Hi All, We need to connect SAP system or integrate inspHire rental software to SAP. Do you know the process or initial summary on how to integrate this one? As of now, the only way that we know to integrate SAP to non-SAP for posting is thru LSMW and
-
I had to shift from win 7 to win xp. On iTunes on win 7 videos in mp4 format were synced without any problem, where on win xp the same mp4 files cannot be synced. Why? Can any one help me out?
-
Not to convert planned orders into production orders.
I donot want to convert all the planned orders in a plant into production orders on a specific date only ( SAY on 5th Oct -2007 planned orders should not be converted to production orders in a particular plant).pl tell me what cu