Query runs faster when there is no statistics
Hi Gurus
I have a Oracle 10.2.0.1 instance and I'm seeing the following weird behavior, I appreciate any pointers or references to resolve this problem.
Thank you very much.
1. Run the below mentioned query for 10 times continuously from sqlplus. Elapsed time is around 115 seconds (around 2
min) for each execution. Elapsed time is constant, no increase or decrease. Tables involved in the query have statistics with 100% sampling.
2. delete the statistics on 2 tables involved in query. Flush the shared_pool
(alter system flush shared_pool).
3. Run the query for 10 times. Elapsed time is less than 2 seconds for each execution. Elapsed time is constant, no
increase or decrease.
The Query: (it is a generated query, no option for modifying it).
select count(distinct itm1.itm_id) FROM ita ita1, ita ita2, itm itm1, itm itm2, itm itm3
where itm1.itm_container_id = 2812
and itm1.itm_version_id <= 999999999
and itm1.itm_next_version_id >= 999999999
and itm2.itm_primary_key = 'RAYBESTOS'
and itm3.itm_primary_key = '1'
and ita1.ita_node_id = 3111
and itm2.itm_container_id = 2020
and ita1.ita_item_id = itm1.itm_id
and ita1.ita_version_id <= 999999999
and ita1.ita_next_version_id >= 999999999
and itm2.itm_id = ita1.ita_value_numeric
and itm2.itm_version_id <= 999999999
and itm2.itm_next_version_id >= 999999999
and ita2.ita_node_id = 3118
and itm3.itm_container_id = 2025
and ita2.ita_item_id = itm1.itm_id
and ita2.ita_version_id <= 999999999
and ita2.ita_next_version_id >= 999999999
and itm3.itm_id = ita2.ita_value_numeric
and itm3.itm_version_id <= 999999999
and itm3.itm_next_version_id >= 999999999;
Query uses dynamic sampling when there is no statistics.
tkprof report shows there is a small difference in execution plan between 2 cases. When there is no statistics, there is table access by index rowid. It may be the reason for faster response time.
Rows Row Source Operation
1 SORT GROUP BY (cr=47235 pr=0 pw=0 time=919461 us)
758 {color:#ff0000}TABLE ACCESS BY INDEX ROWID TCTG_ITA_ITEM_ATTRIBUTES (cr=47235 pr=0 pw=0 time=600473 us){color}
14163 NESTED LOOPS (cr=40652 pr=0 pw=0 time=299694 us)
7081 NESTED LOOPS (cr=25708 pr=0 pw=0 time=538463 us)
12771 NESTED LOOPS (cr=90 pr=0 pw=0 time=255699 us)
1 MERGE JOIN CARTESIAN (cr=6 pr=0 pw=0 time=271 us)
1 INDEX RANGE SCAN ICTG_ITM_1 (cr=3 pr=0 pw=0 time=74 us)(object id 105409)
1 BUFFER SORT (cr=3 pr=0 pw=0 time=112 us)
1 INDEX RANGE SCAN ICTG_ITM_1 (cr=3 pr=0 pw=0 time=43 us)(object id 105409)
12771 INDEX RANGE SCAN ICTG_ITA_1 (cr=84 pr=0 pw=0 time=102210 us)(object id 105399)
7081 INDEX RANGE SCAN ICTG_ITM_0 (cr=25618 pr=0 pw=0 time=363715 us)(object id 105408)
7081 INDEX RANGE SCAN ICTG_ITA_0 (cr=14944 pr=0 pw=0 time=239803 us)(object id 105398)
Hi Jonathan,
Thanks again for your response. Yes, you are correct. Most of the rows have all 9s, and a small percentage have something else - and there are only a small number of distinct values.
Here is the histogram info when there is statistics (some old data have been trimmed for this test).
TABLE_NAME COLUMN_NAME NUM_DISTINCT NUM_BUCKETS HISTOGRAM
TCTG_ITA_ITEM_ATTRIBUTES ITA_COMPANY_ID 2 2FREQUENCY
TCTG_ITA_ITEM_ATTRIBUTES ITA_CATALOG_ID 62 62FREQUENCY
TCTG_ITA_ITEM_ATTRIBUTES ITA_ITEM_ID 720867 1NONE
TCTG_ITA_ITEM_ATTRIBUTES ITA_NODE_ID 118 118FREQUENCY
TCTG_ITA_ITEM_ATTRIBUTES ITA_VALUE_NUMERIC 587504 254HEIGHT BALANCED
TCTG_ITA_ITEM_ATTRIBUTES ITA_VALUE_STRING 1060930 254HEIGHT BALANCED
TCTG_ITA_ITEM_ATTRIBUTES ITA_VERSION_ID 48 48FREQUENCY
TCTG_ITA_ITEM_ATTRIBUTES ITA_NEXT_VERSION_ID 1 1FREQUENCY
TCTG_ITA_ITEM_ATTRIBUTES ITA_OCCURRENCE_ID 16250 254HEIGHT BALANCED
TCTG_ITA_ITEM_ATTRIBUTES ITA_VALUE_STRING_IGNORECASE 1498257 254HEIGHT BALANCED
TCTG_ITM_ITEM ITM_COMPANY_ID 2 2FREQUENCY
TCTG_ITM_ITEM ITM_ID 720867 1NONE
TCTG_ITM_ITEM ITM_CONTAINER_ID 62 62FREQUENCY
TCTG_ITM_ITEM ITM_PRIMARY_KEY 531960 1NONE
TCTG_ITM_ITEM ITM_VERSION_ID 48 48FREQUENCY
TCTG_ITM_ITEM ITM_NEXT_VERSION_ID 1 1FREQUENCY
TCTG_ITM_ITEM ITM_STATUS 3 1NONE
TCTG_ITM_ITEM ITM_COLLAB_INFO 7 1NONE
TCTG_ITM_ITEM ITM_LAST_MODIFIED 717098 1NONEdisplay_cursor without statistics
SQL> @disp-cursor
756
Elapsed: 00:00:03.81
SQL_ID d9q6j48ns19zv, child number 0
select /*+ gather_plan_statistics */ count(distinct itm1.itm_id) FROM ita ita1, ita ita2, itm itm1, itm itm2, itm itm3 where
itm1.itm_container_id = 2812 and itm1.itm_version_id <= 999999999 and itm1.itm_next_version_id >= 999999999 and
itm2.itm_primary_key = 'RAYBESTOS' and itm3.itm_primary_key = '1' and ita1.ita_node_id = 3111 and
itm2.itm_container_id = 2020 and ita1.ita_item_id = itm1.itm_id and ita1.ita_version_id <= 999999999 and
ita1.ita_next_version_id >= 999999999 and itm2.itm_id = ita1.ita_value_numeric and itm2.itm_version_id <= 999999999
and itm2.itm_next_version_id >= 999999999 and ita2.ita_node_id = 3118 and itm3.itm_container_id = 2025 and
ita2.ita_item_id = itm1.itm_id and ita2.ita_version_id <= 999999999 and ita2.ita_next_version_id >= 999999999 and
itm3.itm_id = ita2.ita_value_numeric and itm3.itm_version_id <= 999999999 and itm3.itm_next_version_id >= 999999999
Plan hash value: 2184662757
| Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers | OMem | 1Mem | Used-Mem |
| 1 | SORT GROUP BY | | 1 | 1 | 1 |00:00:03.61 | 178K| 73728 | 73728 | |
|* 2 | TABLE ACCESS BY INDEX ROWID| TCTG_ITA_ITEM_ATTRIBUTES | 1 | 1 | 756 |00:00:00.96 | 178K| | | |
| 3 | NESTED LOOPS | | 1 | 1 | 69879 |00:00:01.27 | 145K| | | |
| 4 | NESTED LOOPS | | 1 | 1 | 34939 |00:00:02.66 | 71815 | | | |
| 5 | NESTED LOOPS | | 1 | 1 | 35695 |00:00:00.71 | 229 | | | |
| 6 | MERGE JOIN CARTESIAN | | 1 | 1 | 1 |00:00:00.01 | 6 | | | |
|* 7 | INDEX RANGE SCAN | ICTG_ITM_1 | 1 | 1 | 1 |00:00:00.01 | 3 | | | |
| 8 | BUFFER SORT | | 1 | 1 | 1 |00:00:00.01 | 3 | 73728 | 73728 | |
|* 9 | INDEX RANGE SCAN | ICTG_ITM_1 | 1 | 1 | 1 |00:00:00.01 | 3 | | | |
|* 10 | INDEX RANGE SCAN | ICTG_ITA_1 | 1 | 1 | 35695 |00:00:00.29 | 223 | | | |
|* 11 | INDEX RANGE SCAN | ICTG_ITM_0 | 35695 | 1 | 34939 |00:00:01.14 | 71586 | | | |
|* 12 | INDEX RANGE SCAN | ICTG_ITA_0 | 34939 | 1 | 34939 |00:00:01.20 | 73590 | | | |
Predicate Information (identified by operation id):
2 - filter("ITM3"."ITM_ID"="ITA2"."ITA_VALUE_NUMERIC")
7 - access("ITM2"."ITM_PRIMARY_KEY"='RAYBESTOS' AND "ITM2"."ITM_CONTAINER_ID"=2020 AND "ITM2"."ITM_NEXT_VERSION_ID">=999999999 AND
"ITM2"."ITM_VERSION_ID"<=999999999)
filter("ITM2"."ITM_VERSION_ID"<=999999999)
9 - access("ITM3"."ITM_PRIMARY_KEY"='1' AND "ITM3"."ITM_CONTAINER_ID"=2025 AND "ITM3"."ITM_NEXT_VERSION_ID">=999999999 AND
"ITM3"."ITM_VERSION_ID"<=999999999)
filter("ITM3"."ITM_VERSION_ID"<=999999999)
10 - access("ITA1"."ITA_NODE_ID"=3111 AND "ITM2"."ITM_ID"="ITA1"."ITA_VALUE_NUMERIC" AND "ITA1"."ITA_NEXT_VERSION_ID">=999999999
AND "ITA1"."ITA_VERSION_ID"<=999999999)
filter("ITA1"."ITA_VERSION_ID"<=999999999)
11 - access("ITA1"."ITA_ITEM_ID"="ITM1"."ITM_ID" AND "ITM1"."ITM_NEXT_VERSION_ID">=999999999 AND "ITM1"."ITM_CONTAINER_ID"=2812 AND
"ITM1"."ITM_VERSION_ID"<=999999999)
filter(("ITM1"."ITM_CONTAINER_ID"=2812 AND "ITM1"."ITM_VERSION_ID"<=999999999))
12 - access("ITA2"."ITA_ITEM_ID"="ITM1"."ITM_ID" AND "ITA2"."ITA_NEXT_VERSION_ID">=999999999 AND "ITA2"."ITA_NODE_ID"=3118 AND
"ITA2"."ITA_VERSION_ID"<=999999999)
filter(("ITA2"."ITA_NODE_ID"=3118 AND "ITA2"."ITA_VERSION_ID"<=999999999))
Note
- dynamic sampling used for this statement
54 rows selected.
Elapsed: 00:00:00.04Display_cursor with statistics
SQL> @disp-cursor
756
Elapsed: 00:01:57.53
SQL_ID d9q6j48ns19zv, child number 0
select /*+ gather_plan_statistics */ count(distinct itm1.itm_id) FROM ita ita1, ita ita2, itm itm1, itm itm2, itm
itm3 where itm1.itm_container_id = 2812 and itm1.itm_version_id <= 999999999 and itm1.itm_next_version_id
= 999999999 and itm2.itm_primary_key = 'RAYBESTOS' and itm3.itm_primary_key = '1' andita1.ita_node_id = 3111 and itm2.itm_container_id = 2020 and ita1.ita_item_id = itm1.itm_id and
ita1.ita_version_id <= 999999999 and ita1.ita_next_version_id >= 999999999 and itm2.itm_id =
ita1.ita_value_numeric and itm2.itm_version_id <= 999999999 and itm2.itm_next_version_id >= 999999999
and ita2.ita_node_id = 3118 and itm3.itm_container_id = 2025 and ita2.ita_item_id = itm1.itm_id and
ita2.ita_version_id <= 999999999 and ita2.ita_next_version_id >= 999999999 and itm3.itm_id =
ita2.ita_value_numeric and itm3.itm_version_id <= 999999999 and itm3.itm_next_version_id >= 999999999
Plan hash value: 332134648
| Id | Operation | Name | Starts | E-Rows | A-Rows | A-Time | Buffers | OMem | 1Mem | Used-Mem |
| 1 | SORT GROUP BY | | 1 | 1 | 1 |00:01:54.75 | 3041K| 73728 | 73728 | |
| 2 | NESTED LOOPS | | 1 | 1 | 756 |00:00:30.95 | 3041K| | | |
| 3 | NESTED LOOPS | | 1 | 1 | 34939 |00:00:02.73 | 71818 | | | |
| 4 | NESTED LOOPS | | 1 | 1 | 35695 |00:00:00.75 | 230 | | | |
| 5 | MERGE JOIN CARTESIAN| | 1 | 1 | 1 |00:00:00.01 | 6 | | | |
|* 6 | INDEX RANGE SCAN | ICTG_ITM_1 | 1 | 1 | 1 |00:00:00.01 | 3 | | | |
| 7 | BUFFER SORT | | 1 | 1 | 1 |00:00:00.01 | 3 | 73728 | 73728 | |
|* 8 | INDEX RANGE SCAN | ICTG_ITM_1 | 1 | 1 | 1 |00:00:00.01 | 3 | | | |
|* 9 | INDEX RANGE SCAN | ICTG_ITA_1 | 1 | 1 | 35695 |00:00:00.32 | 224 | | | |
|* 10 | INDEX RANGE SCAN | ICTG_ITM_0 | 35695 | 1 | 34939 |00:00:01.19 | 71588 | | | |
|* 11 | INDEX RANGE SCAN | ICTG_ITA_1 | 34939 | 1 | 756 |00:01:52.76 | 2969K| | | |
Predicate Information (identified by operation id):
6 - access("ITM3"."ITM_PRIMARY_KEY"='1' AND "ITM3"."ITM_CONTAINER_ID"=2025 AND
"ITM3"."ITM_NEXT_VERSION_ID">=999999999 AND "ITM3"."ITM_VERSION_ID"<=999999999)
filter("ITM3"."ITM_VERSION_ID"<=999999999)
8 - access("ITM2"."ITM_PRIMARY_KEY"='RAYBESTOS' AND "ITM2"."ITM_CONTAINER_ID"=2020 AND
"ITM2"."ITM_NEXT_VERSION_ID">=999999999 AND "ITM2"."ITM_VERSION_ID"<=999999999)
filter("ITM2"."ITM_VERSION_ID"<=999999999)
9 - access("ITA1"."ITA_NODE_ID"=3111 AND "ITM2"."ITM_ID"="ITA1"."ITA_VALUE_NUMERIC" AND
"ITA1"."ITA_NEXT_VERSION_ID">=999999999 AND "ITA1"."ITA_VERSION_ID"<=999999999)
filter(("ITA1"."ITA_VALUE_NUMERIC" IS NOT NULL AND "ITA1"."ITA_VERSION_ID"<=999999999))
10 - access("ITA1"."ITA_ITEM_ID"="ITM1"."ITM_ID" AND "ITM1"."ITM_NEXT_VERSION_ID">=999999999 AND
"ITM1"."ITM_CONTAINER_ID"=2812 AND "ITM1"."ITM_VERSION_ID"<=999999999)
filter(("ITM1"."ITM_CONTAINER_ID"=2812 AND "ITM1"."ITM_VERSION_ID"<=999999999))
11 - access("ITA2"."ITA_NODE_ID"=3118 AND "ITM3"."ITM_ID"="ITA2"."ITA_VALUE_NUMERIC" AND
"ITA2"."ITA_NEXT_VERSION_ID">=999999999 AND "ITA2"."ITA_ITEM_ID"="ITM1"."ITM_ID" AND
"ITA2"."ITA_VERSION_ID"<=999999999)
filter(("ITA2"."ITA_VALUE_NUMERIC" IS NOT NULL AND "ITA2"."ITA_VERSION_ID"<=999999999 AND
"ITA2"."ITA_ITEM_ID"="ITM1"."ITM_ID"))
51 rows selected.
Elapsed: 00:00:00.28
Similar Messages
-
Does SQL Query run faster with/without Conditions....
Hi All, forgive my novice question.
Was just wondering" In general if we run a SQL query on a single table; does my query run faster if there are multiple where conditions? or without. What happens if the conditions increase? My table is a big one with 5 million rows and some bitmap indexes defined on it.
Thanks,
KonI think it's difficult to give general rule because there are too much dependencies on the fact that the columns are indexed or not, on the way tables and indexes statistics are computed or not, on the possible session or instance parameters that the optimizer may use, on the Oracle version, etc.
Message was edited by:
Pierre Forstmann -
Query runs slower when using variables & faster when using hard coded value
Hi,
My query runs slower when i use variables but it runs faster when i use hard coded values. Why it is behaving like this ?
My query is in cursor definition in a procedure. Procedure runs faster when using hard coded valus and slower when using variables.
Can anybody help me out there?
Thanks in advance.Hi,
Thanks for ur reply.
here is my code with Variables:
Procedure populateCountryTrafficDetails(pWeekStartDate IN Date , pCountry IN d_geography.country_code%TYPE) is
startdate date;
AR_OrgId number(10);
Cursor cTraffic is
Select
l.actual_date, nvl(o.city||o.zipcode,'Undefined') Site,
g.country_code,d.customer_name, d.customer_number,t.contrno bcn,
nvl(r.dest_level3,'Undefined'),
Decode(p.Product_code,'820','821','821','821','801') Product_Code ,
Decode(p.Product_code,'820','Colt Voice Connect','821','Colt Voice Connect','Colt Voice Line') DProduct,
sum(f.duration),
sum(f.debamount_eur)
from d_calendar_date l,
d_geography g,
d_customer d, d_contract t, d_subscriber s,
d_retail_dest r, d_product p,
CPS_ORDER_DETAILS o,
f_retail_revenue f
where
l.date_key = f.call_date_key and
g.geography_key = f.geography_key and
r.dest_key = f.dest_key and
p.product_key = f.product_key and
--c.customer_key = f.customer_key and
d.customer_key = f.customer_key and
t.contract_key = f.contract_key and
s.SUBSCRIBER_KEY = f.SUBSCRIBER_KEY and
o.org_id(+) = AR_OrgId and
g.country_code = pCountry and
l.actual_date >= startdate and
l.actual_date <= (startdate + 90) and
o.cli(+) = s.area_subno and
p.product_code in ('800','801','802','804','820','821')
group by
l.actual_date,
o.city||o.zipcode, g.country_code,d.customer_name, d.customer_number,t.contrno,r.dest_level3, p.product_code;
Type CountryTabType is Table of country_traffic_details.Country%Type index by BINARY_INTEGER;
Type CallDateTabType is Table of country_traffic_details.CALL_DATE%Type index by BINARY_INTEGER;
Type CustomerNameTabType is Table of Country_traffic_details.Customer_name%Type index by BINARY_INTEGER;
Type CustomerNumberTabType is Table of Country_traffic_details.Customer_number%Type index by BINARY_INTEGER;
Type BcnTabType is Table of Country_traffic_details.Bcn%Type index by BINARY_INTEGER;
Type DestinationTypeTabType is Table of Country_traffic_details.DESTINATION_TYPE%Type index by BINARY_INTEGER;
Type ProductCodeTabType is Table of Country_traffic_details.Product_Code%Type index by BINARY_INTEGER;
Type ProductTabType is Table of Country_traffic_details.Product%Type index by BINARY_INTEGER;
Type DurationTabType is Table of Country_traffic_details.Duration%Type index by BINARY_INTEGER;
Type DebamounteurTabType is Table of Country_traffic_details.DEBAMOUNTEUR%Type index by BINARY_INTEGER;
Type SiteTabType is Table of Country_traffic_details.Site%Type index by BINARY_INTEGER;
CountryArr CountryTabType;
CallDateArr CallDateTabType;
Customer_NameArr CustomerNameTabType;
CustomerNumberArr CustomerNumberTabType;
BCNArr BCNTabType;
DESTINATION_TYPEArr DESTINATIONTYPETabType;
PRODUCT_CODEArr PRODUCTCODETabType;
PRODUCTArr PRODUCTTabType;
DurationArr DurationTabType;
DebamounteurArr DebamounteurTabType;
SiteArr SiteTabType;
Begin
startdate := (trunc(pWeekStartDate) + 6) - 90;
Exe_Pos := 1;
Execute Immediate 'Truncate table country_traffic_details';
dropIndexes('country_traffic_details');
Exe_Pos := 2;
/* Set org ID's as per AR */
case (pCountry)
when 'FR' then AR_OrgId := 81;
when 'AT' then AR_OrgId := 125;
when 'CH' then AR_OrgId := 126;
when 'DE' then AR_OrgId := 127;
when 'ES' then AR_OrgId := 123;
when 'IT' then AR_OrgId := 122;
when 'PT' then AR_OrgId := 124;
when 'BE' then AR_OrgId := 132;
when 'IE' then AR_OrgId := 128;
when 'DK' then AR_OrgId := 133;
when 'NL' then AR_OrgId := 129;
when 'SE' then AR_OrgId := 130;
when 'UK' then AR_OrgId := 131;
else raise_application_error (-20003, 'No such Country Code Exists.');
end case;
Exe_Pos := 3;
dbms_output.put_line('3: '||to_char(sysdate, 'HH24:MI:SS'));
populateOrderDetails(AR_OrgId);
dbms_output.put_line('4: '||to_char(sysdate, 'HH24:MI:SS'));
Exe_Pos := 4;
Open cTraffic;
Loop
Exe_Pos := 5;
CallDateArr.delete;
FETCH cTraffic BULK COLLECT
INTO CallDateArr, SiteArr, CountryArr, Customer_NameArr,CustomerNumberArr,
BCNArr,DESTINATION_TYPEArr,PRODUCT_CODEArr, PRODUCTArr, DurationArr, DebamounteurArr LIMIT arraySize;
EXIT WHEN CallDateArr.first IS NULL;
Exe_pos := 6;
FORALL i IN 1..callDateArr.last
insert into country_traffic_details
values(CallDateArr(i), CountryArr(i), Customer_NameArr(i),CustomerNumberArr(i),
BCNArr(i),DESTINATION_TYPEArr(i),PRODUCT_CODEArr(i), PRODUCTArr(i), DurationArr(i),
DebamounteurArr(i), SiteArr(i));
Exe_pos := 7;
dbms_output.put_line('7: '||to_char(sysdate, 'HH24:MI:SS'));
EXIT WHEN ctraffic%NOTFOUND;
END LOOP;
commit;
Exe_Pos := 8;
commit;
dbms_output.put_line('8: '||to_char(sysdate, 'HH24:MI:SS'));
lSql := 'CREATE INDEX COUNTRY_TRAFFIC_DETAILS_CUSTNO ON country_traffic_details (CUSTOMER_NUMBER)';
execDDl(lSql);
lSql := 'CREATE INDEX COUNTRY_TRAFFIC_DETAILS_BCN ON country_traffic_details (BCN)';
execDDl(lSql);
lSql := 'CREATE INDEX COUNTRY_TRAFFIC_DETAILS_PRODCD ON country_traffic_details (PRODUCT_CODE)';
execDDl(lSql);
lSql := 'CREATE INDEX COUNTRY_TRAFFIC_DETAILS_SITE ON country_traffic_details (SITE)';
execDDl(lSql);
lSql := 'CREATE INDEX COUNTRY_TRAFFIC_DETAILS_DESTYP ON country_traffic_details (DESTINATION_TYPE)';
execDDl(lSql);
Exe_Pos:= 9;
dbms_output.put_line('9: '||to_char(sysdate, 'HH24:MI:SS'));
Exception
When Others then
raise_application_error(-20003, 'Error in populateCountryTrafficDetails at Position: '||Exe_Pos||' The Error is '||SQLERRM);
End populateCountryTrafficDetails;
In the above procedure if i substitute the values with hard coded values i.e. AR_orgid = 123 & pcountry = 'Austria' then it runs faster.
Please let me know why it is so ?
Thanks in advance. -
What are the ways to make Query run fast?
Hi Experts,
When a query runs slow, we generally go for creating an aggregate. My doubt is - what other things can be done to make a query run faster before creating an aggregate? What is the thumb rule to be carried out for creating an aggregate?
Regards,
ShreeemHi Shreem,
If you keep Query simple not complicate it with runtime calculations , it would be smooth. However as per business requirements we will have to go for it anyways mostly.
regarding aggregates:
Please do not use the standard proposal , it will give you hundreds based on std. rules , which consumes lots of space and adds up to load times. If you have users already using the Query and you are planning to tune it then go for the statistics tables:
1.RSDDSTAT_OLAP find the query with long runtimes get the Stepuid
2. RSDDSTAT_DM
3. RSDDSTATAGGRDEF - use the stepuid above to see which aggregate is necessary for which cube.
Another way to check ; check the users as in 1 to find the highest runtime users and find the last used bookmarks by user thru RSZWBOOKMARK for this query and check if the time matches and create the aggregates as in 3 above.
You can also Use Transaction RSRT > execute & debug (display stats ) - to create generic aggregates to support navigations for New queries and later refine as above.
Hope it helps .
Thnks
Ram -
Hi Gurus,
We are using Report 10g on 10g Application server and solaris. we created a report on a table which has 10,000 rows. The report has 25 columns. when we run this query in Toad it took 12 sec for fetching all these 10,000 rows
But when we run the report with Destype = 'FILE' and Desformat = 'DELIMITEDDDATA', it is taking 5 to 8 minutes
to open in excel ( we concatenated mimetype=vnd-msexcel at the end of the url if the Destype=FILE). We removed the layout in the report as it is taking 10 to 15 mins to run to Screen with Desformat=HTML/PDF(formating pages taking more time). We are wondering why DELIMITEDDATA format is taking long time as it runs only query.
Does RWSERVLET take more time of writing the data to the Physical file in the cache dir? Our cache size is 1 GB. we have 2 report servers clustered. Tracing is off.
Please advise me if there are any report server settings to boost the performance.
Thanks alot,
Ram.Duplicate of Strange problem... Query runs faster, but report runs slow... in the Reports forum.
[Thread closed] -
Satellite C55-PSCG8E FAN running fast when pluged in
Hi There,
My laptop's FAN is running really fast and loudly when plugged in AC power source.
However the FAN runs quietly when the battery is used.
The laptop is new and so far only the antivirus application is running.
Is this a normal behavior or an issue ?
Normally a FAN run as fast when the CPU is hot and many applications are running.
regards,Hi Yassine
Dont be worried about this notebook behavior this is nothing unusual
The reason why the fan is running faster when AC adaptor is connected this very simple: the Windows system use different settings using the battery or mains power.
Using battery mode, the system is configured differently in order to save battery power and to increase notebook working time.
You can change the settings in control panel -> power options.
Here you will find different power plans
Click on the current power plant and check the Change Advanced power settings.
Here you would find the settings for cooling method (sometimes its placed within the Toshiba power saver or Processor power management).
There you can change System cooling policy: you will choose either passive or active
Maybe this FAQ could be interesting for you:
http://aps2.toshiba-tro.de/kb0/HTD12017W0001R01.htm -
Hi,
The issue is, a process, say "A" is running fine on certain days. On some days there are additional processes running on the server. When these additional processes are running, "Process A" suffers performance issue.
Interesting point is that, these additional processes were running since long time. But, earlier "Process A" was running fine even when these additional process were running. Suddenly from past 2 or 3 weeks there is performance issue in "Process
A", when these additional process run.
Note: Nothing has been modified for the process A.
Process A is an SQL job which has SSIS Package and stored proc in different steps
When multiple parallel processes are running, SSIS Package step suffers around 40% increase in execution time, where as stored procs have only 15-20% increase in execution time
When Process A is executed while no other big processes are running, it's execution time is fine. From past few days, issue is only when, some other big parallel processes are running.
Currently below is my analysis:
Since Process A is running fine when it is executed independently, I assume there is no issue in this process.
Since issue occurs when some other big process is running, when Process A is running, I believe it is DiskIO issue. Will the issue be resolved if RAM size is increased?
Is there any way to check if RAM is being fully utilized by the server
Is there any other possibility why there is a sudden dip in performance when parallel processes are running.
Is there any possibility of having issues in additional processes. Incase if it has some issues, does it impact "Process A"
Please let me know if you need any further information. Infact I am not able to diagnose what is the actual root cause for the performance issue in "Process A" as nothing has been modified.
Also it would be very much helpful, if I get any idea on different ways in reaching the actual root cause of this performance issue.
NOTE: This is a data warehouse
Thanks,
RakshaWhen a query has a parallel plan, it will in general try to grab all cores up to the maxdop setting, but then it often uses them inefficiently.
But in that case, there are better odds for the queries not battling on resources with each other!
What Josh alludes is to the fact that SQL Server needs to partition the data, so that different partitions are processed on different cores. This partitioning is based on statistics, and the statistics may be out of date or not accurate enough. This may
result in that the data is not partitioned proportionally, and some threads gets very little data to work with. Thus, these CPUs are still idle, so there may still be room for the two processes to run at full speed. (That is, full speed with the given plan,
which is not the full speed, had the partitioning been accurate.)
I mention this because you asked about parallelism, and many systems leave maxdop at its default setting of 0 (which means "go ahead and grab everything!") even though Microsoft recommends you set it to a different number depending on this and
that.
Since this is a data warehouse, Raksha should not tamper with "max degrees of parallelism", I think.
Erland Sommarskog, SQL Server MVP, [email protected] -
BEX WAD 7.0: Chart Takes Long Time to Display in Portal - Query runs FAST
I have a BEx WAD 7.0 template which contains 3 column charts (each with it's own seperate DataProvider/Query). When the page loads...two of the charts show up right away, but one of them takes almost a minute to display on the screen (I thought it was missing at first).
I ran all three queries in the BEx Query Analyzer (including the one for the chart that takes forever to load) and they all complete within 3 seconds of hitting "Execute." So I don't believe it is the query causing this issue.
The chart that doesn't show up right away does have more data to display than the other two...but I have queries/charts on other web templates that contain 3-times the data of this one and show up fine when executed in the portal.
Anyone else having this issue or have an idea on how I can optimize the WAD charts and/or find out what is causing this issue? Again...the query that fuels this chart completes its execution in about 3-4 seconds.
Thank you for your time and of course points will be assigned accordingly.
KevinHi,
have you already checked how much time the IGS consumes when creating the charts?
Run TA SIGS and check the statistics values.
Regards, Kai -
Query runs forever when using selection on line item dim
we have a cube zcube which has po number as a line item dimension .
everymonth users run queries this cube using po number as selection
criterai and using a wild card search on this field . every time
queries have run fine . however , this month when we try to do so
the query runs forever and no results are returned . i also tried
listcubing with similar selection but it also did not return any results .
our production system has lot of data . i tried in test system it worked fine
i checked the cube for compression and indices in production , they look fine
can anyone think of anything that could have gone wrong ? also did rsrv tests ..
but all come green
we have not done any developments on this cube , however we have shifted to
a new hardware in the past month . can anyone think of any reasons ?
anything that can help me catch the issue ? all suggestions welcomeNot sure,
Are you saying that you need both the counts seperately? or a combined count?
how are you joining alpha and beta tables? what is the join condition?
you need to do something like this,
SELECT COUNT(CASE WHEN
(A.col1 = 'Pete' AND SUBSTR(A.col2,,1,12)=SUBSTR(B.col2,,1,13))
OR ( A.col1 != 'Pete' AND SUBSTR(A.col2,,1,15)=SUBSTR(B.col2,,1,15))
THEN 1 ELSE 0
END)
FROM alpha A, beta b
WHERE alpha.join_cloumn= beta.join_columnG. -
What can I do to make this query run faster
Hi All,
The below query is taking a long time. Is there any thing that I can do to shorten its time.
SELECT C.FOLIO_NO, C.CO_TRANS_NO TRANS_NO, to_char(C.CREATED_DATE, 'dd/mm/yyyy') DOC_DATE, DECODE(PP.NAME, NULL, D.EMP_NAME, PP.NAME) LODGED_BY, decode(sf_fetch_datechange(c.co_trans_no, C.CO_TRANS_ID), Null, '-', sf_fetch_datechange(c.co_trans_no, C.CO_TRANS_ID)) DATE_CHANGE, P.RECEIPT_NO, decode(c.co_trans_id,'A020',(select nvl(base_trans_id,co_trans_id) from co_form5a_trans f where f.co_trans_no=c.co_trans_no),c.co_trans_id) TRANS_ID,(case when decode(c.co_trans_id,'A020',(select nvl(base_trans_id,co_trans_id) from co_form5a_trans f where f.co_trans_no=c.co_trans_no),c.co_trans_id)='AR20' then 1 when decode(c.co_trans_id,'A020',(select nvl(base_trans_id,co_trans_id) from co_form5a_trans f where f.co_trans_no=c.co_trans_no),c.co_trans_id)='AR03' then 2 end) TRANS_TYPE FROM CO_TRANS_MASTER C, PAYMENT_DETAIL P, PEOPLE_PROFILE PP, SC_AGENT_EMP D, M_CAA_TRANS E where '1' <> TRIM(UPPER('S0750070Z')) and (C.CO_TRANS_ID in TRIM(UPPER('AR20')) OR C.CO_TRANS_ID in TRIM(UPPER('AR03'))OR c.co_trans_id IN TRIM (UPPER ('A020')))and C.CO_TRANS_NO = P.TRANS_NO and (C.VOID_IND = 'N' or C.VOID_IND is Null) and C.CREATED_BY = PP.PP_ID(+) and C.PROF_NO = D.PROF_NO(+) and C.CREATED_BY = D.EMP_ID (+) and TRIM(UPPER(C.CO_NO)) = TRIM(UPPER('200101586W')) and c.co_trans_id = e.trans_id (+) order by FOLIO_NO;
SQL>
SQL> show parameter user_dump_dest
NAME TYPE VALUE
user_dump_dest string /u01/app/oracle/diag/rdbms/ebi
zfile/EBIZFILE1/trace
SQL> show parameter optimizer
NAME TYPE VALUE
optimizer_capture_sql_plan_baselines boolean FALSE
optimizer_dynamic_sampling integer 2
optimizer_features_enable string 11.2.0.2
optimizer_index_caching integer 0
optimizer_index_cost_adj integer 100
optimizer_mode string ALL_ROWS
optimizer_secure_view_merging boolean TRUE
optimizer_use_invisible_indexes boolean FALSE
optimizer_use_pending_statistics boolean FALSE
optimizer_use_sql_plan_baselines boolean TRUE
SQL> show parameter db_file_multi
NAME TYPE VALUE
db_file_multiblock_read_count integer 128
SQL> show parameter db_block_size
NAME TYPE VALUE
db_block_size integer 8192
SQL> show parameter cursor_sharing
NAME TYPE VALUE
cursor_sharing string EXACT
SQL>
SQL> column sname format a20
SQL> column pname format a20
SQL> column pval2 format a20
SQL>
SQL> select
2 sname, pname, pval1, pval2
3 from
4 sys.aux_stats$;
SNAME PNAME PVAL1 PVAL2
SYSSTATS_INFO STATUS COMPLETED
SYSSTATS_INFO DSTART 09-11-2010 14:25
SYSSTATS_INFO DSTOP 09-11-2010 14:25
SYSSTATS_INFO FLAGS 1
SYSSTATS_MAIN CPUSPEEDNW 739.734748
SYSSTATS_MAIN IOSEEKTIM 10
SYSSTATS_MAIN IOTFRSPEED 4096
SYSSTATS_MAIN SREADTIM
SYSSTATS_MAIN MREADTIM
SYSSTATS_MAIN CPUSPEED
SYSSTATS_MAIN MBRC
SYSSTATS_MAIN MAXTHR
SYSSTATS_MAIN SLAVETHR
13 rows selected.
Elapsed: 00:00:00.06
SQL>
SQL> explain plan for
2 SELECT C.FOLIO_NO, C.CO_TRANS_NO TRANS_NO, to_char(C.CREATED_DATE, 'dd/mm/yyyy') DOC_DATE, DECODE(PP.NAME, NULL, D.EMP_NAME, PP.NAME) LODGED_BY, decode(sf_fetch_datechange(c.co_trans_no, C.CO_TRANS_ID), Null, '-', sf_fetch_datechange(c.co_trans_no, C.CO_TRANS_ID)) DATE_CHANGE, P.RECEIPT_NO, decode(c.co_trans_id,'A020',(select nvl(base_trans_id,co_trans_id) from co_form5a_trans f where f.co_trans_no=c.co_trans_no),c.co_trans_id) TRANS_ID,(case when decode(c.co_trans_id,'A020',(select nvl(base_trans_id,co_trans_id) from co_form5a_trans f where f.co_trans_no=c.co_trans_no),c.co_trans_id)='AR20' then 1 when decode(c.co_trans_id,'A020',(select nvl(base_trans_id,co_trans_id) from co_form5a_trans f where f.co_trans_no=c.co_trans_no),c.co_trans_id)='AR03' then 2 end) TRANS_TYPE FROM CO_TRANS_MASTER C, PAYMENT_DETAIL P, PEOPLE_PROFILE PP, SC_AGENT_EMP D, M_CAA_TRANS E where '1' <> TRIM(UPPER('S0750070Z')) and (C.CO_TRANS_ID in TRIM(UPPER('AR20')) OR C.CO_TRANS_ID in TRIM(UPPER('AR03'))OR c.co_trans_id IN TRIM (UPPER ('A020')))and C.CO_TRANS_NO = P.TRANS_NO and (C.VOID_IND = 'N' or C.VOID_IND is Null) and C.CREATED_BY = PP.PP_ID(+) and C.PROF_NO = D.PROF_NO(+) and C.CREATED_BY = D.EMP_ID (+) and TRIM(UPPER(C.CO_NO)) = TRIM(UPPER('200101586W')) and c.co_trans_id = e.trans_id (+) order by FOLIO_NO;
Explained.
Elapsed: 00:00:00.09
SQL>
SQL> set pagesize 1000;
SQL> set linesize 170;
SQL> @/u01/app/oracle/product/11.2.0/rdbms/admin/utlxpls.sql
SQL> Rem
SQL> Rem $Header: utlxpls.sql 26-feb-2002.19:49:37 bdagevil Exp $
SQL> Rem
SQL> Rem utlxpls.sql
SQL> Rem
SQL> Rem Copyright (c) 1998, 2002, Oracle Corporation. All rights reserved.
SQL> Rem
SQL> Rem NAME
SQL> Rem utlxpls.sql - UTiLity eXPLain Serial plans
SQL> Rem
SQL> Rem DESCRIPTION
SQL> Rem script utility to display the explain plan of the last explain plan
SQL> Rem command. Do not display information related to Parallel Query
SQL> Rem
SQL> Rem NOTES
SQL> Rem Assume that the PLAN_TABLE table has been created. The script
SQL> Rem utlxplan.sql should be used to create that table
SQL> Rem
SQL> Rem With SQL*plus, it is recomended to set linesize and pagesize before
SQL> Rem running this script. For example:
SQL> Rem set linesize 100
SQL> Rem set pagesize 0
SQL> Rem
SQL> Rem MODIFIED (MM/DD/YY)
SQL> Rem bdagevil 02/26/02 - cast arguments
SQL> Rem bdagevil 01/23/02 - rewrite with new dbms_xplan package
SQL> Rem bdagevil 04/05/01 - include CPU cost
SQL> Rem bdagevil 02/27/01 - increase Name column
SQL> Rem jihuang 06/14/00 - change order by to order siblings by.
SQL> Rem jihuang 05/10/00 - include plan info for recursive SQL in LE row source
SQL> Rem bdagevil 01/05/00 - add order-by to make it deterministic
SQL> Rem kquinn 06/28/99 - 901272: Add missing semicolon
SQL> Rem bdagevil 05/07/98 - Explain plan script for serial plans
SQL> Rem bdagevil 05/07/98 - Created
SQL> Rem
SQL>
SQL> set markup html preformat on
SQL>
SQL> Rem
SQL> Rem Use the display table function from the dbms_xplan package to display the last
SQL> Rem explain plan. Force serial option for backward compatibility
SQL> Rem
SQL> select plan_table_output from table(dbms_xplan.display('plan_table',null,'serial'));
PLAN_TABLE_OUTPUT
Plan hash value: 2520189693
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 592 | 85248 | 16573 (1)| 00:03:19 |
| 1 | TABLE ACCESS BY INDEX ROWID | CO_FORM5A_TRANS | 1 | 20 | 2 (0)| 00:00:01 |
|* 2 | INDEX UNIQUE SCAN | SYS_C0059692 | 1 | | 1 (0)| 00:00:01 |
| 3 | TABLE ACCESS BY INDEX ROWID | CO_FORM5A_TRANS | 1 | 20 | 2 (0)| 00:00:01 |
|* 4 | INDEX UNIQUE SCAN | SYS_C0059692 | 1 | | 1 (0)| 00:00:01 |
| 5 | TABLE ACCESS BY INDEX ROWID | CO_FORM5A_TRANS | 1 | 20 | 2 (0)| 00:00:01 |
|* 6 | INDEX UNIQUE SCAN | SYS_C0059692 | 1 | | 1 (0)| 00:00:01 |
| 7 | SORT ORDER BY | | 592 | 85248 | 16573 (1)| 00:03:19 |
| 8 | NESTED LOOPS | | | | | |
| 9 | NESTED LOOPS | | 592 | 85248 | 16572 (1)| 00:03:19 |
| 10 | NESTED LOOPS OUTER | | 477 | 54855 | 15329 (1)| 00:03:04 |
| 11 | NESTED LOOPS OUTER | | 477 | 41499 | 14374 (1)| 00:02:53 |
| 12 | INLIST ITERATOR | | | | | |
|* 13 | TABLE ACCESS BY INDEX ROWID| CO_TRANS_MASTER | 477 | 22896 | 14367 (1)| 00:02:53 |
|* 14 | INDEX RANGE SCAN | IDX_CO_TRANS_ID | 67751 | | 150 (1)| 00:00:02 |
| 15 | TABLE ACCESS BY INDEX ROWID | SC_AGENT_EMP | 1 | 39 | 1 (0)| 00:00:01 |
|* 16 | INDEX UNIQUE SCAN | PK_SC_AGENT_EMP | 1 | | 0 (0)| 00:00:01 |
| 17 | TABLE ACCESS BY INDEX ROWID | PEOPLE_PROFILE | 1 | 28 | 2 (0)| 00:00:01 |
|* 18 | INDEX UNIQUE SCAN | SYS_C0063100 | 1 | | 1 (0)| 00:00:01 |
|* 19 | INDEX RANGE SCAN | IDX_PAY_DETAIL_TRANS_NO | 1 | | 2 (0)| 00:00:01 |
| 20 | TABLE ACCESS BY INDEX ROWID | PAYMENT_DETAIL | 1 | 29 | 3 (0)| 00:00:01 |
Predicate Information (identified by operation id):
2 - access("F"."CO_TRANS_NO"=:B1)
4 - access("F"."CO_TRANS_NO"=:B1)
6 - access("F"."CO_TRANS_NO"=:B1)
13 - filter(TRIM(UPPER("SYS_ALIAS_3"."CO_NO"))='200101586W' AND ("SYS_ALIAS_3"."VOID_IND" IS NULL
OR "SYS_ALIAS_3"."VOID_IND"='N'))
14 - access("SYS_ALIAS_3"."CO_TRANS_ID"='A020' OR "SYS_ALIAS_3"."CO_TRANS_ID"='AR03' OR
"SYS_ALIAS_3"."CO_TRANS_ID"='AR20')
16 - access("SYS_ALIAS_3"."PROF_NO"="D"."PROF_NO"(+) AND
"SYS_ALIAS_3"."CREATED_BY"="D"."EMP_ID"(+))
18 - access("SYS_ALIAS_3"."CREATED_BY"="PP"."PP_ID"(+))
19 - access("SYS_ALIAS_3"."CO_TRANS_NO"="P"."TRANS_NO")
42 rows selected.
Elapsed: 00:00:00.53
SQL>
SQL>
SQL>
SQL> rollback;
Rollback complete.
Elapsed: 00:00:00.01
SQL>
SQL> rem Set the ARRAYSIZE according to your application
SQL> set autotrace traceonly arraysize 100
SQL>
SQL> alter session set tracefile_identifier = 'mytrace1';
Session altered.
Elapsed: 00:00:00.00
SQL>
SQL> rem if you're using bind variables
SQL> rem define them here
SQL>
SQL> rem variable b_var1 number
SQL> rem variable b_var2 varchar2(20)
SQL>
SQL> rem and initialize them
SQL>
SQL> rem exec :b_var1 := 1
SQL> rem exec :b_var2 := 'DIAG'
SQL> set pagesize 1000;
SQL> set linesize 170;
SQL> alter session set events '10046 trace name context forever, level 8';
Session altered.
Elapsed: 00:00:00.01
SQL> SELECT C.FOLIO_NO, C.CO_TRANS_NO TRANS_NO, to_char(C.CREATED_DATE, 'dd/mm/yyyy') DOC_DATE, DECODE(PP.NAME, NULL, D.EMP_NAME, PP.NAME) LODGED_BY, decode(sf_fetch_datechange(c.co_trans_no, C.CO_TRANS_ID), Null, '-', sf_fetch_datechange(c.co_trans_no, C.CO_TRANS_ID)) DATE_CHANGE, P.RECEIPT_NO, decode(c.co_trans_id,'A020',(select nvl(base_trans_id,co_trans_id) from co_form5a_trans f where f.co_trans_no=c.co_trans_no),c.co_trans_id) TRANS_ID,(case when decode(c.co_trans_id,'A020',(select nvl(base_trans_id,co_trans_id) from co_form5a_trans f where f.co_trans_no=c.co_trans_no),c.co_trans_id)='AR20' then 1 when decode(c.co_trans_id,'A020',(select nvl(base_trans_id,co_trans_id) from co_form5a_trans f where f.co_trans_no=c.co_trans_no),c.co_trans_id)='AR03' then 2 end) TRANS_TYPE FROM CO_TRANS_MASTER C, PAYMENT_DETAIL P, PEOPLE_PROFILE PP, SC_AGENT_EMP D, M_CAA_TRANS E where '1' <> TRIM(UPPER('S0750070Z')) and (C.CO_TRANS_ID in TRIM(UPPER('AR20')) OR C.CO_TRANS_ID in TRIM(UPPER('AR03'))OR c.co_trans_id IN TRIM (UPPER ('A020')))and C.CO_TRANS_NO = P.TRANS_NO and (C.VOID_IND = 'N' or C.VOID_IND is Null) and C.CREATED_BY = PP.PP_ID(+) and C.PROF_NO = D.PROF_NO(+) and C.CREATED_BY = D.EMP_ID (+) and TRIM(UPPER(C.CO_NO)) = TRIM(UPPER('200101586W')) and c.co_trans_id = e.trans_id (+) order by FOLIO_NO;
10 rows selected.
Elapsed: 00:03:42.27
Execution Plan
Plan hash value: 2520189693
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 592 | 85248 | 16573 (1)| 00:03:19 |
| 1 | TABLE ACCESS BY INDEX ROWID | CO_FORM5A_TRANS | 1 | 20 | 2 (0)| 00:00:01 |
|* 2 | INDEX UNIQUE SCAN | SYS_C0059692 | 1 | | 1 (0)| 00:00:01 |
| 3 | TABLE ACCESS BY INDEX ROWID | CO_FORM5A_TRANS | 1 | 20 | 2 (0)| 00:00:01 |
|* 4 | INDEX UNIQUE SCAN | SYS_C0059692 | 1 | | 1 (0)| 00:00:01 |
| 5 | TABLE ACCESS BY INDEX ROWID | CO_FORM5A_TRANS | 1 | 20 | 2 (0)| 00:00:01 |
|* 6 | INDEX UNIQUE SCAN | SYS_C0059692 | 1 | | 1 (0)| 00:00:01 |
| 7 | SORT ORDER BY | | 592 | 85248 | 16573 (1)| 00:03:19 |
| 8 | NESTED LOOPS | | | | | |
| 9 | NESTED LOOPS | | 592 | 85248 | 16572 (1)| 00:03:19 |
| 10 | NESTED LOOPS OUTER | | 477 | 54855 | 15329 (1)| 00:03:04 |
| 11 | NESTED LOOPS OUTER | | 477 | 41499 | 14374 (1)| 00:02:53 |
| 12 | INLIST ITERATOR | | | | | |
|* 13 | TABLE ACCESS BY INDEX ROWID| CO_TRANS_MASTER | 477 | 22896 | 14367 (1)| 00:02:53 |
|* 14 | INDEX RANGE SCAN | IDX_CO_TRANS_ID | 67751 | | 150 (1)| 00:00:02 |
| 15 | TABLE ACCESS BY INDEX ROWID | SC_AGENT_EMP | 1 | 39 | 1 (0)| 00:00:01 |
|* 16 | INDEX UNIQUE SCAN | PK_SC_AGENT_EMP | 1 | | 0 (0)| 00:00:01 |
| 17 | TABLE ACCESS BY INDEX ROWID | PEOPLE_PROFILE | 1 | 28 | 2 (0)| 00:00:01 |
|* 18 | INDEX UNIQUE SCAN | SYS_C0063100 | 1 | | 1 (0)| 00:00:01 |
|* 19 | INDEX RANGE SCAN | IDX_PAY_DETAIL_TRANS_NO | 1 | | 2 (0)| 00:00:01 |
| 20 | TABLE ACCESS BY INDEX ROWID | PAYMENT_DETAIL | 1 | 29 | 3 (0)| 00:00:01 |
Predicate Information (identified by operation id):
2 - access("F"."CO_TRANS_NO"=:B1)
4 - access("F"."CO_TRANS_NO"=:B1)
6 - access("F"."CO_TRANS_NO"=:B1)
13 - filter(TRIM(UPPER("SYS_ALIAS_3"."CO_NO"))='200101586W' AND ("SYS_ALIAS_3"."VOID_IND" IS NULL
OR "SYS_ALIAS_3"."VOID_IND"='N'))
14 - access("SYS_ALIAS_3"."CO_TRANS_ID"='A020' OR "SYS_ALIAS_3"."CO_TRANS_ID"='AR03' OR
"SYS_ALIAS_3"."CO_TRANS_ID"='AR20')
16 - access("SYS_ALIAS_3"."PROF_NO"="D"."PROF_NO"(+) AND
"SYS_ALIAS_3"."CREATED_BY"="D"."EMP_ID"(+))
18 - access("SYS_ALIAS_3"."CREATED_BY"="PP"."PP_ID"(+))
19 - access("SYS_ALIAS_3"."CO_TRANS_NO"="P"."TRANS_NO")
Statistics
51 recursive calls
0 db block gets
651812 consistent gets
92202 physical reads
0 redo size
1594 bytes sent via SQL*Net to client
524 bytes received via SQL*Net from client
2 SQL*Net roundtrips to/from client
1 sorts (memory)
0 sorts (disk)
10 rows processed
SQL>
SQL> disconnect
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> Thanks in advance!Hi Raj,
I have given the output below as you requested....
QL> select * from table(dbms_xplan.display_cursor(null, null, 'ALLSTATS LAST'));
PLAN_TABLE_OUTPUT
SQL_ID 0taz7ckjm41yv, child number 1
SELECT C.FOLIO_NO, C.CO_TRANS_NO TRANS_NO, to_char(C.CREATED_DATE,
'dd/mm/yyyy') DOC_DATE, DECODE(PP.NAME, NULL, D.EMP_NAME, PP.NAME)
LODGED_BY, decode(sf_fetch_datechange(c.co_trans_no, C.CO_TRANS_ID),
Null, '-', sf_fetch_datechange(c.co_trans_no, C.CO_TRANS_ID))
DATE_CHANGE, P.RECEIPT_NO, decode(c.co_trans_id,'A020',(select
nvl(base_trans_id,co_trans_id) from co_form5a_trans f where
f.co_trans_no=c.co_trans_no),c.co_trans_id) TRANS_ID,(case when
decode(c.co_trans_id,'A020',(select nvl(base_trans_id,co_trans_id) from
co_form5a_trans f where f.co_trans_no=c.co_trans_no),c.co_trans_id)='AR2
0' then 1 when decode(c.co_trans_id,'A020',(select
nvl(base_trans_id,co_trans_id) from co_form5a_trans f where
f.co_trans_no=c.co_trans_no),c.co_trans_id)='AR03' then 2 end)
TRANS_TYPE FROM CO_TRANS_MASTER C, PAYMENT_DETAIL P, PEOPLE_PROFILE PP,
SC_AGENT_EMP D, M_CAA_TRANS E where '1' <> TRIM(UPPER('S0750070Z')) and
(C.CO_TRANS_ID in TRIM(UPPER('AR20')) OR C.CO_TRANS_ID in
TRIM(UPPER('AR03'))OR c.co
Plan hash value: 4175354585
| Id | Operation | Name | E-Rows | OMem | 1Mem | Used-Mem |
| 0 | SELECT STATEMENT | | | | | |
| 1 | TABLE ACCESS BY INDEX ROWID | CO_FORM5A_TRANS | 1 | | | |
|* 2 | INDEX UNIQUE SCAN | SYS_C0059692 | 1 | | | |
| 3 | TABLE ACCESS BY INDEX ROWID | CO_FORM5A_TRANS | 1 | | | |
|* 4 | INDEX UNIQUE SCAN | SYS_C0059692 | 1 | | | |
| 5 | TABLE ACCESS BY INDEX ROWID | CO_FORM5A_TRANS | 1 | | | |
|* 6 | INDEX UNIQUE SCAN | SYS_C0059692 | 1 | | | |
| 7 | SORT ORDER BY | | 12 | 2048 | 2048 | 2048 (0)|
| 8 | NESTED LOOPS | | | | | |
| 9 | NESTED LOOPS | | 12 | | | |
| 10 | NESTED LOOPS OUTER | | 10 | | | |
| 11 | NESTED LOOPS OUTER | | 10 | | | |
|* 12 | TABLE ACCESS FULL | CO_TRANS_MASTER | 10 | | | |
| 13 | TABLE ACCESS BY INDEX ROWID| SC_AGENT_EMP | 1 | | | |
|* 14 | INDEX UNIQUE SCAN | PK_SC_AGENT_EMP | 1 | | | |
| 15 | TABLE ACCESS BY INDEX ROWID | PEOPLE_PROFILE | 1 | | | |
|* 16 | INDEX UNIQUE SCAN | SYS_C0063100 | 1 | | | |
|* 17 | INDEX RANGE SCAN | IDX_PAY_DETAIL_TRANS_NO | 1 | | | |
| 18 | TABLE ACCESS BY INDEX ROWID | PAYMENT_DETAIL | 1 | | | |
Predicate Information (identified by operation id):
2 - access("F"."CO_TRANS_NO"=:B1)
4 - access("F"."CO_TRANS_NO"=:B1)
6 - access("F"."CO_TRANS_NO"=:B1)
12 - filter((INTERNAL_FUNCTION("SYS_ALIAS_3"."CO_TRANS_ID") AND
TRIM(UPPER("SYS_ALIAS_3"."CO_NO"))='200101586W' AND ("SYS_ALIAS_3"."VOID_IND" IS NULL OR
"SYS_ALIAS_3"."VOID_IND"='N')))
14 - access("SYS_ALIAS_3"."PROF_NO"="D"."PROF_NO" AND "SYS_ALIAS_3"."CREATED_BY"="D"."EMP_ID")
16 - access("SYS_ALIAS_3"."CREATED_BY"="PP"."PP_ID")
17 - access("SYS_ALIAS_3"."CO_TRANS_NO"="P"."TRANS_NO")
Note
- cardinality feedback used for this statement
- Warning: basic plan statistics not available. These are only collected when:
* hint 'gather_plan_statistics' is used for the statement or
* parameter 'statistics_level' is set to 'ALL', at session or system level
65 rows selected. -
Query runs fast in DB but slow in OBIEE
Hello guys
I am running some reports on the dashboard, which takes forever to come up. I capture the generated SQL and ran it in Toad, it would take only less than 2 mins to return the data.
What area of OBIEE configuration should I check to see what's happening?
Much thanksThanks.. Let me show you the query I am executing:
select T1011554.PECODE as c1,
T1011581.DATE as c2,
T1011581.DAYOFWEEK as c3
from
RD_TOT.TRANSACTIONTYPE T1011554 /*Transaction */ ,
RD_TOT.V_FACTS_SNAPSHOT_12 T1011580 /* Facts */ ,
RD_TOT.DATES T1011581 /* Date */
where ( T1011554.TRANSACTIONTYPEID = T1011580.TRANSACTIONTYPEID and T1011554.TRANSACTIONTYPECODE = '2' and T1011581.DAYOFWEEK = 'Monday' and T1011580.DOCUMENTCOMPANY = T1011581.COMPANYNUMBER and T1011580.SNAPSHOTDATE = T1011581.DATES and T1011581.DATES < TO_DATE('2009-10-28' , 'YYYY-MM-DD') )
When I run this query in Toad, it takes less than 30s to return, but from OBIEE, it's taking forever.. I am using Oracle 10g as DB... I am sure there are a lot of rows being fetched, because using the result I am getting in toad, if I do a record count, that process will take forever again..
There might be some configuration setup I need to do in OBIEE or config file. This is just my feelings, but I'd like to hear any of your thoughts and suggestions..
Much appreciated!
Thanks -
10g query running faster with RBO than CBO
I am running a query in Oracle 10g that is taking 1minute 15 seconds to run using the CBO. All the tables and indexes in the query are fully analyzed. However if i add a /*+ Rule */ hint to the query and force the optimizer to RBO it runs in 5 seconds.
Anyone any ideas why this would occur? it's contrary to everything Oracle says about CBO and problematic as RBO is no longer supported in 10g
Any help / advice greatfully appreciated
Thanks
DeclanMy "best" CBO explain plan is......
Explain complete.
Elapsed: 00:00:01:90
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes |TempSpc| Cost |
| 0 | SELECT STATEMENT | | 3364K| 2553M| | 666K|
| 1 | SORT ORDER BY | | 3364K| 2553M| 5840M| 666K|
| 2 | VIEW | | 3364K| 2553M| | 273K|
| 3 | UNION-ALL | | | | | |
|* 4 | HASH JOIN | | 2269K| 1415M| | 255K|
|* 5 | TABLE ACCESS FULL | NODE | 6 | 198 | | 183 |
|* 6 | HASH JOIN OUTER | | 2269K| 1344M| | 255K|
|* 7 | HASH JOIN | | 710 | 266K| | 2179 |
|* 8 | HASH JOIN OUTER | | 1219 | 165K| | 355 |
|* 9 | HASH JOIN | | 1219 | 154K| | 318 |
|* 10 | HASH JOIN | | 1219 | 138K| | 260 |
|* 11 | HASH JOIN | | 1219 | 127K| | 224 |
| 12 | TABLE ACCESS FULL | TMP_NODE_WALK_ALL_NODES | 8168 | 311K| | 17 |
|* 13 | HASH JOIN | | 10896 | 723K| | 201 |
| 14 | INDEX FAST FULL SCAN | PK_NODE_RULES_NODE_ID_RULE_ID | 10896 | 106K| | 6 |
| 15 | TABLE ACCESS FULL | NODE | 73004 | 4134K| | 183 |
| 16 | INDEX FAST FULL SCAN | IDX_NODE_CIX2 | 73004 | 641K| | 33 |
PLAN_TABLE_OUTPUT
| 17 | INDEX FAST FULL SCAN | IDX_NODE_CIX1 | 73004 | 998K| | 54 |
| 18 | INDEX FAST FULL SCAN | IDX_NODE_CIX2 | 73004 | 641K| | 33 |
|* 19 | TABLE ACCESS FULL | RULES | 6344 | 1517K| | 1820 |
| 20 | VIEW | | 405M| 89G| | 43581 |
|* 21 | HASH JOIN OUTER | | 405M| 23G| | 43581 |
| 22 | TABLE ACCESS FULL | TMP_NODE_WALK_ALL_NODES | 8168 | 103K| | 17 |
| 23 | TABLE ACCESS FULL | UNIVERSAL_RULES | 3377K| 157M| | 43256 |
|* 24 | HASH JOIN OUTER | | 1094K| 410M| 148M| 17453 |
| 25 | MERGE JOIN CARTESIAN | | 390K| 143M| | 15029 |
| 26 | NESTED LOOPS | | 70 | 25060 | | 2849 |
| 27 | NESTED LOOPS | | 70 | 21000 | | 2779 |
| 28 | TABLE ACCESS BY INDEX ROWID| UNIVERSAL_RULES | 1392 | 76560 | | 1387 |
|* 29 | INDEX RANGE SCAN | IDX_UNIVERSAL_RULES_ACCOUNT | 1392 | | | 6 |
|* 30 | TABLE ACCESS BY INDEX ROWID| RULES | 1 | 245 | | 1 |
|* 31 | INDEX UNIQUE SCAN | PK_RULES_RULE_ID_VERSION_ID | 20 | | | |
|* 32 | TABLE ACCESS BY INDEX ROWID | NODE | 1 | 58 | | 1 |
|* 33 | INDEX UNIQUE SCAN | PK_NODE_NODE_ID | 6 | | | |
| 34 | BUFFER SORT | | 5616 | 153K| | 15028 |
| 35 | TABLE ACCESS BY INDEX ROWID | NODE | 5616 | 153K| | 174 |
|* 36 | INDEX RANGE SCAN | IDX_NODE_NODE_TYPE_ID | 5616 | | | 11 |
|* 37 | INDEX FAST FULL SCAN | IDX_RULES_RULE_ID_STATUS | 42293 | 289K| | 48 |
PLAN_TABLE_OUTPUT
Predicate Information (identified by operation id):
4 - access("NODE"."NODE_TYPE_ID"="SN"."HIERARCHY_TYPE_ID")
5 - filter("NODE"."PARENT_NODE_ID" IS NULL)
6 - access("SYS_ALIAS_1"."RULE_ID"="UR"."RULE_ID"(+) AND "SYS_ALIAS_1"."VERSION_ID"="UR"."VERSION_ID"(+))
7 - access("NR"."RULE_ID"="SYS_ALIAS_1"."COMBINED_RULE_ID")
8 - access("SN"."PARENT_NODE_ID"="SP"."NODE_ID"(+))
9 - access("AN"."START_NODE_ID"="SN"."NODE_ID")
10 - access("AN"."EFFECTIVE_NODE_ID"="EN"."NODE_ID")
11 - access("AN"."SHORTCUT_NODE_ID"="N"."NODE_ID")
13 - access("N"."NODE_ID"="NR"."NODE_ID")
19 - filter(',A,P,' LIKE '%,'||"SYS_ALIAS_1"."STATUS"||',%')
21 - access("UR"."NODE_ID"(+)="AN"."START_NODE_ID")
24 - access("R"."RULE_ID"="RP"."RULE_ID"(+))
29 - access("UR"."ACCOUNT_ID"='0069')
30 - filter(',A,P,' LIKE '%,'||"R"."STATUS"||',%')
31 - access("UR"."RULE_ID"="R"."RULE_ID" AND "UR"."VERSION_ID"="R"."VERSION_ID")
32 - filter("N"."HIERARCHY_TYPE_ID"=9)
PLAN_TABLE_OUTPUT
33 - access("UR"."NODE_ID"="N"."NODE_ID")
36 - access("NODE"."NODE_TYPE_ID"=9)
37 - filter("RP"."STATUS"(+)='P')
Note: cpu costing is off
28 rows selected.
Elapsed: 00:00:02:45
68 rows selected.
Elapsed: 00:00:05:76While my RBO explain plan is
Explain complete.
Elapsed: 00:00:01:23
PLAN_TABLE_OUTPUT
| Id | Operation | Name | Rows | Bytes | Cost |
| 0 | SELECT STATEMENT | | | | |
| 1 | SORT ORDER BY | | | | |
| 2 | VIEW | | | | |
| 3 | UNION-ALL | | | | |
| 4 | MERGE JOIN OUTER | | | | |
| 5 | SORT JOIN | | | | |
|* 6 | TABLE ACCESS BY INDEX ROWID | NODE | | | |
| 7 | NESTED LOOPS | | | | |
| 8 | NESTED LOOPS | | | | |
| 9 | NESTED LOOPS | | | | |
| 10 | NESTED LOOPS | | | | |
| 11 | NESTED LOOPS | | | | |
| 12 | NESTED LOOPS OUTER | | | | |
| 13 | NESTED LOOPS | | | | |
| 14 | TABLE ACCESS FULL | TMP_NODE_WALK_ALL_NODES | | | |
| 15 | TABLE ACCESS BY INDEX ROWID| NODE | | | |
|* 16 | INDEX UNIQUE SCAN | PK_NODE_NODE_ID | | | |
PLAN_TABLE_OUTPUT
| 17 | TABLE ACCESS BY INDEX ROWID | NODE | | | |
|* 18 | INDEX UNIQUE SCAN | PK_NODE_NODE_ID | | | |
| 19 | TABLE ACCESS BY INDEX ROWID | NODE | | | |
|* 20 | INDEX UNIQUE SCAN | PK_NODE_NODE_ID | | | |
| 21 | TABLE ACCESS BY INDEX ROWID | NODE | | | |
|* 22 | INDEX UNIQUE SCAN | PK_NODE_NODE_ID | | | |
| 23 | TABLE ACCESS BY INDEX ROWID | NODE_RULES | | | |
|* 24 | INDEX RANGE SCAN | IDX_NODE_RULES_NODE_ID | | | |
|* 25 | TABLE ACCESS BY INDEX ROWID | RULES | | | |
|* 26 | INDEX RANGE SCAN | IDX_RULES_COMBINED_RULE_ID | | | |
|* 27 | INDEX RANGE SCAN | IDX_NODE_NODE_TYPE_ID | | | |
|* 28 | SORT JOIN | | | | |
| 29 | VIEW | | | | |
| 30 | NESTED LOOPS OUTER | | | | |
| 31 | TABLE ACCESS FULL | TMP_NODE_WALK_ALL_NODES | | | |
| 32 | TABLE ACCESS BY INDEX ROWID | UNIVERSAL_RULES | | | |
|* 33 | INDEX RANGE SCAN | IDX_UNIVERSAL_RULES_NODE | | | |
| 34 | NESTED LOOPS OUTER | | | | |
| 35 | NESTED LOOPS | | | | |
| 36 | NESTED LOOPS | | | | |
| 37 | NESTED LOOPS | | | | |
PLAN_TABLE_OUTPUT
| 38 | TABLE ACCESS BY INDEX ROWID | NODE | | | |
|* 39 | INDEX RANGE SCAN | IDX_NODE_NODE_TYPE_ID | | | |
| 40 | TABLE ACCESS BY INDEX ROWID | UNIVERSAL_RULES | | | |
|* 41 | INDEX RANGE SCAN | IDX_UNIVERSAL_RULES_ACCOUNT | | | |
|* 42 | TABLE ACCESS BY INDEX ROWID | NODE | | | |
|* 43 | INDEX UNIQUE SCAN | PK_NODE_NODE_ID | | | |
|* 44 | TABLE ACCESS BY INDEX ROWID | RULES | | | |
|* 45 | INDEX UNIQUE SCAN | PK_RULES_RULE_ID_VERSION_ID | | | |
|* 46 | INDEX RANGE SCAN | IDX_RULES_RULE_ID_STATUS | | | |
Predicate Information (identified by operation id):
6 - filter("NODE"."PARENT_NODE_ID" IS NULL)
16 - access("AN"."START_NODE_ID"="SN"."NODE_ID")
18 - access("SN"."PARENT_NODE_ID"="SP"."NODE_ID"(+))
20 - access("AN"."EFFECTIVE_NODE_ID"="EN"."NODE_ID")
22 - access("AN"."SHORTCUT_NODE_ID"="N"."NODE_ID")
24 - access("N"."NODE_ID"="NR"."NODE_ID")
25 - filter(',A,P,' LIKE '%,'||"SYS_ALIAS_1"."STATUS"||',%')
PLAN_TABLE_OUTPUT
26 - access("NR"."RULE_ID"="SYS_ALIAS_1"."COMBINED_RULE_ID")
27 - access("NODE"."NODE_TYPE_ID"="SN"."HIERARCHY_TYPE_ID")
28 - access("SYS_ALIAS_1"."RULE_ID"="UR"."RULE_ID"(+))
filter("SYS_ALIAS_1"."VERSION_ID"="UR"."VERSION_ID"(+) AND
"SYS_ALIAS_1"."RULE_ID"="UR"."RULE_ID"(+))
33 - access("UR"."NODE_ID"(+)="AN"."START_NODE_ID")
39 - access("NODE"."NODE_TYPE_ID"=9)
41 - access("UR"."ACCOUNT_ID"='0069')
42 - filter("N"."HIERARCHY_TYPE_ID"=9)
43 - access("UR"."NODE_ID"="N"."NODE_ID")
44 - filter(',A,P,' LIKE '%,'||"R"."STATUS"||',%')
45 - access("UR"."RULE_ID"="R"."RULE_ID" AND "UR"."VERSION_ID"="R"."VERSION_ID")
46 - access("R"."RULE_ID"="RP"."RULE_ID"(+) AND "RP"."STATUS"(+)='P')
Note: rule based optimization
28 rows selected.
Elapsed: 00:00:04:42
78 rows selected.
Elapsed: 00:00:08:86Any additional help appreciated
I am going to try and run a trace against the sql now and see if i can get any more information
Thanks in advance
Declan -
Update query running fine when subquery in where clause is wrong.
Hi,
I am running one update statement-
Update table a set column1=2000
where a.column2 in(select col 3 from Table b where b.col4=111)
Now when I run the subquery: select col 3 from Table b where b.col4=111-----> It gives me error "col 3 invalid identifier"
But when I run the full query then it updates the 700 rows.
Can somebody please explain this?
My subquery is throwing error but when i use that in another query it is running fine.Col_3 must be in your outer table (table_a, I guess).
If you always prefixed column names with a table alias, you'd know in an instant. -
Hi All,
I have a query which runs with in 4 mins in Toad and also report 6i. But when ran through applications takes 3 to 4 hrs to complete normal.This report fetches huge amount of data will that be the reason for poor performance?? I am unable to figure that out. I was able to avoid full table scan on the tables used. But still have the problem.
Any suggestions please.
Thank you in advance.
PrathimaIf you want to have a look at the query. This report gives a way to monitor the receipts entered for pay from receipt POs.
SELECT
hou.name "OPERATING_UNIT_NAME"
,glc.segment1 "UEC"
,glc.segment2 "DEPT"
,pov.vendor_name "VENDOR_NAME"
,msi.SEGMENT1 "ITEM_NUM"
,rcvs.receipt_num "RECEIPT_NUM"
,poh.segment1 "PO_NUMBER"
,pol.line_num "PO_LINE_NUM"
,por.RELEASE_NUM "RELEASE_NUMBER"
,poll.shipment_num "SHIPMENT_NUM"
,hrou.name "SHIP_TO_ORGANIZATION"
,trunc(rcv.transaction_date) "TRANSACTION_DATE"
,decode (transaction_type,'RECEIVE', 'ERS', 'RETURN TO VENDOR','RTS') "RECEIPT_TYPE"
,decode (rcv.transaction_type,'RECEIVE', 1, 'RETURN TO VENDOR', -1)* rcv.quantity "RECEIPT_QTY"
,rcv.po_unit_price "PO_UNIT_PRICE"
,decode (rcv.transaction_type,'RECEIVE', 1, 'RETURN TO VENDOR', -1)*rcv.quantity*po_unit_price "RECEIPT_AMOUNT"
,rcvs.packing_slip "PACKING_SLIP"
,poll.quantity "QUANTITY_ORDERED"
,poll.quantity_received "QUANTITY_RECEIVED"
,poll.quantity_accepted "QUANTITY_ACCEPTED"
,poll.quantity_rejected "QUANTITY_REJECTED"
,poll.quantity_billed "QUANTITY_BILLED"
,poll.quantity_cancelled "QUANTITY_CANCELLED"
,(poll.quantity_received - (poll.quantity - poll.quantity_cancelled)) "QUANTITY_OVER_RECEIVED"
,(poll.quantity_received - (poll.quantity - poll.quantity_cancelled))*po_unit_price "OVER_RECEIVED_AMOUNT"
,poh.currency_code "CURRENCY_CODE"
,perr.full_name "RECEIVER"
,perb.full_name "BUYER"
FROM
po.po_vendors pov
,po.po_headers_all poh
,po.po_lines_all pol
,po.po_line_locations_all poll
,po.po_distributions_all pod
,po.po_releases_all por
,hr.hr_all_organization_units hou
,hr.hr_all_organization_units hrou
,po.rcv_transactions rcv
,po.rcv_shipment_headers rcvs
,gl.gl_code_combinations glc
,hr.per_all_people_f perr
,hr.per_all_people_f perb
,inv.mtl_system_items_b msi
where
poh.org_id = hou.organization_id
and pov.vendor_id (+) = poh.vendor_id
and pod.po_header_id = poh.po_header_id
and pod.po_line_id = pol.po_line_id
and pod.line_location_id = poll.line_location_id
and poll.po_header_id = poh.po_header_id
and poll.po_line_id = pol.po_line_id
and pol.po_header_id = poh.po_header_id
and poh.pay_on_code like 'RECEIPT'
and pod.po_header_id = rcv.po_header_id
and pod.po_line_id = rcv.po_line_id
and pod.po_release_id = rcv.po_release_id
and pod.po_release_id = por.po_release_id
and por.po_header_id = poh.po_header_id
and hrou.organization_id = poll.ship_to_organization_id
and pod.line_location_id = rcv.po_line_location_id
and pod.po_distribution_id = rcv.po_distribution_id
and rcv.transaction_type in ('RECEIVE','RETURN TO VENDOR')
and rcv.shipment_header_id = rcvs.shipment_header_id (+)
and pod.code_combination_id = glc.code_combination_id
and rcvs.employee_id = perr.person_id
and por.agent_id = perb.person_id (+)
and perr.person_type_id = 1
and perb.person_type_id = 1
and msi.organization_id = 1 --poll.ship_to_organization_id
and msi.inventory_item_id = pol.item_id
and poh.type_lookup_code = 'BLANKET'
and hou.organization_id = nvl(:p_operating_unit,hou.organization_id)
and trunc(rcv.transaction_date) between :p_transaction_date_from and :p_transaction_date_to
Message was edited by:
Prathima -
Query running slow when using case inside when
Hi All,
I am in the process of creating a query as per the following conditions:
select count(*) from Alpha A, Beta B
where
(case
when
A.col1='Pete' and substr(A.col2,1,12)=substr(B.col2,1,12)
then 1
else
-- for all other cases when A.col1 is not equal to 'Pete', substr 1-15 needs to be checked on A and B
when A.col1 != 'Pete' and substr(A.col2,1,15)=substr(B.col2,1,15)
then 1
else 0
end)=1
When i run the whole query together, it continues to run forever and i have to eventually kill it. However, when i run the 2 WHEN clauses seperately, it runs within a second and fetches me the correct data. What goes wrong while merging these two inside 2 WHEN clauses that it causes the query to drag?
Please advise.
Thanks in advance.Not sure,
Are you saying that you need both the counts seperately? or a combined count?
how are you joining alpha and beta tables? what is the join condition?
you need to do something like this,
SELECT COUNT(CASE WHEN
(A.col1 = 'Pete' AND SUBSTR(A.col2,,1,12)=SUBSTR(B.col2,,1,13))
OR ( A.col1 != 'Pete' AND SUBSTR(A.col2,,1,15)=SUBSTR(B.col2,,1,15))
THEN 1 ELSE 0
END)
FROM alpha A, beta b
WHERE alpha.join_cloumn= beta.join_columnG.
Maybe you are looking for
-
Please use a more informative subject in future hi Experts In my module pool program i having a list box in a modeled dialog box . if the list box is left empty it will give an error message .after pressing the enter buttton the list box gets disable
-
MarkLogic Server as a datasource in OBIEE
Does anyone know if its possible to connect MarkLogic as an XML datasource into OBIEE? I've looked on both the Oracle and MarkLogic sites, and searched the net, but their doesn't seem to be an awful lot of info.
-
hello, i am a Mexican artist and ned buy some of the apps but i dont need the full Creative Cloud pacage for now, and the photography plan is not enough, i can buy illustrator, photoshop, lightroom and coreldraw, like make a pacage whit what i need??
-
Does a previously unlocked phone need to be unlocked again?
I had my Sumsung Note unlocked two years ago and the process worked smoothly. Im going abroad again and want to know if i have go through the process again. Ive used it on the att net since using it abroad. Now i want to use it overseas again.
-
I cant print text to Canon LBP 5100
I have Canon LBP 5100 colour laser printer connected via a network. It used to be fine but now will not print text in a document sent from my iMac or a Macbook Pro. If the document contains text and graphics it will print the graphics only. It is