Performance issue in SQL while using max
Hi
I have log table which desired changed date. if any transaction entered for the changed date and less, then the name and location should be shown based on change log table. if change log entry has two values for a same date for a customer then need to show the max value for the row.
Log table
ID CUSTOMER_ID NAME LOCATION CHANGED_DATE
1 1 sar boston 11-1-13
2 2 var chn 12-1-13
3 1 gar boston 13-1-13
4 1 nar boston 13-1-13
Transaction table
ID CUSTOMER_ID DATE QTY
1 1 11-1-13 10
2 2 12-1-13 9
3 1 10-1-13 8
4 1 13-1-13 7
Required Result
ID CUSTOMER_ID NAME LOCATION DATE QTY
1 1 sar boston 11-1-13 10
2 2 var chn 12-1-13 9
3 1 sar boston 10-1-13 8
4 1 nar boston 13-1-13 7I got the above result using the max when multiple log entry for same date. but if use max value i got performance issue when log entry table has more entries.
can you help me in this?
Edited by: Tsk on Apr 23, 2013 1:12 AM
How do I ask a question on the forums?
SQL and PL/SQL FAQ
Similar Messages
-
Performance issue in linux while using set with URL object
Hi,
I am facing performance issue while using Set(HashSet) with URL object on linux. But it is running perfectly on windows.
I am using
set.contains(urlObject)
Above particular statement is taking 40 sec on Linux, and only a fraction of ms on windows.
I have checked the jre version on both OS. It is the same version (jre6)
on both the OS.
Could anyone please tell me what is the exact reason, why the same statement is taking more time on linux than windows.
Thanks & Regards
Naveenjtahlborn wrote:
I believe the URL hashCode/equals implementations have some /tricky behavior which involves network access in order to run (doing hostname lookups and the like). you may want to either use simple Strings, or possibly the URI class (i think it fixed some of this behavior, although i could be wrong).The second new thing I have learned today. I was wrong in reply # 1 because looking at the URL code for 1.6 I see that the hash code is generated from the IP address and this has a lazy evaluation. Each URL placed in a HashMap (or other hash based collection) requires a DNS lookup the first time the hash code is used.
P.S. 40 seconds does seem a long time for a DNS lookup!
Edited by: sabre150 on Feb 13, 2008 3:40 PM -
Performance Issue - Index is not used when a zero padded string is queried
Hi All,
I have a table T1 which has many columns. One such column say C1 is a varchar2(20). T1 has 10 million rows and there is an index called I1 on C1. Stats are current for both tables and indexes. These are the scenarios:
Scenario 1
select * from T1 where C1 = '0013206263' --Uses index I1
187 ms
Scenario 2
select * from T1 where C1 = '8177341863' --Uses index I1
203 ms
*Scenario 3*
*select * from T1 where C1 = '0000000945' --Uses Fulll Table Scan --Very Slow*
*45 seconds*
When I force the sql to use the index through a hint, it is working fine:
Scenario 4
select /*+ INDEX (t1 i1) */ * from T1 where C1 = '0013206263' --Uses index I1
123 ms
Scenario 5
select /*+ INDEX (t1 i1) */ * from T1 where C1 = '8177341863' --Uses index I1
201 ms
*Scenario 6*
*select /*+ INDEX (t1 i1) */ * from T1 where C1 = '0000000945' --Uses index I1*
*172ms*Is there any reason for this performance issue? Why does the optimizer goes for FTS in Scenario 3?
Edited by: user539954 on May 14, 2009 12:22 PM
Edited by: user539954 on May 14, 2009 12:32 PMuser539954 wrote:
Please see the replies below:
- How many distinct values for C1 out of that 10 million rows? I'm guessing that histograms were created for C1, correct?
=>7 million distinct c1 values. I have not gathered a histogram yet. Should I try that?
SQL> explain plan for select * from T1 where C1 = '0000000954';
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
| 0 | SELECT STATEMENT | | 244K| 19M| 26228 (5)|
| 1 | TABLE ACCESS FULL| T1 | 244K| 19M| 26228 (5)|
SQL> explain plan for select * from T1 where C1 = '0033454555';
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)|
| 0 | SELECT STATEMENT | | 532 | 43624 | 261 (0)|
| 1 | TABLE ACCESS BY INDEX ROWID| T1 | 532 | 43624 | 261 (0)|
| 2 | INDEX RANGE SCAN | I1 | 532 | | 2 (0)|
It's possible you do have a histogram, even though you didn't plan on creating it, if you're running 10g.
In the absence of a histogram and with 7M distinct keys in 10M rows, Oracle should have predicted 2 rows for both queries, not 244,000 and 532.
If you do have a histogram, you probably need to get rid of it.
Regards
Jonathan Lewis
http://jonathanlewis.wordpress.com
http://www.jlcomp.demon.co.uk
"Science is more than a body of knowledge; it is a way of thinking"
Carl Sagan
To post code, statspack/AWR report, execution plans or trace files, start and end the section with the tag {noformat}{noformat} (lowercase, curly brackets, no spaces) so that the text appears in fixed format. -
Performance issues of SQL access to AW
Hi Experts:
I wonder whether there is performance issues when using SQL to access AW. When using SQL to access cubes in AW, the SQL queries the relational views for AW objects. And the views are based on OLAP_TABLE function. We know that, views based on any table function are not able to make use of index. That is to query a subset of the data of a view, we would have to full scan the view and then apply the filter. Such query plan always lead to bad performance.
I want to know, when I use SQL to retrieve a small part of data in an AW-cube, will Oracle OLAP engine retrieve all data in the cube and then apply the filter? If the Oracle OLAP engine only retrieves data needed from AW, how can she did it?
Thanks.For most requests the OLAP_TABLE function can reduce the amount of data it produces by examining the rowsource tree , or WHERE clause. The data in Oracle OLAP is highly indexed. There are steps a user can take to optimize the index use. Specifically, pin down the dimension(s) defined in the OLAP_TABLE function LIMITMAP via (NOT)IN lists on the dimension, parent, level or GID columns. Use of valuesets for the INHIER object, instead of a boolean object.
In 10g, WHERE clauses like SALES > 50 are also processed prior to sending data out.
For large requests (thousands of rows) performance can be a problem because the data is being sent through the object layer. In 10 this can be ameliorated by wrapping the OLAP_TABLE function call with a SQL MODEL clause. The SQL MODEL knows a bit more about the Olap options and does not require use to pipe the data through the object layer.
SQL MODEL example (note no ADT defintion, using of auto ADT) This can be wrapped in a CREATE VIEW statement :
select * from olap_table('myaw duration session', null, null, 'measure sales as number from aw_sales_obj dimension d1 as varchar2(10) from geog ...rest of dimensions')
sql model dimension by (d1, d2, d3, d4) measures (sales, any attributes, parent columns etc...) unique single reference rules update sequential order ()
Example of WHERE clause with above select.
SELECT *
FROM (select * from olap_table('myaw duration session', null, null, 'measure sales as number from aw_sales_obj dimension d1 as varchar2(10) from geog ...rest of dimensions')
sql model dimension by (d1, d2, d3, d4) measures (sales, any attributes, parent columns etc...) unique single reference rules update sequential order ()))
WHERE GEOG NOT IN ('USA', 'CANADA')
and GEOG_GID = 1
and TIME_PARENT IN ('2004')
and CHANNEL = 'CATALOG'
and SALES > 50000; -
Performance Issue with sql query
Hi,
My db is 10.2.0.5 with RAC on ASM, Cluster ware version 10.2.0.5.
With bsoa table as
SQL> desc bsoa;
Name Null? Type
ID NOT NULL NUMBER
LOGIN_TIME DATE
LOGOUT_TIME DATE
SUCCESSFUL_IND VARCHAR2(1)
WORK_STATION_NAME VARCHAR2(80)
OS_USER VARCHAR2(30)
USER_NAME NOT NULL VARCHAR2(30)
FORM_ID NUMBER
AUDIT_TRAIL_NO NUMBER
CREATED_BY VARCHAR2(30)
CREATION_DATE DATE
LAST_UPDATED_BY VARCHAR2(30)
LAST_UPDATE_DATE DATE
SITE_NO NUMBER
SESSION_ID NUMBER(8)
The query
UPDATE BSOA SET LOGOUT_TIME =SYSDATE WHERE SYS_CONTEXT('USERENV', 'SESSIONID') = SESSION_ID
Is taking a lot of time to execute and in AWR reports also it is on top in
1. SQL Order by elapsed time
2. SQL order by reads
3. SQL order by gets
So i am trying a way to solve the performance issue as the application is slow specially during login and logout time.
I understand that the function in the where condition cause to do FTS, but i can not think what other parts to look at.
Also:
SQL> SELECT COUNT(1) FROM BSOA;
COUNT(1)
7800373
The explain plan for "UPDATE BSOA SET LOGOUT_TIME =SYSDATE WHERE SYS_CONTEXT('USERENV', 'SESSIONID') = SESSION_ID" is
{code}
PLAN_TABLE_OUTPUT
Plan hash value: 1184960901
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | UPDATE STATEMENT | | 1 | 26 | 18748 (3)| 00:03:45 |
| 1 | UPDATE | BSOA | | | | |
|* 2 | TABLE ACCESS FULL| BSOA | 1 | 26 | 18748 (3)| 00:03:45 |
Predicate Information (identified by operation id):
2 - filter("SESSION_ID"=TO_NUMBER(SYS_CONTEXT('USERENV','SESSIONID')))
{code}Hi,
There are also triggers before update and AUDITS on this table.
CREATE OR REPLACE TRIGGER B2.TRIGGER1
BEFORE UPDATE
ON B2.BSOA REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
:NEW.LAST_UPDATED_BY := USER ;
:NEW.LAST_UPDATE_DATE := SYSDATE ;
END;
CREATE OR REPLACE TRIGGER B2.TRIGGER2
BEFORE INSERT
ON B2.BSOA REFERENCING OLD AS OLD NEW AS NEW
FOR EACH ROW
:NEW.CREATED_BY := USER ;
:NEW.CREATION_DATE := SYSDATE ;
:NEW.LAST_UPDATED_BY := USER ;
:NEW.LAST_UPDATE_DATE := SYSDATE ;
END;
And also there is an audit on this table
AUDIT UPDATE ON B2.BSOA BY ACCESS WHENEVER SUCCESSFUL;
AUDIT UPDATE ON B2.BSOA BY ACCESS WHENEVER NOT SUCCESSFUL;
And the sessionid column in BSOA has height balanced histogram.
When i create an index i get the following error. As i am on 10g I can't use DDL_LOCK_TIMEOUT . I may have to wait for next down time.
SQL> CREATE INDEX B2.BSOA_SESSID_I ON B2.BSOA(SESSION_ID) TABLESPACE B2 COMPUTE STATISTICS;
CREATE INDEX B2.BSOA_SESSID_I ON B2.BSOA(SESSION_ID) TABLESPACE B2 COMPUTE STATISTICS
ERROR at line 1:
ORA-00054: resource busy and acquire with NOWAIT specified
Thanks -
How to Improve performance issue when we are using BRM LDB
HI All,
I am facing a performanc eissue when i am retriving the data from BKPF and respective BSEG table....I see that for fiscal period there are around 60lakhs records. and to populate the data value from the table to final internal table its taking so much of time.
when i tried to make use of the BRM LDB with the SAP Query/Quickviewer, its the same issue.
Please suggest me how to improve the performance issue.
Thanks in advance
ChakradharModerator message - Please see Please Read before Posting in the Performance and Tuning Forum before posting - post locked
Rob -
I am having sound issues with the website Pottermore while using Safari 6.1. I once muted the sound and now can't unmute it even though the icon tells me it's unmuted. I can hear samples of audio books in the store section. Any ideas? I have reset Safari. Website works fine on Firefox.
I am having sound issues with the website Pottermore while using Safari 6.1. I once muted the sound and now can't unmute it even though the icon tells me it's unmuted. I can hear samples of audio books in the store section. Any ideas? I have reset Safari. Website works fine on Firefox.
-
Performance Issue with Crosstab Reports Using Disco Viewer 10.1.2.48.18
We're experiencing Performance Issue (retrieving 40000 rows) with Crosstab Reports Using Disco Viewer 10.1.2.48.18 ( > 01 Minute , executing "Building Page Axis" or executing a Refresh).
Are there parameters to tun (in pref.txt file) , in order to reduce "Building Page Axis" execution ?
Note : We've got the same performance problem , using Discoverer Desktop 10.1.2.48.18.
Thank's in advance for your Help.Hi
Well if the same issue occurs in both Desktop and Viewer then you have your answer. It's not the way that Discoverer is running the workbook its the way the workbook has been constructed.
For a start, 40000 rows for a Crosstab is way over the top and WILL cause performance issues. This is because Discoverer has to create a bucket for every data point for every combination of items on the page, side and top axes. The more rows, page items and column headings that you have, the more buckets you have and therefore the longer it will take for Discoverer to work out the contents of every bucket.
Also, whenever you use page items or crosstabs, Discoverer has to retrieve all of the rows for the entire query, not just the first x rows as with a table. This is because it cannot possibly know how many buckets to create until it has all the rows.
You therefore to:
a) apply sufficient filters to reduce the amount of data being returned to something manageable
b) reduce the number of page items, if used
c) reduce the number of items on the side or top axis of a crosstab
d) reduce the number of complex calculations, especially calculations that would generate a new bucket
If you have a lot of complex calculations, you should consider the use of a materialized view / summary folder to pre-calculate the values.
Does this help?
Best wishes
Michael Armstrong-Smith
URL: http://learndiscoverer.com
Blog: http://learndiscoverer.blogspot.com -
Performance issue with SQL with different input data
Hi Experts,
I have an SQL query that uses three tables imtermination, imconnection, imconnectiondesign. Each of these tables have around 23Lakh, 11Lakh, 11Lakh rows respectively. There are appropriate indexes on these tables.
Now there is a query:
SELECT
/*+ NO_MERGE(a) ORDERED USE_NL(c) */ c.objectid,
c.typeid,
c.transactionstatus,
c.usersessionid,
cd.objectid designid,
c.reservationid,
c.networkid,
c.networktype,
cd.inprojectid,
cd.inprojecttype,
cd.outprojectid,
cd.outprojecttype,
cd.asiteid,
cd.asitetype,
cd.anetworkelementid,
cd.anetworkelementtype,
cd.aportid,
cd.aporttype,
cd.achannelpath,
c.asignaltype,
cd.zsiteid,
cd.zsitetype,
cd.znetworkelementid,
cd.znetworkelementtype,
cd.zportid,
cd.zporttype,
cd.zchannelpath,
c.zsignaltype,
c.signaltype,
c.visualkey,
c.resourcestate,
cd.assignmentstate,
c.effectivefrom,
cd.effectiveto,
c.channelized,
c.circuitusage,
c.hardwired,
c.consumedsignaltype,
c.flowqualitycode,
c.capacityused,
c.percentused,
c.maxcapacity,
c.warningthreshold,
c.typecode,
cd.lastupdateddate,
c.lastreconcileddate,
c.bandwidth,
c.unit
FROM
(SELECT terminatedid
FROM imtermination t1
WHERE t1.networkelementid = 9200150)
a,
imconnectiondesign cd,
imconnection c
WHERE cd.objectid = a.terminatedid
AND c.objectid = cd.connectionid
AND(SUBSTR('10000000000000000000011111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', c.consumedsignaltype + 1, 1) = '1' OR SUBSTR('10000000000000000000011111111111110000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', c.signaltype + 1, 1) = '1')
AND c.typeid = '$131'
AND cd.assignmentstate IN(2, 3)
The above query takes around 70 secs to execute when input t1.networkelementid = 9200150. Moreover i have observed in the enterprise manager that this has very high i/o wait time.
Now the same query takes around 5 secs to execute when the input t1.networkelementid = 42407448. Both these obejcts with id 9200150 and 42407448 have almost same number of rows and output and without any condition each have 6500 rows in all the three tables.
The execution plan for both these queries with t1.networkelementid = 9200150 and t1.networkelementid = 42407448 is also coming same.
The rows that are corresponding to t1.networkelementid = 9200150 in these three tables are the result of the data created through the application over a period of time. While in case of rows corresponding to t1.networkelementid = 42407448 i have created manually and are contiguous in the three tables.
Does the above behavior is because in case of t1.networkelementid = 42407448 the rows that corresponds to it are not contiguous as they are created over a period of time ?
Execution Statistics
Total Per Execution Per Row
Executions 1 1 0.02
CPU Time (sec) 0.91 0.91 0.02
Buffer Gets 11943 11943.00 238.86
Disk Reads 4804 4804.00 96.08
Direct Writes 0 0.00 0.00
Rows 50 50.00 1
Fetches 5 5.00 0.10
User I/O Waits(98.7%)
CPU(1.3%)
Enterprise manager shows high db file scattered read in case of t1.networkelementid = 9200150, the input for which it is taking 70 secs.
Request experts to provide some pointers to fix this issue as i am not an expert in db tuning.
Thanks in advance for your help.
RegardsHi David,
Please find below the output:
SQL> SELECT table_name, num_rows, last_analyzed
2 FROM all_tables
3 WHERE table_name IN ('IMTERMINATION', 'IMCONNECTIONDESIGN', 'IMCONNECTION')
4 /
TABLE_NAME NUM_ROWS LAST_ANAL
IMTERMINATION 2338746 19-SEP-11
IMCONNECTIONDESIGN 1129298 19-SEP-11
IMCONNECTION 1169373 19-SEP-11
IMTERMINATION 19852 13-SEP-11
IMCONNECTIONDESIGN 6820 13-SEP-11
IMCONNECTION 9926 13-SEP-11
6 rows selected.
SQL> SELECT table_name, index_name,num_rows, last_analyzed
2 FROM all_indexes
3 WHERE table_name IN ('IMTERMINATION', 'IMCONNECTIONDESIGN', 'IMCONNECTION')
4 order by table_name,index_name
5 /
TABLE_NAME INDEX_NAME NUM_ROWS LAST_ANAL
IMCONNECTION IMCONNECTION_A_NE 9925 13-SEP-11
IMCONNECTION IMCONNECTION_A_NE 1169154 19-SEP-11
IMCONNECTION IMCONNECTION_A_PORT 84743 19-SEP-11
IMCONNECTION IMCONNECTION_A_PORT 3371 13-SEP-11
IMCONNECTION IMCONNECTION_A_SITE 1169373 19-SEP-11
IMCONNECTION IMCONNECTION_A_SITE 9926 13-SEP-11
IMCONNECTION IMCONNECTION_NET 0 19-SEP-11
IMCONNECTION IMCONNECTION_NET 12 13-SEP-11
IMCONNECTION IMCONNECTION_PK 9926 13-SEP-11
IMCONNECTION IMCONNECTION_PK 1169373 19-SEP-11
IMCONNECTION IMCONNECTION_RES 0 13-SEP-11
IMCONNECTION IMCONNECTION_RES 0 19-SEP-11
IMCONNECTION IMCONNECTION_ST 2 13-SEP-11
IMCONNECTION IMCONNECTION_ST 60 19-SEP-11
IMCONNECTION IMCONNECTION_TYPEID 4 13-SEP-11
IMCONNECTION IMCONNECTION_TYPEID 64 19-SEP-11
IMCONNECTION IMCONNECTION_UR 26880 19-SEP-11
IMCONNECTION IMCONNECTION_UR 3 13-SEP-11
IMCONNECTION IMCONNECTION_VK 9810 13-SEP-11
IMCONNECTION IMCONNECTION_VK 1191866 19-SEP-11
IMCONNECTION IMCONNECTION_Z_NE 1169173 19-SEP-11
IMCONNECTION IMCONNECTION_Z_NE 9925 13-SEP-11
IMCONNECTION IMCONNECTION_Z_PORT 84092 19-SEP-11
IMCONNECTION IMCONNECTION_Z_PORT 3370 13-SEP-11
IMCONNECTION IMCONNECTION_Z_SITE 9926 13-SEP-11
IMCONNECTION IMCONNECTION_Z_SITE 1169373 19-SEP-11
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_CON 1129298 19-SEP-11
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_CON 6820 13-SEP-11
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_PK 1129298 19-SEP-11
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_PK 6820 13-SEP-11
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_ST 6820 13-SEP-11
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_ST 1129298 19-SEP-11
IMTERMINATION IMTERMINATION_ID 19852 13-SEP-11
IMTERMINATION IMTERMINATION_ID 2279477 19-SEP-11
IMTERMINATION IMTERMINATION_NE 19850 13-SEP-11
IMTERMINATION IMTERMINATION_NE 2327175 19-SEP-11
IMTERMINATION IMTERMINATION_PORT 168835 19-SEP-11
IMTERMINATION IMTERMINATION_PORT 6741 13-SEP-11
IMTERMINATION IMTERMINATION_SITE 19852 13-SEP-11
IMTERMINATION IMTERMINATION_SITE 2391415 19-SEP-11
40 rows selected.
SQL> select table_name,index_name,column_name,column_position
2 FROM all_ind_columns
3 WHERE table_name IN ('IMTERMINATION', 'IMCONNECTIONDESIGN', 'IMCONNECTION')
4 order by table_name,index_name, column_position
5 /
TABLE_NAME INDEX_NAME
COLUMN_NAME
COLUMN_POSITION
IMCONNECTION IMCONNECTION_A_NE
ANETWORKELEMENTID
1
IMCONNECTION IMCONNECTION_A_NE
ANETWORKELEMENTID
1
IMCONNECTION IMCONNECTION_A_PORT
APORTID
1
IMCONNECTION IMCONNECTION_A_PORT
APORTID
1
IMCONNECTION IMCONNECTION_A_SITE
ASITEID
1
IMCONNECTION IMCONNECTION_A_SITE
ASITEID
1
IMCONNECTION IMCONNECTION_NET
NETWORKID
1
IMCONNECTION IMCONNECTION_NET
NETWORKID
1
IMCONNECTION IMCONNECTION_PK
OBJECTID
1
IMCONNECTION IMCONNECTION_PK
OBJECTID
1
IMCONNECTION IMCONNECTION_RES
RESERVATIONID
1
IMCONNECTION IMCONNECTION_RES
RESERVATIONID
1
IMCONNECTION IMCONNECTION_ST
RESOURCESTATE
1
IMCONNECTION IMCONNECTION_ST
RESOURCESTATE
1
IMCONNECTION IMCONNECTION_TYPEID
TYPEID
1
IMCONNECTION IMCONNECTION_TYPEID
TYPEID
1
IMCONNECTION IMCONNECTION_UR
USERSESSIONID
1
IMCONNECTION IMCONNECTION_UR
USERSESSIONID
1
IMCONNECTION IMCONNECTION_VK
VISUALKEY
1
IMCONNECTION IMCONNECTION_VK
VISUALKEY
1
IMCONNECTION IMCONNECTION_Z_NE
ZNETWORKELEMENTID
1
IMCONNECTION IMCONNECTION_Z_NE
ZNETWORKELEMENTID
1
IMCONNECTION IMCONNECTION_Z_PORT
ZPORTID
1
IMCONNECTION IMCONNECTION_Z_PORT
ZPORTID
1
IMCONNECTION IMCONNECTION_Z_SITE
ZSITEID
1
IMCONNECTION IMCONNECTION_Z_SITE
ZSITEID
1
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_CON
CONNECTIONID
1
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_CON
CONNECTIONID
1
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_PK
OBJECTID
1
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_PK
OBJECTID
1
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_ST
ASSIGNMENTSTATE
1
IMCONNECTIONDESIGN IMCONNECTIONDESIGN_ST
ASSIGNMENTSTATE
1
IMTERMINATION IMTERMINATION_ID
TERMINATEDID
1
IMTERMINATION IMTERMINATION_ID
TERMINATEDID
1
IMTERMINATION IMTERMINATION_NE
NETWORKELEMENTID
1
IMTERMINATION IMTERMINATION_NE
NETWORKELEMENTID
1
IMTERMINATION IMTERMINATION_PORT
PORTID
1
IMTERMINATION IMTERMINATION_PORT
PORTID
1
IMTERMINATION IMTERMINATION_SITE
SITEID
1
IMTERMINATION IMTERMINATION_SITE
SITEID
1
40 rows selected.
Plan without sql hints:
SQL> select * from table(dbms_xplan.display)
2 /
PLAN_TABLE_OUTPUT
Plan hash value: 2493901029
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 40 | 9960 | 6316 (1)| 00:01:16 |
| 1 | NESTED LOOPS | | 40 | 9960 | 6316 (1)| 00:01:16 |
| 2 | NESTED LOOPS | | 1359 | 160K| 3592 (1)| 00:00:44 |
| 3 | TABLE ACCESS BY INDEX ROWID| IMTERMINATION | 1359 | 16308 | 915 (1)| 00:00:11 |
|* 4 | INDEX RANGE SCAN | IMTERMINATION_NE | 1359 | | 6 (0)| 00:00:01 |
|* 5 | TABLE ACCESS BY INDEX ROWID| IMCONNECTIONDESIGN | 1 | 109 | 2 (0)| 00:00:01 |
|* 6 | INDEX UNIQUE SCAN | IMCONNECTIONDESIGN_PK | 1 | | 1 (0)| 00:00:01 |
|* 7 | TABLE ACCESS BY INDEX ROWID | IMCONNECTION | 1 | 128 | 2 (0)| 00:00:01 |
|* 8 | INDEX UNIQUE SCAN | IMCONNECTION_PK | 1 | | 1 (0)| 00:00:01 |
Predicate Information (identified by operation id):
4 - access("T1"."NETWORKELEMENTID"=9200150)
5 - filter("CD"."ASSIGNMENTSTATE"=2 OR "CD"."ASSIGNMENTSTATE"=3)
6 - access("CD"."OBJECTID"="TERMINATEDID")
7 - filter((("C"."CONSUMEDSIGNALTYPE"=21 OR "C"."CONSUMEDSIGNALTYPE"=22 OR
"C"."CONSUMEDSIGNALTYPE"=23 OR "C"."CONSUMEDSIGNALTYPE"=24 OR "C"."CONSUMEDSIGNALTYPE"=25 OR
"C"."CONSUMEDSIGNALTYPE"=26 OR "C"."CONSUMEDSIGNALTYPE"=27 OR "C"."CONSUMEDSIGNALTYPE"=28 OR
"C"."CONSUMEDSIGNALTYPE"=29 OR "C"."CONSUMEDSIGNALTYPE"=30 OR "C"."CONSUMEDSIGNALTYPE"=31 OR
"C"."CONSUMEDSIGNALTYPE"=32 OR "C"."CONSUMEDSIGNALTYPE"=33) OR ("C"."SIGNALTYPE"=21 OR
"C"."SIGNALTYPE"=22 OR "C"."SIGNALTYPE"=23 OR "C"."SIGNALTYPE"=24 OR "C"."SIGNALTYPE"=25 OR
"C"."SIGNALTYPE"=26 OR "C"."SIGNALTYPE"=27 OR "C"."SIGNALTYPE"=28 OR "C"."SIGNALTYPE"=29 OR
"C"."SIGNALTYPE"=30 OR "C"."SIGNALTYPE"=31 OR "C"."SIGNALTYPE"=32 OR "C"."SIGNALTYPE"=33)) AND
"C"."TYPEID"='$131')
8 - access("C"."OBJECTID"="CD"."CONNECTIONID")
32 rows selected. -
CF8 ODBC performance issues w/ SQL 2K5
Problem: A basic "select *" query returning 5 rows is taking
a little over 5000ms.
Platform: Vista Business, CF8 Developer, MS SQL 2K5 Developer
SP2, ODBC Socket using trusted connection
I ran a query against cfartgallery without any performance
problems. Leads me to believe this is an ODBC issue.
(Server monitor memory tracking is off.)
Does anybody have any suggested fixes? Thank you.gdemaria -
I reverted back to using MX7 rather than 8.
I tried using the JDBC driver, which is the default driver on
the first screen--where you have to specify a username and password
and you connect over port 1433-- but I couldn't get that to work.
(This is probably a problem with my SQL server configuration.)
My plan is to play around some more with the JDBC driver. Or,
wait and see if I get an ODBC solution from the forum here. For now
I will develop on MX7 and use CF8 in the live hosting
environment---not an ideal situation, but it's workable. -
Performance issue with the table use vrkpa
Hi.
here is the selection criteria that i am using and the table use vrkpa i only used to map the table kna1 and vbrk.vbrk and kna1 doesnot have the direct primary key relationship.
please check and let me know wht this vrkpa is taking time and how can i improve the performance as from kna1,i am fetching data very easily while fetching nothing from vrkpa and fetching fkdat from vbrk.
the idea behind using these tables is just for one kunnr (from kna1)getting the relevant entries based on the fkdat(selection screen input field),please suggest.
SELECT kunnr
name1
land1
regio
ktokd
FROM kna1
INTO TABLE it_kna1
FOR ALL ENTRIES IN it_knb1
WHERE kunnr = it_knb1-kunnr
AND ktokd = '0003'.
IF sy-subrc = 0.
SORT it_kna1 BY kunnr.
DELETE ADJACENT DUPLICATES FROM it_kna1 COMPARING kunnr.
ENDIF.
ENDIF.
IF NOT it_kna1[] IS INITIAL.
SELECT kunnr
vbeln
FROM vrkpa
INTO TABLE it_vrkpa
FOR ALL ENTRIES IN it_kna1
WHERE kunnr = it_kna1-kunnr.
IF sy-subrc = 0.
SORT it_vrkpa BY kunnr vbeln.
ENDIF.
ENDIF.
IF NOT it_vrkpa[] IS INITIAL.
SELECT vbeln
kunrg
fkdat
kkber
bukrs
FROM vbrk
INTO TABLE it_vbrk
FOR ALL ENTRIES IN it_vrkpa
WHERE vbeln = it_vrkpa-vbeln.
IF sy-subrc = 0.
DELETE it_vbrk WHERE fkdat NOT IN s_indate.
DELETE it_vbrk WHERE fkdat NOT IN s_chdate.
DELETE it_vbrk WHERE bukrs NOT IN s_ccode.
SORT it_vbrk DESCENDING BY vbeln fkdat.
ENDIF.
ENDIF.Hi,
Transaction SE11
Table VRKPA => Display (not Change)
Click on "Indexes"
Click on "Create" (if your system is Basis 7.00, then click on the "Create" drop-down icon and choose "Create extension index")
Choose a name (up to 3 characterss, start with Z)
Enter a description for the index
Enter the field names of the index
Choose "Save" (prompts for transport request)
Choose "Activate"
If after "Activate' the status shows "Index exists in database system <...>", then you have nothing more to dotable is very large the activation will not create the index in the database and the status remains "Index does nor exist". In that case:
- Transaction SE14
- Table VRKPA -> Edit
- Choose "Indexes" and select your new index
- Choose "Create database index"; mark the option "Background"
- Wait until the job is finished and check in SE11 that the index now exists in the DB
You don't have to do anyhting to your program because Oracle should choose the new index automatically. Run a SQL Trace to make sure.
Rgds,
Mark -
Performance Issue with Webi report uses SAP BI Query as the data source
Hello.
I have created a Webi ad-hoc report which connects to a SAP BI query through BO OLAP universe.
The layout of Webi is the exactly the same as the BI query. There are filters in the Webi to restrict the number of data extraction, but even with data result of 5000 rows, it took about 30 seconds.
If I execute the BI query with the same filter restriction, it tooks less than 10 seconds.
It seems that large percentage of time is consumed at the MDX part.
Is there any tuning method that could speed up the process time of MDX?
Thank you.
Justine
Edited by: Justine Liu on Mar 18, 2009 6:59 AMHi,
please take a look here:
[https://service.sap.com/sap/support/notes/1142664] (Look under related notes)
It includes references to various performance improvements of the MDX interface. From what I saw there it is advisable to upgrade your SAP BI (7.0) up to at least Support Package 21 (you are currently on SP 15).
This may also be interesting for you: There is a new Fix Pack 1.4 coming out for BOBJ XI 3.1. Combined with the related SAP Enh.Pack (not sure about the version of this one) should also improve WebI performance. This fix pack is not yet officially released though but it should not take look.
I recommend that you try the upgrade to Support Package 21 first.
BTW it is also advisable to take a look in the results of your MDX query (e.g using the MDXTEST transaction). You should make sure that your query is indeed restricted as expected. Sometimes the results you see in SAP native reporting tools (e.g. BEx Analyzer) differ from those returned from the MDX component, depending on the way variables/restrictions where defined in the query designer. It is all about making sure that there is no apples/oranges comparison here.
Regards,
Stratos -
Issue in pivot while using aggregate functions
when I use this below query in oracle sql developer
------------->select sum(round(8.08/0.54,2)*30) from dual.
i am getting result as 448.8.it is a correct value
but i use this below queries in pivot as same like above query i am getting result of doubled value 914.4.
PIVOT
SUM(round(ROUND(sellout,2)/6,2)) AS LAST_6_MON_SELL_OUT,
SUM(ROUND(inventory,2)) AS INVENTORY_INTINS_1,
Sum(round(ROUND(inventory,2)/round(ROUND(sellout,2)/6,2),2)*30) As Stockperday
FOR PRODUCT IN (56,78)
actually i am getting value for SUM(round(ROUND(sellout,2)/6,2)) is 0.54,*SUM(ROUND(inventory,2))* is 8.08 i the above query ,but i am getting wrong value for this aggregate function Sum(round(ROUND(inventory,2)/round(ROUND(sellout,2)/6,2),2)30)* as 914.4.but actual value is 448.8
why this problem.can anybody explain me.why this problemTry ur luck in 'sql plsql thread'
PL/SQL -
I am trying to only display the records where the 'date_entered' is the most recent date per case number.
SELECT distinct c.case_number, u.email,c.assigneddate_chart,
--m.date_entered,
max(m.date_entered)as last_date_entered,
trunc(sysdate)-trunc(c.assigneddate_chart)days_late,
trunc(sysdate)-trunc(m.date_entered)addl_days_late
from chart c, chart_user_roles u,comments m
where
(c.case_status IN ('Open','Pending')) and
c.case_number=m.case_number
group by c.case_number,
u.email,c.assigneddate_chart,m.date_enteredRight now, this is the output im am getting.
Output:
CASE_NUMBER------EMAIL---------ASSIGNEDDATE_CHART---LAST_DATE_ENTERED---DAYS_LATE--ADDL_DAYS_LATE
[email protected]----06-NOV-09-----------------31--------------------11
[email protected]----10-NOV-09-----------------31---------------------7
[email protected]----06-NOV-09-----------------31--------------------11
[email protected]----06-NOV-09-----------------31--------------------11
[email protected]----06-NOV-09-----------------31--------------------11
[email protected]----03-NOV-09-----------------34--------------------14
I am wanting to achieve this output:
Therefore, based on the data below, the only records that i am wanting to display are:
[email protected]----10-NOV-09-----------------31---------------------7
[email protected]----03-NOV-09-----------------34--------------------14
Thanks
DeannaIs there a reason that you have a DISTINCT in your query? It always makes me nervous to see that where it's not clearly necessary because it frequently means that a developer is missing a join condition and is using the DISTINCT to mask that fact.
On to the meat of your question, though, is there a potential for ties? If so, how do you want to handle that-- do you want two rows for that case, do you want to break the tie using some other column, do you want to pick an arbitrary row? If you want to pick an arbitrary row
SELECT case_number, email, assignedDate_chart, last_date_entered, days_late, addl_days_late
FROM (
SELECT a.*, row_number() over (partition by case_number order by date_entered) rn
FROM (<<your query>>) a
WHERE rn = 1If you want to do something else, just adjust the analytic function and use RANK or add a tie-breaker to the ORDER BY.
Justin -
Performance tuning in SQL query using join of views
Hi,
Am trying to tune a query of the format
select ........ from view1,view2
where view1.keyfield = view2.keyfield
The base tables of the views view1 and view2 have indexes specified on 'keyfield'.
However, when I do an explain plan of the query, Full table scan of those base tables are performed.
Even tried using Hints in this query to force Oracle to use those indexes, but still not successful.
Any pointers on how to tune this kind of query would be highly welcome.
Regards,
BaishIf your query is really of the same form as you posted, then full table scans then a hash or merge join may be the most efficient plan.
You are asking for all of the rows from view1 and the matching rows from view2, because of this, Oracle dedcided that the cost of full table scans using multi-block reads is cheaper than using single block reads to get the rowids from the index, then single block reads to get the rows from the table.
FULL SCAN <> BAD
John
Maybe you are looking for
-
Hi Experts, I have configured a BRF workflow in SRM 7.0 which is suppose to have theree step approvals. I am able to achieve the two levels among the total three by creating custom events and expressions in BRF from the help of many experts provided
-
hello, i have the final cut suite and i heard that when doing color correction you do not want to use your computer screen. does anyone know of a good tv monitor that is good - or if i even need one and the computer screen works just fine? at my scho
-
Just got iphone 4 but i cant get network service..any clues
-
Can't unlock background layer using Photoshop CS3 Extended
I installed CS3 a few days ago (though I'm an experienced CS2 and Photoshop 6 user) and opened Photoshop CS3 Extended today for the first time. The problem I'm having is with unlocking the background layer. I read in the documentation and on the Net
-
FastCGI error "no such file or directory"
I am trying to get a public face on django with my Mac OS X server 10.4.9 using mod_fastcgi. Django is installed and everything works fine in my shell (bash + python 2.4). I noticed these lines in the error log: [error] (2)No such file or directory: