Expensive SQL statements & no proper indexing INCLUDE LBSVAU14-BSVA FuncGrp
Expensive SQL statements & no proper indexing INCLUDE LBSVAU14 - Function Group BSVA (Status management)
Hi there Forum
During a recent upgrade we have implemented EhP4 with relevant Support Packs.
Our Early Watch Report nows highlights INCLUDE LBSVAU14 as having expensive SQL statements along with improper indexing.
Although I have seached through OSS and Forums I can find nothing of help.
Is there an EXPERT out there who can help because SAP tell me that is the way it works!
Thanks.
Carl Cavendish-Davies
Herewith the latest results from the Early Watch report on this:
Object Type Total Executions Disk Reads Elapsed Time Buffer Gets Records Processed
TABLE 457663 3282704 21081305 28310151 20031340
SELECT
FROM
"JEST"
WHERE
"MANDT" = :A0 AND "OBJNR" IN ( :A1 , :A2 , :A3 , :A4 , :A5 )&
Execution Plan
V$SQL_PLAN addr= C000000774FF4038 hash= 3408408745 sql_id 4w93fuv5khc59
SELECT STATEMENT Estimated Costs= 3 Estimated Rows= 0 Optimizer: ALL_ROWS
3 INLIST ITERATOR
2 TABLE ACCESS BY INDEX ROWID JEST
Estimated Costs= 3 Estimated Rows= 10 Estim. Bytes: 330
Estim. CPU-Costs = 20,886 Estim. IO-Costs = 3
1 INDEX RANGE SCAN JEST~0
Estimated Costs= 1 Estimated Rows= 10 Access predicates:
"MANDT"=:A0 AND (("OBJNR"=:A1 OR "OBJNR"=:A2 OR "OBJNR"=:A3 OR "OBJNR"=:A4
OR "OBJNR"=:A5)) Search Columns: 2 Estim. CPU-Costs = 6,137 Estim. IO-Costs = 1
Program Data:
Origin of ABAP coding
Program Name Line Created By Last Changed By Last Changed On
LBSVAU14 110 SAP SAP 08.04.2007
000110 SELECT * FROM JEST CLIENT SPECIFIED
000111 APPENDING TABLE JEST_BUF
000112 FOR ALL ENTRIES IN OBJNR_TAB
000113 WHERE MANDT EQ CLIENT
000114 AND OBJNR = OBJNR_TAB-OBJNR.
Similar Messages
-
Expensive SQL statements & no proper indexing INCLUDE LBSVAF14-BSVA FuncGrp
Expensive SQL statements & no proper indexing INCLUDE LBSVAF14 - Function Group BSVA (Status management)
Hi there Forum
During a recent upgrade we have implemented EhP4 with relevant Support Packs.
Our Early Watch Report nows highlights INCLUDE LBSVAF14 as having expensive SQL statements along with improper indexing.
Although I have seached through OSS and Forums I can find nothing of help.
Is there an EXPERT out there who can help because SAP tell me that is the way it works!
Thanks.
Carl Cavendish-DaviesHerewith the latest results from the Early Watch report on this:
Cache Statistics
Object Type Total Executions Disk Reads Elapsed Time Buffer Gets Records Processed
TABLE 1716707 1854501 13325961 25580720 19606427
SELECT
FROM
"JEST"
WHERE
"MANDT" = :A0 AND "OBJNR" = :A1&
Execution Plan
V$SQL_PLAN addr= C000000774FF4038 hash= 3408408745 sql_id 4w93fuv5khc59
SELECT STATEMENT Estimated Costs= 2 Estimated Rows= 0 Optimizer: ALL_ROWS
2 TABLE ACCESS BY INDEX ROWID JEST
Estimated Costs= 1 Estimated Rows= 2 Estim. Bytes: 66
Estim. CPU-Costs = 8,804 Estim. IO-Costs = 1
1 INDEX RANGE SCAN JEST~0
Estimated Costs= 1 Estimated Rows= 2
Access predicates: "MANDT"=:A0 AND "OBJNR"=:A1 Search Columns: 2
Estim. CPU-Costs = 5,817 Estim. IO-Costs = 1
Program Data:
Origin of ABAP coding
Program Name Line Created By Last Changed By Last Changed On
LBSVAF14 81 SAP SAP 08.04.2007
000080 * Einzelstatus von DB lesen in interne Tabelle
000081 SELECT * FROM JEST CLIENT SPECIFIED
000082 APPENDING TABLE JEST_TAB
000083 WHERE MANDT = MANDT
000084 AND OBJNR = OBJNR. -
Expensive SQL statements & no proper indexing INCLUDE LPSSTU03-PSST FuncGrp
Hi there forum
During a recent upgrade we have implemented EhP4 with relevant Support Packs.
Our Early Watch Report nows highlights INCLUDE LPSSTU03 in Function Module Group PSST as having expensive SQL statements along with improper indexing.
Although I have seached through OSS and Forums I can find nothing of help.
Is there an EXPERT out there who can help because SAP tells me that is the way it works!
Thanks.
Carl Cavendish-DaviesHerewith the latest results from the Early Watch report on this issue:
Object Type Total Executions Disk Reads Elapsed Time Buffer Gets Records Processed
TABLE 242481 1873373 12035981 36237218 34390383
SELECT
"MANDT" , "OBJNR" , "STAT" , "CHGNR" , "USNAM" , "UDATE" , "UTIME" , "TCODE" , "CDTCODE" , "INACT" , "CHIND"
FROM
"JCDS"
WHERE
"MANDT" = :A0 AND "OBJNR" IN ( :A1 , :A2 , :A3 , :A4 , :A5 )&
Execution Plan
V$SQL_PLAN addr= C000000774FF4038 hash= 3408408745 sql_id 4w93fuv5khc59
SELECT STATEMENT Estimated Costs= 6 Estimated Rows= 0 Optimizer: ALL_ROWS
3 INLIST ITERATOR
2 TABLE ACCESS BY INDEX ROWID JCDS
Estimated Costs= 5 Estimated Rows= 28 Estim. Bytes: 1,848
Estim. CPU-Costs = 41,426 Estim. IO-Costs = 5
1 INDEX RANGE SCAN JCDS~0
Estimated Costs= 1 Estimated Rows= 28 Access predicates:
"MANDT"=:A0 AND (("OBJNR"=:A1 OR "OBJNR"=:A2 OR "OBJNR"=:A3 OR "OBJNR"=:A4
OR "OBJNR"=:A5)) Search Columns: 2 Estim. CPU-Costs = 6,777 Estim. IO-Costs = 1
Program Data:
Origin of ABAP coding
Program Name Line Created By Last Changed By Last Changed On
LPSSTU03 44 SAP SAP 25.03.2003
000044 SELECT * FROM JCDS
000045 APPENDING CORRESPONDING FIELDS OF TABLE T_JCDS
000046 FOR ALL ENTRIES IN R_OBJNR
000047 WHERE OBJNR = R_OBJNR-OBJNR. -
Expensive SQL statements & no proper indexing in INCLUDE LV70AF01-SAPLV70A
Hi there forum
During a recent upgrade we have implemented EhP4 with relevant Suppoert Packs.
Our Early Watch Report nows highlights INCLUDE LV70AF01 in Module SAPLV70A as havinf a multitude of expensive SQL statements along with improper indexing.
Although I have seached through OSS and Forums I can find nothing of help.
Is there an EXPERt out there who can help because SAP tell me that is the way it works!
Thanks.
Carl Cavendish-DaviesHerewith the results of our latest Early Watch report on this issue:
Statement Data:
Cache Statistics
Object Type Total Executions Disk Reads Elapsed Time Buffer Gets Records Processed
TABLE 261 1107862 11465343 170865092 4
SELECT
FROM
"NAST"
WHERE
"MANDT" = :A0 AND "KAPPL" = :A1 AND "KSCHL" = :A2 AND "NACHA" = :A3 AND "VSTAT" = :A4 AND "VSZTP" = :A5 AND "AKTIV" = :A6&
Execution Plan
V$SQL_PLAN addr= C000000774FF4038 hash= 3408408745 sql_id 4w93fuv5khc59
SELECT STATEMENT Estimated Costs= 1,338 Estimated Rows= 0 Optimizer: ALL_ROWS
2 TABLE ACCESS BY INDEX ROWID NAST
Estimated Costs= 1,338 Estimated Rows= 150
Filter predicates: ("NACHA"=:A3 AND "VSTAT"=:A4 AND "VSZTP"=:A5)
Estim. Bytes: 41,700 Estim. CPU-Costs = 13,539,142 Estim. IO-Costs = 1,336
1 INDEX RANGE SCAN NAST~I
Estimated Costs= 19 Estimated Rows= 8,093 Filter predicates: "AKTIV"=:A6
Access predicates: "MANDT"=:A0 AND "KAPPL"=:A1 AND "KSCHL"=:A2 AND "AKTIV"=:A6
Search Columns: 4 Estim. CPU-Costs = 988,073 Estim. IO-Costs = 19
Program Data:
Origin of ABAP coding
Program Name Line Created By Last Changed By Last Changed On
LV70AF01 930 SAP SAP 07.06.2001
000930 SELECT * FROM nast INTO TABLE ct_messages
000931 WHERE kappl IN irt_application
000932 AND kschl IN irt_type
000933 AND nacha IN irt_medium
000934 AND vstat IN irt_status
000935 AND vsztp IN irt_timing
000936 AND aktiv EQ space. -
Hi all,
Am a new bee to this group I'll be greateful if any one help me in understanding about the Expensive SQL Statements.why n where thy r used
Thanks..
MohammedHi shankaran,
1. Is there any way in finding out the expensive sql statements been used in a program.
There is no direct way to find out.
2. Only when the program is run,
and thru basis tcodes/performance testing tcodss,
can we know whether some sqls are very heavy !
3. PERFORMANCE TUNING IS VERY SENSITIVE TOPIC
4. There are some basic recommendatations.
a) don't use select *, just use select fied1,field2
b) Incrase the fileter criteria (ie. more where conditions to narrow down the search cretierai)
c) Create secondar indexes on columns
of tables, which are frequently
used in programs.
regards,
amit m. -
Hi Guys,
I have just received an email from our basis team where they said I am using an expensive SQL statement.
There is a loop on a table of people with the following statement
SELECT * FROM catsdb INTO TABLE w_cats
WHERE arbid EQ i_data-arbid
AND raufpl EQ i_data-aufpl
AND raplzl EQ i_data-aplzl
AND workdate IN s_wdate
AND status EQ '30'.
Is it me or is this the quickest way possible??
Can anyone think of a better way to do this??
Thanks ExpertsFirst of all, did you ever hear about indices? Please check whether there is an index (SE11) with has fields of your WHERE-condition.
=> if this is not the case the it will be slow, until an index is created.
Second, change the LOOP into a FOR ALL ENTRIES, don't forget to check whether the itab is initial. -
Expensive SQL statements in GTS
Hi,
Recently EWA has been run for the GTS system.There are expensive SQL statements that were causing the Performance issue.It would be a great help if anyone can advise on how these expensive SQL statments can be fine tuned. As all these statements were in standard SAP programs is it that we had the only option to create secondary indices ?
Moderator message - Please respect the 5,000 character maximum when posting. Post only the relevant portions of code
Please see Please Read before Posting in the Performance and Tuning Forum before posting
Any suggestion on performance improvement is appreciated.
Thanks in advance!!
Regards,
Sharon.
Edited by: Rob Burbank on Nov 15, 2010 9:08 AMplease ask specific questions.
Otherwise there are services by SAP, either training or support, but they are not for free.
Siegfried -
Expensive SQL statements in EWA
Hi experts,
how can I add expensive SQL statements to Early watch alert reports? In my IDES system this is generated automatically but not for different other systems. Can this be activated by specific settings?
Thanks and best regards, BastiHi bd,
Please check these points:
What database are you using?
What is the version of the ST-SER in your solution manager?
Is the service preparation finished in the managed system(run se38 -> RTCCTOOL to check)?
Have you checked note 1564508?
Besides that, do you see any issue in the SDCCN collection logs for the EWA?
Regards,
Daniel. -
EarlyWatch - Expensive SQL Statements help
Hi all,
i need to analyze an EWA report and i don't know how exactly can i identify an "expensive SQL statement".
The report says:
During this session, the following expensive SQL statements were identified as causing a database load of at least 1%.
The corresponding stored procedure names are referenced in the table below.
And in the table with stored procedure names, a row looks like this:
ID Stored Procedure Name
1 ##Y4DCWWES7EHY100000053960000254832042037
What does it mean and how can i identify the name of program and the exact statement (probably select) that is causing this problem?
Thank you,
OndrejHi Ondrej,
you're running on SQL Server. SAP creates stored procedures for each and every statement run against the database. The name you get seems to be a temporary stored procedure which (if I'm not wrong) is marked by the two # characters at the beginning. You may be still find it in the stored procedures of your system.
Open the Enterprise Manager and open your database, then the stored procedure link (you should run the Enterprise Manager on the server or on a PC with enough RAM). The search for the procedure and double click on it. I think that should show you the SQL statement. There should also the report name is a comment.
Regards
Ralph -
Expensive SQL Statements of the day?
Hi...
How can i find out Expensive SQL Statements of the day please.?
Our SAP Version is ECC 6.0 on Oracle 10.2.0.4.0
RgdsHi Srinivas,
On ECC 6.0, go to ST04 t-code --> performance --> SQL Cache --> You see SQL Statements where you need to sort by SQL Statements by Total Execution Time(ms).
I have tried on one of my R/3 4.7EE system, ST04n --> Resource COnsumption --> Top SQL Statements --> you will see 50 Top most expensive SQL Statements interms of wait time.
also Read: [Re: Diagnosis of the expensive ABAP programs having database time > 90%;
[Please Read before Posting in the Performance and Tuning Forum;
Regards,
Kanthi Kiran -
High Database server load from expensive SQL statements
Dear all,
I am facing problem in the production sever there is high Database server load from expensive SQL statements as per EVA report
Buffer Load [%] Disk Load [%] CPU Load [%]
55 69 0
Analysis of DB SQL CACHE
EXPENSIVE SQL STATEMENTS OVERVIEW
Object Name CPU Load [%] I/O Load [%] Elapsed Time [%] Executions Records Processed
BSIS 1 9 0 22 90462
CDEF$ 6 6 0 2131113 2575694
BSAD 1 3 0 21 408576
MKPF 1 32 0 180 3899
ICOL$ 9 1 0 2575694 8703798
OBJ$ 6 1 0 3405254 3400023
COL$ 12 0 0 2138793 22919657
MKPF 1 13 0 75 396
MCHB 7 0 0 366543 41708
Please suggest the step by step to reduce the expensive SQL from these table.
RegardsHi,
In tx code ST05 i have find the following deatails.
Duration |Obj. name |Op. |Recs.|RC |Statement
4 TSP03A REOPEN 0 SELECT WHERE "NAME" = 'LOCL' AND "P" = 'S_CLIENTS' 344 TSP03A FETCH 1 0 42 ZRIN DECLARE 0 SELECT WHERE "MANDT" = :A0 AND "BCQ" = :A1 442 ZRIN PREPARE 0 SELECT WHERE "MANDT" = :A0 AND "BCQ" = :A1 3 ZRIN OPEN 0 SELECT WHERE "MANDT" = '600' AND "BCQ" = 'BCQ'
2,181,565 ZRIN FETCH 4 1403
706,267 DBA_SEGME FETCH 99 0 8,248 DBA_SEGME FETCH 99 0 44,994 DBA_SEGME FETCH 99 0 67,713 DBA_SEGME FETCH 99 0
1,367,923 DBA_SEGME FETCH 99 0
16,735|TADIR |FETCH | 1| 1403| |
5
TADIR
REOPEN
0
SELECT WHERE "PGMID" = 'R3TR' AND "OBJECT" = 'TABL' AND "OBJ_NAME" = 'CME__TEXT'
22,415
TADIR
FETCH
1
1403
4
TADIR
REOPEN
0
SELECT WHERE "PGMID" = 'R3TR' AND "OBJECT" = 'TABL' AND "OBJ_NAME" = 'CME_PATTERN_SIGN'
232
TADIR
FETCH
1
1403
4
TADIR
REOPEN
0
SELECT WHERE "PGMID" = 'R3TR' AND "OBJECT" = 'TABL' AND "OBJ_NAME" = 'CML_ARC_DEADLINE'
19,189
TADIR
FETCH
1
1403
4
TADIR
REOPEN
706,267
DBA_SEGME
FETCH
99
0
|
44,994
DBA_SEGME
FETCH
99
0
67,713
DBA_SEGME
FETCH
99
0
Please suggest how to reduce it.
Regards, -
How to monitor perticuler sql statement using the INDEX or not?
I am running on a long running quary, and the output is comming very late. So i want to know the sql quary is using the index or not? How to know that?
If you want to check the real execution plan of a running query without waiting for query completion, you can try following steps that you should adapt to your query and your environment:
1. start the query
select
count(*)
from all_objects, all_objects;2. Retrieve in another session the SQL_ID and the CHILD_NUMBER of the running query:
select sql_id, child_number, sql_text
from v$sql
where sql_text like '%all_objects%';3. use DBMS_XPLAN.DISPLAY_CURSOR to get the real execution plan from shared pool using SQL_ID and CHILD_NUMBER from step 2:
select * from table(dbms_xplan.display_cursor(<sql_id>,<child_number>));Actually you don't need to restart the query if it is already running because the hint GATHER_PLAN_STATISTICS is only needed if you want to have current execution statistics.
Edited by: P. Forstmann on 2 mars 2011 10:23 -
Need to take monthly report for SQL statements...Is there any possiblity?
Hi,
We have a requirement to find out the list of expensive sql statements in our ECC 6.0 system.
I am aware that we can see expensive sql statements which are being executed online in the TCode ST04 or DB02old.
But I want the list of statements on a monthly wise.
Is there any possibility to find out the list of expensive sql statements for the previous 3 to 4 months?If so, how do we do that?
Any report or Tcode with navigations.
Please help.
Regards,
Sudheer.Hi,
> We have a requirement to find out the list of expensive sql statements in our ECC 6.0 system.
nice.
> I am aware that we can see expensive sql statements which are being executed online in the TCode ST04 or DB02old.
expensive SQL in DB02, really?
> But I want the list of statements on a monthly wise.
> Is there any possibility to find out the list of expensive sql statements for the previous 3 to 4 months?
> If so, how do we do that?
Up to now there is no transaction available with such information. The databases partially offer solutions.
These are switched on by default of have to be setup before they could be used. So it depends on the
database and the database version which are you using.
On ORACLE 10g for example we have the AWR (Automatic Workload Repository) which should be switched on by default (depends again on the license). On ORACLE 9i statspack is available but has to be activated first.
On DB6 (latest database and SAP release) we have the so called performance warehouse.
On other databases there might be solutions too.
Besides that you can always built your own solution and grab the top 10 SQL statements from the SQL cache and
persist them in regular intervals. I have seen such solutions as well.
Kind regards,
Hermann -
I have following query to identify top expensive sql statements.
SELECT Substr(a.sql_text,1,50) sql_text,
Trunc(a.disk_reads/Decode(a.executions,0,1,a.executions)) reads_per_execution,
a.buffer_gets,
a.disk_reads,
a.executions,
a.sorts,
a.address
FROM v$sqlarea a
ORDER BY 2 DESC
However, I have a need to fetch corresponding session information that are running these queries. Is there a way I can connect v$sqlarea with v$session?
Thanks,
RYou should use hash_value and sql_address as there can be more sqls with same hash value but different address.
This might give you some idea for improvement:
-- sessions and other useful stuff
SELECT s.SID SID, s.serial# serial, s.status status,
(i.block_gets + i.consistent_gets) logical_reads,
i.consistent_gets consistent_gets, i.block_gets block_gets,
i.physical_reads physical_reads,
(i.block_changes + i.consistent_changes) block_changes,
NVL (DECODE (TYPE,
'BACKGROUND', 'SYS (' || b.NAME || ')',
s.username
SUBSTR (p.program, INSTR (p.program, '('))
) oracle_user,
s.process client_pid, s.machine machine, p.spid server_pid,
NVL (s.osuser, '(' || b.NAME || ')') os_user,
s.program client_program, s.logon_time logon_time,
s.username user_name, s.module module,
q.sql_text,
s.sql_address sql_address, s.sql_hash_value sql_hash_value
FROM v$session s,
v$process p,
v$sess_io i,
v$bgprocess b,
v$sqlarea q
WHERE p.addr = s.paddr
AND i.SID = s.SID
AND p.addr = b.paddr(+)
AND q.address(+) = s.sql_address
AND q.hash_value(+) = s.sql_hash_value
AND TYPE != 'BACKGROUND'
ORDER BY user_nameThis will work also on older versions of the database <= 9i.
HTH, Joze
Co-author of the forthcoming book "Expert Oracle Practices"
http://www.apress.com/book/view/9781430226680
Oracle related blog: http://joze-senegacnik.blogspot.com/
Blog about flying: http://jsenegacnik.blogspot.com/
Blog about Building Ovens, Baking and Cooking: http://senegacnik.blogspot.com
Edited by: Joze Senegacnik on 10.12.2009 0:27 -
SQL statement that includes LEFT & RIGHT JOIN in the same statement??? Help
Hi,
How an I write an SQL statement with a GROUP BY that will both (a) include the NULL value from the left hand table, but also (b) include ALL columns from the right hand table. It's like I need a LEFT JOIN and a RIGHT JOIN in the query at the same time.
Here's an example of the 2 tables I have and the result I'm after. As you can see I want the NULL's from Expenses Table summed, as well as include all categories from the right hand table (i.e. even if there are no expenses against them)
Table = Expenses
Amount Category
$10 1
$20 2
$30 1
$40 NULL {i.e. not yet categorised}
Table = Categories
ID Title
1 Food
2 Entertainment
3 Travel
4 Personal
REQUIRED RESULT
Category Total
Food 40
Entertainment 20
Travel 0
Personal 0
NULL 40
ThanksSQL> create table expenses (amount,category)
2 as
3 select 10, 1 from dual union all
4 select 20, 2 from dual union all
5 select 30, 1 from dual union all
6 select 40, null from dual
7 /
Table created.
SQL> create table categories (id,title)
2 as
3 select 1, 'Food' from dual union all
4 select 2, 'Entertainment' from dual union all
5 select 3, 'Travel' from dual union all
6 select 4, 'Personal' from dual
7 /
Table created.
SQL> select c.title category
2 , nvl(sum(e.amount),0) total
3 from expenses e
4 full outer join categories c on (e.category = c.id)
5 group by c.id
6 , c.title
7 order by c.id
8 /
CATEGORY TOTAL
Food 40
Entertainment 20
Travel 0
Personal 0
40
5 rows selected.Regards,
Rob.
Maybe you are looking for
-
HTTP Headers - enabling caching and compression with the portal?
Has anyone configured their web server (IIS or Apache) or use a commercial product to flawlessly cache and compress all content generated by the portal? Compression and caching is critical for making our portal based applictions work for overseas use
-
A row from cap to return on Keyboard is not working.
It is for 17' Apple PowerBook G4 1GHZ. I bought it used off craigslist for cheap. The only wrong with it is one row on keyboard is not working from caps lock to return. Other than that, everything is working. Why? Is there a way to get a row on keybo
-
Monitor Question: Misleading and Confused
I'm looking to buy a new HP monitor, I just had a few questions whats the difference between HP 25bw and HP 25xi Monitor? I was interested in this monitor for the gloss screen and crystal clear images they can produce. Having read a review on CNET, t
-
Additional fileds to VAT report S_ALR_87012357 - Advance Return for Tax on
Dear all I would like to add customer and vendor name to the VAT report. Can you please tell me on how these fields can be added. Many thanks P
-
Hi Guys, Am using BAPI - > "BAPI_DOCUMENT_CHECKIN2" to checkin a Document When i use this BAPI in R/3 Backend System, the document get"s checked in without any problem. All problem starts when i use this BAPI in External System to checkin Document