Query Estimated Completion Time
Hello ,
Good Morning. I recently started supporting new set of databases from different team and I am having the problem of
figuring out how much time Stored procedure is going to take to complete?
Some of the queries take few hours and I am pretty much left in the dark and I don't have historical knowledge of those stored procedures.
I am trying to figure out is there any options available to figure out the estimated completion time for a given query or operation?.
How does other folks solve this problem?
sys.dm_exec_requests DMV's estimated completion time is 0.
I understand the time to complete a query depends on numerous factors ( CPUS, other running processes, Preemptive/non preemptive mode, blocking, page reads, writes, etc ,etc ).
I am really interested in knowing how other people handle this problem because its new set of databases for me.
Appreciate your help.
Cheers,
I90Runner
I90Runner
Taken from Glenn Berry's excellent SQL Server Diagnostic Queries:
-- Top Cached SPs By Avg Elapsed Time
SELECT TOP(25) p.name AS [SP Name], qs.total_elapsed_time/qs.execution_count AS [avg_elapsed_time],
qs.total_elapsed_time, qs.execution_count, ISNULL(qs.execution_count/DATEDIFF(Second, qs.cached_time,
GETDATE()), 0) AS [Calls/Second], qs.total_worker_time/qs.execution_count AS [AvgWorkerTime],
qs.total_worker_time AS [TotalWorkerTime], qs.cached_time
FROM sys.procedures AS p WITH (NOLOCK)
INNER JOIN sys.dm_exec_procedure_stats AS qs WITH (NOLOCK)
ON p.[object_id] = qs.[object_id]
WHERE qs.database_id = DB_ID()
ORDER BY avg_elapsed_time DESC OPTION (RECOMPILE);
This will give you an indicator of just how slow, the slowest Stored Procedures are in the Plan Cache.
You can easily tweak the above query to look at all historically executed SPs or filter for just those that you are interested in looking at.
Of course this is all retrospective information. The only way to know for sure how long a given stored procedure is going to take to run, is to run it.
John Sansom | SQL Server MCM
Blog |
Twitter | LinkedIn |
SQL Consulting
Similar Messages
-
REMOTE QUERY ESTIMATED TIME OF COMPLETION
HI,
I am running a query on which does REMOTE INNER JOIN and the query is taking forever.
I am trying to figure out when the query would complete. Estimated Completion time is set to 0 from the dynamic view.
I don't have the DB OWNER permission to see whats going on REMOTE Server.
Is there options available to figure out what percentage is complete and what percentage is remaining.
Looking at the WAIT TYPE , its waiting for OLEDB Wait type . ( Remote query execution ).
I would appreciate the help on this?
Thanks,
SELECT * FROM sys.dm_exec_requests req
CROSS APPLY sys.dm_exec_sql_text(req.sql_handle) as sqltext
WHERE session_id != @@SPID
connection_id blocking_session_id wait_type wait_time last_wait_type wait_resource open_transaction_count open_resultset_count transaction_id context_info percent_complete estimated_completion_time cpu_time total_elapsed_time
A80C7435-54C1-49F3-86F1-3F7EEF56FD32 0 OLEDB 52 OLEDB CHC-SQLREP01 (SPID=119) 0 1 294705 0x 0 0 4875 1188972
SELECT session_id,percent_complete,CASE estimated_completion_time WHEN 0 THEN'NA' ELSE CONVERT ( VARCHAR(255),DATEADD(MILLISECOND,estimated_completion_time,CURRENT_TIMESTAMP)) END Estimated_finish_time,
(total_elapsed_time/1000)/60 Total_Elapsed_Time_MINS ,
DB_NAME(Database_id) Database_Name ,command,sql_handle
FROM sys.dm_exec_requests WHERE session_id=54
session_id percent_complete Estimated_finish_time Total_Elapsed_Time_MINS Database_Name command sql_handle
54 0 NA 39 AFTOOLS SELECT 0x020000006088211F8613526B75F454C7B037FDF904DAB452
I90RunnerYou would need to be a sysadmin on the remote server to see what is going on.
From your previous message, this will never work. This will always be slow, you will never be happy using linked server to query this server. You would be better off creating either transactional replication or some other method of getting that
table local. -
How to find query completion time
How to find active insert query completion time in oracle?
friend,
i don't find anything in the query since time_remaing value show zero.
select TIME_REMAINING,TOTALWORK,START_TIME,SOFAR from v$session_longops where sid=115.
TIME_REMAINING TOTALWORK START_TIM SOFAR
0 21456 11-MAY-09 21456
0 4588 11-MAY-09 4588
0 6138 11-MAY-09 6138
could you please guide me how to calcaluate the completion time? -
Sql query to calculate order completion time
Hello,
This is probably a textbook example, but I was wondering if someone could show me the technique to answer the following question based on the sample data:
Show all orders from the orders table where completion time (defined as difference between time the order was completed and received). is > 5 hours
Order_id
Action
Time
1
Received
1/11/2014 10:12:00
1
Logged
1/11/2014 10:15:00
1
Sent
1/11/2014 15:15:00
1
Complete
1/11/2014 16:15:00
2
Received
31/10/2014 8:10
2
Logged
31/10/2014 8:28
2
Sent
31/10/2014 10:11
2
Complete
31/10/2014 12:13
3
Received
30/10/2014 13:10
3
Logged
30/10/2014 15:10
3
Sent
30/10/2014 16:10
3
Complete
30/10/2014 17:10
Thankscreate table orders (order_id int, action varchar(50), [time] datetime)
insert into orders values(1,'Received','1/11/2014 10:12'),(1,'Logged','1/11/2014 10:15'),(1,'Sent','1/11/2014 15:15'),(1,'Complete','1/11/2014 16:15'),
(2,'Received','10/31/2014 08:10'),(2,'Logged','10/31/2014 08:28'),(2,'Sent','10/31/2014 10:11'),(2,'Complete','10/31/2014 12:13'),
(3,'Received','10/30/2014 13:10'),(3,'Logged','10/30/2014 15:10'),(3,'Sent','10/30/2014 16:10'),(3,'Complete','10/30/2014 17:10')
select order_id from (
select *, datediff(hour,lag([time],1) Over(partition by order_id Order by [time]),[time]) diff
from orders WHERE action IN ('Complete','Received')) t
WHERE diff>=5
drop table orders -
Approach to tune a query in short time
Hi All,
Oracle 10g I know this question is asked number of times and there are many good replies to them.
But I just want to know how to approach a completely new query ( like the task given to me to fine tume a query in 1 day when I dont have even the slightest idea about how to proceed) if the timeline is very stringent and by just looking at the explain plan, you have to take the decision.
I am just posting my query here and what I am looking for is some lead on how to identify the congetion point which is where this query takes long time ( in my case some 15 mins as reported to me)
select
"LEGAL ENTITY",
"Legal Entity Description",
"Cluster",
"Sub_Cluster",
"Account",
rownum,
"Moody_Rating",
"Process_Date",
"Merge_Description",
rownum,
"Merge_Description",
"is_id_ic",
"is_n",
"cusip",
"isin",
"credit_spread_PV01",
"amount",
"Market_Value",
"Currency",
"Sensitivity_Type",
"maturity_Date",
"Exception_Flag",
"Base_Security_Id",
DECODE(sign("Market_Value"),-1,DeCode(SigN("Recovery"),-1,"Recovery",('-'||"Recovery")), ABS("Recovery")) as "Recovery"
from
select
le.name "LEGAL ENTITY",
le.display_name "Legal Entity Description",
mn4.display_name "Cluster",
mn3.display_name "Sub_Cluster",
bookname.display_name "Account",
(SELECT RATING_NAME
FROM moody_rating
where moody_rating_id = i.moody_rating_id) "Moody_Rating",
to_char(to_date(:v_cob_date,'DD-MM-YY'),'YYYYMMDD') "Process_Date",
ss.issuer "Merge_Description",
PART.MARS_ISSUER "is_id_ic",
PART.PARTICIPANT_NAME "is_n",
NULL "cusip",
NULL "isin",
NULL "credit_spread_PV01",
NULL "amount",
sum(mtmsens.sensitivity_value) "Market_Value",
(SELECT distinct cc.CCY
FROM legacy_country CC
INNER JOIN MARSNODE MN ON CC.countryisocode = MN.NAME
and mn.close_date is null
INNER JOIN MARSNODETYPE MNT ON MN.TYPE_ID =
MNT.NODE_TYPE_ID
AND MNT.NAME = 'COUNTRY'
and mnt.close_date is null
where MN.NODE_ID = part.country_domicile_id
and cc.begin_cob_date <= :v_cob_date
and cc.end_cob_date > :v_cob_date
and rownum < 2) "Currency",
'CREDITSPREADMARKETVALUE' "Sensitivity_Type",
NULL "maturity_Date",
NULL "Exception_Flag",
NULL "Base_Security_Id",
sum(ss.sensitivity_value) "Recovery"
from staging_position sp
left JOIN position p on (
p.feed_instance_id = sp.feed_instance_id
AND p.feed_row_id = sp.feed_row_id)
left JOIN staging_instrument si on (si.feed_instance_id =
sp.feed_instance_id AND
si.position_key =
sp.position_key)
left join book b on (b.book_id = p.book_id and
b.begin_cob_date <= :v_cob_date and
b.end_cob_date > :v_cob_date)
left join marsnode bk on (b.book_id = bk.node_id and
bk.close_date is null)
left join marsnode le on (b.leg_ent_id = le.node_id and
le.close_date is null)
left join marsnode bookname on (bookname.node_id = p.book_id and
bookname.close_date is null)
left join marsnodelink mnl on p.book_id = mnl.node_id
and :v_bus_org_hier_id =
mnl.hierarchy_id
and mnl.close_date is null
and :v_cob_date >= mnl.begin_cob_date
and :v_cob_date < mnl.end_cob_date
left join marsnode mn on mn.node_id = mnl.parent_id
and mn.close_date is null
left join marsnodelink mnl2 on mn.node_id = mnl2.node_id
and :v_bus_org_hier_id =
mnl2.hierarchy_id
and mnl2.close_date is null
and :v_cob_date >= mnl2.begin_cob_date
and :v_cob_date < mnl2.end_cob_date
left join marsnode mn2 on mn2.node_id = mnl2.parent_id
and mn2.close_date is null
left join marsnodelink mnl3 on mn2.node_id = mnl3.node_id
and :v_bus_org_hier_id =
mnl3.hierarchy_id
and mnl3.close_date is null
and :v_cob_date >= mnl3.begin_cob_date
and :v_cob_date < mnl3.end_cob_date
left join marsnode mn3 on mn3.node_id = mnl3.parent_id
and mn3.close_date is null
left join marsnodelink mnl4 on mn3.node_id = mnl4.node_id
and :v_bus_org_hier_id =
mnl4.hierarchy_id
and mnl4.close_date is null
and :v_cob_date >= mnl4.begin_cob_date
and :v_cob_date < mnl4.end_cob_date
left join marsnode mn4 on mn4.node_id = mnl4.parent_id
and mn4.close_date is null
--sensitivity data
left JOIN STAGING_SENSITIVITY ss ON (ss.FEED_INSTANCE_ID =
sp.FEED_INSTANCE_ID AND
ss.FEED_ROW_ID =
sp.FEED_ROW_ID)
--sensitivity data
left JOIN STAGING_SENSITIVITY mtmsens ON (mtmsens.FEED_INSTANCE_ID =
sp.FEED_INSTANCE_ID AND
mtmsens.FEED_ROW_ID =
sp.FEED_ROW_ID)
LEFT join xref_domain_value_map XREF on (XREF.Src_Value =
ss.issuer and
XREF.close_action_id is null and
XREF.Begin_Cob_Date <=
:v_cob_date and
XREF.End_Cob_Date >
:v_cob_date AND
xref.domain_map_id = 601 AND
xref.source_system_id = 307 AND xref.ISSUE_ID is not null)
Left join ISSUE i on (i.issue_id = xref.issue_id)
LEFT join participant PART ON (PART.PARTICIPANT_ID =
XREF.TGT_VALUE and
PART.Close_Action_Id is null and
PART.Begin_Cob_Date <= :v_cob_date and
PART.End_Cob_Date > :v_cob_date)
left join moody_rating RATING on (rating.moody_rating_id =
i.MOODY_RATING_ID)
where sp.feed_instance_id in
(select fbi.feed_instance_id
from feed_book_status fbi ,
feed_instance fi
where fbi.cob_date = :v_cob_date
and fbi.feed_instance_id = fi.feed_instance_id
and fi.feed_id in (
select feed_id from feed_group_xref where feed_group_id in (
select feed_group_id from feed_group where description like 'CDO Feeds')
and close_action_id is null
and sp.Feed_Row_Status_Id = 1
and ss.sensitivity_type = 'CREDITSPREADDEFAULT'
and mtmsens.sensitivity_type = 'MTMVALUE'
and le.name='161'
group by le.name,
le.display_name,
mn3.display_name,
mn4.display_name,
mn.display_name,
i.moody_rating_id,
ss.issuer,
PART.MARS_ISSUER,
PART.PARTICIPANT_NAME,
sp.feed_instance_id,
part.country_domicile_id,
bookname.display_name) And the explain plan
SELECT STATEMENT, GOAL = CHOOSE Cost=19365 Cardinality=1 Bytes=731
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=MOODY_RATING Cost=1 Cardinality=1 Bytes=9
INDEX UNIQUE SCAN Object owner=MARS Object name=PK_MOODY_RATING Cost=0 Cardinality=1
HASH UNIQUE Cost=77 Cardinality=1 Bytes=488
COUNT STOPKEY
HASH JOIN Cost=76 Cardinality=1 Bytes=488
NESTED LOOPS Cost=68 Cardinality=1 Bytes=460
HASH JOIN Cost=66 Cardinality=1 Bytes=450
HASH JOIN Cost=59 Cardinality=1 Bytes=412
NESTED LOOPS Cost=51 Cardinality=1 Bytes=402
HASH JOIN Cost=49 Cardinality=1 Bytes=392
NESTED LOOPS Cost=42 Cardinality=1 Bytes=359
NESTED LOOPS Cost=40 Cardinality=1 Bytes=349
NESTED LOOPS Cost=37 Cardinality=1 Bytes=300
NESTED LOOPS Cost=34 Cardinality=1 Bytes=251
HASH JOIN Cost=32 Cardinality=1 Bytes=241
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=MARSNODE Cost=3 Cardinality=1 Bytes=27
NESTED LOOPS Cost=24 Cardinality=1 Bytes=231
NESTED LOOPS Cost=21 Cardinality=1 Bytes=204
NESTED LOOPS Cost=18 Cardinality=1 Bytes=171
NESTED LOOPS Cost=16 Cardinality=1 Bytes=136
NESTED LOOPS Cost=13 Cardinality=1 Bytes=86
NESTED LOOPS Cost=10 Cardinality=1 Bytes=37
VIEW Object owner=MARS Cost=7 Cardinality=1 Bytes=10
FILTER
CONNECT BY WITH FILTERING
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=MARSNODELINK
INDEX RANGE SCAN Object owner=MARS Object name=FKI_15632_PARENT_ID Cost=3 Cardinality=250 Bytes=2500
HASH JOIN Cost=5 Cardinality=1 Bytes=62
TABLE ACCESS FULL Object owner=MARS Object name=MARSHIERARCHY Cost=2 Cardinality=1 Bytes=27
TABLE ACCESS FULL Object owner=MARS Object name=MARSHIERARCHYROOT Cost=2 Cardinality=5 Bytes=175
NESTED LOOPS
CONNECT BY PUMP
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=MARSNODELINK Cost=7 Cardinality=1 Bytes=39
INDEX RANGE SCAN Object owner=MARS Object name=IDX_MNL_HI_PI_NI Cost=3 Cardinality=4
TABLE ACCESS FULL Object owner=MARS Object name=MARSHIERARCHY Cost=2 Cardinality=1 Bytes=27
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=MARSNODE Cost=3 Cardinality=1 Bytes=27
INDEX RANGE SCAN Object owner=MARS Object name=PK_MARSNODE Cost=2 Cardinality=1
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=MARSNODE Cost=3 Cardinality=1 Bytes=49
INDEX RANGE SCAN Object owner=MARS Object name=PK_MARSNODE Cost=2 Cardinality=1
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=MARSNODE Cost=3 Cardinality=1 Bytes=50
INDEX RANGE SCAN Object owner=MARS Object name=PK_MARSNODE Cost=2 Cardinality=1
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=MARSNODETYPE Cost=2 Cardinality=1 Bytes=35
INDEX RANGE SCAN Object owner=MARS Object name=PK_MARSNODETYPE Cost=1 Cardinality=1
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=NODE_ASSOC Cost=3 Cardinality=1 Bytes=33
INDEX RANGE SCAN Object owner=MARS Object name=PK_NODE_ASSOC Cost=1 Cardinality=3
INDEX RANGE SCAN Object owner=MARS Object name=PK_MARSNODE Cost=2 Cardinality=1
VIEW Object owner=MARS Cost=7 Cardinality=1 Bytes=10
FILTER
CONNECT BY WITH FILTERING
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=MARSNODELINK
INDEX RANGE SCAN Object owner=MARS Object name=FKI_15632_PARENT_ID Cost=3 Cardinality=250 Bytes=2500
HASH JOIN Cost=5 Cardinality=1 Bytes=62
TABLE ACCESS FULL Object owner=MARS Object name=MARSHIERARCHY Cost=2 Cardinality=1 Bytes=27
TABLE ACCESS FULL Object owner=MARS Object name=MARSHIERARCHYROOT Cost=2 Cardinality=5 Bytes=175
NESTED LOOPS
CONNECT BY PUMP
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=MARSNODELINK Cost=7 Cardinality=1 Bytes=39
INDEX RANGE SCAN Object owner=MARS Object name=IDX_MNL_HI_PI_NI Cost=3 Cardinality=4
TABLE ACCESS FULL Object owner=MARS Object name=MARSHIERARCHY Cost=2 Cardinality=1 Bytes=27
INDEX RANGE SCAN Object owner=MARS Object name=PK_MARSNODE Cost=2 Cardinality=1 Bytes=10
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=NODE_ASSOC Cost=3 Cardinality=1 Bytes=49
INDEX RANGE SCAN Object owner=MARS Object name=PK_NODE_ASSOC Cost=1 Cardinality=3
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=MARSNODE Cost=3 Cardinality=1 Bytes=49
INDEX RANGE SCAN Object owner=MARS Object name=PK_MARSNODE Cost=2 Cardinality=1
INDEX RANGE SCAN Object owner=MARS Object name=PK_MARSNODE Cost=2 Cardinality=1 Bytes=10
VIEW Object owner=MARS Cost=7 Cardinality=1 Bytes=33
FILTER
CONNECT BY WITH FILTERING
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=MARSNODELINK
INDEX RANGE SCAN Object owner=MARS Object name=FKI_15632_PARENT_ID Cost=3 Cardinality=250 Bytes=2500
HASH JOIN Cost=5 Cardinality=1 Bytes=62
TABLE ACCESS FULL Object owner=MARS Object name=MARSHIERARCHY Cost=2 Cardinality=1 Bytes=27
TABLE ACCESS FULL Object owner=MARS Object name=MARSHIERARCHYROOT Cost=2 Cardinality=5 Bytes=175
NESTED LOOPS
CONNECT BY PUMP
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=MARSNODELINK Cost=7 Cardinality=1 Bytes=39
INDEX RANGE SCAN Object owner=MARS Object name=IDX_MNL_HI_PI_NI Cost=3 Cardinality=4
TABLE ACCESS FULL Object owner=MARS Object name=MARSHIERARCHY Cost=2 Cardinality=1 Bytes=27
INDEX RANGE SCAN Object owner=MARS Object name=PK_MARSNODE Cost=2 Cardinality=1 Bytes=10
VIEW Object owner=MARS Cost=7 Cardinality=1 Bytes=10
FILTER
CONNECT BY WITH FILTERING
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=MARSNODELINK
INDEX RANGE SCAN Object owner=MARS Object name=FKI_15632_PARENT_ID Cost=3 Cardinality=250 Bytes=2500
HASH JOIN Cost=5 Cardinality=1 Bytes=62
TABLE ACCESS FULL Object owner=MARS Object name=MARSHIERARCHY Cost=2 Cardinality=1 Bytes=27
TABLE ACCESS FULL Object owner=MARS Object name=MARSHIERARCHYROOT Cost=2 Cardinality=5 Bytes=175
NESTED LOOPS
CONNECT BY PUMP
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=MARSNODELINK Cost=7 Cardinality=1 Bytes=39
INDEX RANGE SCAN Object owner=MARS Object name=IDX_MNL_HI_PI_NI Cost=3 Cardinality=4
TABLE ACCESS FULL Object owner=MARS Object name=MARSHIERARCHY Cost=2 Cardinality=1 Bytes=27
VIEW Object owner=MARS Cost=7 Cardinality=1 Bytes=38
FILTER
CONNECT BY WITH FILTERING
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=MARSNODELINK
INDEX RANGE SCAN Object owner=MARS Object name=FKI_15632_PARENT_ID Cost=3 Cardinality=250 Bytes=2500
HASH JOIN Cost=5 Cardinality=1 Bytes=62
TABLE ACCESS FULL Object owner=MARS Object name=MARSHIERARCHY Cost=2 Cardinality=1 Bytes=27
TABLE ACCESS FULL Object owner=MARS Object name=MARSHIERARCHYROOT Cost=2 Cardinality=5 Bytes=175
NESTED LOOPS
CONNECT BY PUMP
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=MARSNODELINK Cost=7 Cardinality=1 Bytes=57
INDEX RANGE SCAN Object owner=MARS Object name=IDX_MNL_HI_PI_NI Cost=3 Cardinality=4
TABLE ACCESS FULL Object owner=MARS Object name=MARSHIERARCHY Cost=2 Cardinality=1 Bytes=36
INDEX RANGE SCAN Object owner=MARS Object name=PK_MARSNODE Cost=2 Cardinality=1 Bytes=10
VIEW Object owner=MARS Cost=7 Cardinality=1 Bytes=28
FILTER
CONNECT BY WITH FILTERING
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=MARSNODELINK
INDEX RANGE SCAN Object owner=MARS Object name=FKI_15632_PARENT_ID Cost=3 Cardinality=250 Bytes=2500
HASH JOIN Cost=5 Cardinality=1 Bytes=62
TABLE ACCESS FULL Object owner=MARS Object name=MARSHIERARCHY Cost=2 Cardinality=1 Bytes=27
TABLE ACCESS FULL Object owner=MARS Object name=MARSHIERARCHYROOT Cost=2 Cardinality=5 Bytes=175
NESTED LOOPS
CONNECT BY PUMP
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=MARSNODELINK Cost=7 Cardinality=1 Bytes=57
INDEX RANGE SCAN Object owner=MARS Object name=IDX_MNL_HI_PI_NI Cost=3 Cardinality=4
TABLE ACCESS FULL Object owner=MARS Object name=MARSHIERARCHY Cost=2 Cardinality=1 Bytes=27
COUNT
VIEW Object owner=MARS Cost=19365 Cardinality=1 Bytes=731
HASH GROUP BY Cost=19365 Cardinality=1 Bytes=1112
NESTED LOOPS OUTER Cost=19364 Cardinality=1 Bytes=1112
NESTED LOOPS OUTER Cost=19361 Cardinality=1 Bytes=1040
NESTED LOOPS OUTER Cost=19361 Cardinality=1 Bytes=1037
NESTED LOOPS OUTER Cost=19360 Cardinality=1 Bytes=1019
NESTED LOOPS OUTER Cost=19357 Cardinality=1 Bytes=951
NESTED LOOPS OUTER Cost=19354 Cardinality=1 Bytes=914
NESTED LOOPS OUTER Cost=19351 Cardinality=1 Bytes=877
NESTED LOOPS OUTER Cost=19337 Cardinality=1 Bytes=820
NESTED LOOPS OUTER Cost=19334 Cardinality=1 Bytes=783
NESTED LOOPS OUTER Cost=19320 Cardinality=1 Bytes=726
NESTED LOOPS OUTER Cost=19317 Cardinality=1 Bytes=707
NESTED LOOPS OUTER Cost=19303 Cardinality=1 Bytes=650
NESTED LOOPS OUTER Cost=19300 Cardinality=1 Bytes=613
NESTED LOOPS Cost=19285 Cardinality=1 Bytes=556
NESTED LOOPS Cost=19280 Cardinality=1 Bytes=443
NESTED LOOPS OUTER Cost=19275 Cardinality=1 Bytes=330
HASH JOIN RIGHT SEMI Cost=17457 Cardinality=1 Bytes=248
VIEW Object owner=SYS Object name=VW_NSO_1 Cost=1119 Cardinality=30 Bytes=150
HASH JOIN Cost=1119 Cardinality=30 Bytes=2040
TABLE ACCESS FULL Object owner=MARS Object name=FEED_GROUP Cost=2 Cardinality=5 Bytes=120
HASH JOIN Cost=1116 Cardinality=1607 Bytes=70708
TABLE ACCESS FULL Object owner=MARS Object name=FEED_GROUP_XREF Cost=13 Cardinality=701 Bytes=14721
HASH JOIN Cost=1102 Cardinality=3602 Bytes=82846
INDEX RANGE SCAN Object owner=MARS Object name=IDX_FBS_CD_FII_BI Cost=22 Cardinality=3602 Bytes=46826
TABLE ACCESS FULL Object owner=MARS Object name=FEED_INSTANCE Cost=1024 Cardinality=670264 Bytes=6702640
NESTED LOOPS Cost=16337 Cardinality=324 Bytes=78732
HASH JOIN Cost=14324 Cardinality=1977 Bytes=302481
NESTED LOOPS OUTER Cost=11 Cardinality=1 Bytes=114
NESTED LOOPS Cost=8 Cardinality=1 Bytes=95
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=MARSNODE Cost=5 Cardinality=1 Bytes=59
INDEX RANGE SCAN Object owner=MARS Object name=IDX_NODE1 Cost=3 Cardinality=2
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=BOOK Cost=3 Cardinality=2 Bytes=72
INDEX RANGE SCAN Object owner=MARS Object name=IDX_BOOK_LEI_BCD Cost=2 Cardinality=4
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=MARSNODE Cost=3 Cardinality=1 Bytes=19
INDEX RANGE SCAN Object owner=MARS Object name=PK_MARSNODE Cost=2 Cardinality=1
PARTITION RANGE ALL Cost=13995 Cardinality=3854299 Bytes=150317661
TABLE ACCESS FULL Object owner=MARS Object name=POSITION Cost=13995 Cardinality=3854299 Bytes=150317661
PARTITION RANGE ITERATOR Cost=2 Cardinality=1 Bytes=90
PARTITION HASH ITERATOR Cost=2 Cardinality=1 Bytes=90
TABLE ACCESS BY LOCAL INDEX ROWID Object owner=MARS Object name=STAGING_POSITION Cost=2 Cardinality=1 Bytes=90
INDEX UNIQUE SCAN Object owner=MARS Object name=PK_STAGINGPOSITON Cost=1 Cardinality=1
PARTITION HASH ITERATOR Cost=1819 Cardinality=1 Bytes=82
TABLE ACCESS BY LOCAL INDEX ROWID Object owner=MARS Object name=STAGING_INSTRUMENT Cost=1819 Cardinality=1 Bytes=82
INDEX RANGE SCAN Object owner=MARS Object name=PK_STAGINGINSTRUMENT Cost=9 Cardinality=2551
PARTITION RANGE ITERATOR Cost=5 Cardinality=1 Bytes=113
PARTITION HASH ITERATOR Cost=5 Cardinality=1 Bytes=113
TABLE ACCESS BY LOCAL INDEX ROWID Object owner=MARS Object name=STAGING_SENSITIVITY Cost=5 Cardinality=1 Bytes=113
INDEX RANGE SCAN Object owner=MARS Object name=IDX_SENSITIVITY_FEED_ROW_ID Cost=3 Cardinality=8
PARTITION RANGE ITERATOR Cost=5 Cardinality=1 Bytes=113
PARTITION HASH ITERATOR Cost=5 Cardinality=1 Bytes=113
TABLE ACCESS BY LOCAL INDEX ROWID Object owner=MARS Object name=STAGING_SENSITIVITY Cost=5 Cardinality=1 Bytes=113
INDEX RANGE SCAN Object owner=MARS Object name=IDX_SENSITIVITY_FEED_ROW_ID Cost=3 Cardinality=8
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=MARSNODELINK Cost=14 Cardinality=1 Bytes=57
INDEX RANGE SCAN Object owner=MARS Object name=FKI_15632_NODE_ID Cost=2 Cardinality=14
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=MARSNODE Cost=3 Cardinality=1 Bytes=37
INDEX RANGE SCAN Object owner=MARS Object name=PK_MARSNODE Cost=2 Cardinality=1
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=MARSNODELINK Cost=14 Cardinality=1 Bytes=57
INDEX RANGE SCAN Object owner=MARS Object name=FKI_15632_NODE_ID Cost=2 Cardinality=14
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=MARSNODE Cost=3 Cardinality=1 Bytes=19
INDEX RANGE SCAN Object owner=MARS Object name=PK_MARSNODE Cost=2 Cardinality=1
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=MARSNODELINK Cost=14 Cardinality=1 Bytes=57
INDEX RANGE SCAN Object owner=MARS Object name=FKI_15632_NODE_ID Cost=2 Cardinality=14
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=MARSNODE Cost=3 Cardinality=1 Bytes=37
INDEX RANGE SCAN Object owner=MARS Object name=PK_MARSNODE Cost=2 Cardinality=1
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=MARSNODELINK Cost=14 Cardinality=1 Bytes=57
INDEX RANGE SCAN Object owner=MARS Object name=FKI_15632_NODE_ID Cost=2 Cardinality=14
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=MARSNODE Cost=3 Cardinality=1 Bytes=37
INDEX RANGE SCAN Object owner=MARS Object name=PK_MARSNODE Cost=2 Cardinality=1
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=MARSNODE Cost=3 Cardinality=1 Bytes=37
INDEX RANGE SCAN Object owner=MARS Object name=PK_MARSNODE Cost=2 Cardinality=1
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=XREF_DOMAIN_VALUE_MAP Cost=3 Cardinality=1 Bytes=68
INDEX RANGE SCAN Object owner=MARS Object name=IDX_XDVM_DMI_SV_BCD Cost=2 Cardinality=1
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=ISSUE Cost=1 Cardinality=1 Bytes=18
INDEX UNIQUE SCAN Object owner=MARS Object name=PK_ISSUE Cost=0 Cardinality=1
INDEX UNIQUE SCAN Object owner=MARS Object name=PK_MOODY_RATING Cost=0 Cardinality=1 Bytes=3
TABLE ACCESS BY INDEX ROWID Object owner=MARS Object name=PARTICIPANT Cost=3 Cardinality=1 Bytes=72
INDEX RANGE SCAN Object owner=MARS Object name=PK_PARTICIPANT Cost=2 Cardinality=1Hi,
in your explain plan:
HASH JOIN RIGHT SEMI Cost=17457 Cardinality=1 Bytes=248
VIEW Object owner=SYS Object name=VW_NSO_1 Cost=1119 Cardinality=30 Bytes=150
HASH JOIN Cost=1119 Cardinality=30 Bytes=2040
TABLE ACCESS FULL Object owner=MARS Object name=FEED_GROUP Cost=2 Cardinality=5 Bytes=120
HASH JOIN Cost=1116 Cardinality=1607 Bytes=70708
TABLE ACCESS FULL Object owner=MARS Object name=FEED_GROUP_XREF Cost=13 Cardinality=701 Bytes=14721
HASH JOIN Cost=1102 Cardinality=3602 Bytes=82846
INDEX RANGE SCAN Object owner=MARS Object name=IDX_FBS_CD_FII_BI Cost=22 Cardinality=3602 Bytes=46826
TABLE ACCESS FULL Object owner=MARS Object name=FEED_INSTANCEThis part has the highest costs (this doesn't always mean it is slow). So this leads me to the WHERE clause where feed_group, feed_group_xref and feed_instance full are used. Maybe this can be improved, although the cardinality is not that high, so a full table can be the best. So the question is can indexes help here?
Furthermore there is the full table scan on POSITION:
TABLE ACCESS FULL Object owner=MARS Object name=POSITION Cost=13995 Cardinality=3854299 Bytes=150317661This looks also a large tabel (3 million + records), so is it possible to get this part smaller?
Herald ten Dam
http://htendam.wordpress.com -
While running the query how much time it will taken, I want to see the time
Hi Folks
I would like to know ... While running the query how much time it will be taken, I want to see the time? in WEBI XI R2.....
Plz let me know the answer.......Hi Ravi,
The time a report runs is estimated based on the last time it was run. So you need to run the report once before you can see how long it will take. Also it depends on several factors... the database server could cache some queries so running it a second time immediately after the first time could be quicker. And there is the chance of changing filters to bring back different sets of data.
You could also schedule a report and then check the scheduled instance's status properties and view how long a report actually ran.
Good luck -
Select query running long time
Hi,
DB version : 10g
platform : sunos
My select sql query running long time (more than 20hrs) .Still running .
Is there any way to find sql query completion time approximately. (Pending time)
Also is there any possibilities to increase the speed of sql query (already running) like adding hints.
Please help me on this .
ThanksHi Sathish thanks for your reply,
I have already checked in V$SESSION_LONGOPS .But it's showing TIME_REMAINING -->0
select TOTALWORK,SOFAR,START_TIME,TIME_REMAINING from V$SESSION_LONGOPS where SID='10'
TOTALWORK SOFAR START_TIME TIME_REMAINING
1099759 1099759 27-JAN-11 0Any idea ?
Thanks. -
I am trying to run a formatted search to display a simple estimated delivery time for each line item in my sales order. My query is as follows:
SELECT (CASE
WHEN (T0.OnHand - T0.IsCommitted) > 0
THEN (DocDate + T0.LeadTime)
WHEN (T0.OnHand - T0.IsCommitted) <= 0
THEN (DocDate + 5 + T0.LeadTime)
END)
FROM OITM
WHERE T0.ItemCode = $[$38.1.0.0]
This query errors out, any ideas?Actually, I think we get 1 row with a NULL value. My bet is that we have NULL in T0.LeadTime.
Try this:
SELECT (CASE
WHEN (T0.OnHand - T0.IsCommited) > 0
THEN dateadd(Day, COALESCE(T0.LeadTime,0), GetDate())
WHEN (T0.OnHand - T0.IsCommited) <= 0
THEN dateadd(Day, (5 + COALESCE(T0.LeadTime,0)), GetDate())
END)
FROM OITM T0
WHERE T0.ItemCode = $[$38.1.0.0]
If you want to read more about nulls then check this:
http://www.sqlservercentral.com/columnists/mcoles/fourrulesfornulls.asp
HTH
Juha -
STILL Estimating Indexing Time: Spotlight
Hi,
Spotlight is STILL "estimating indexing time". It's been doing this for weeks!
I have 175gb worth of sound effects (which live on an external hard drive) where I'd like to search for files via the Finder or Spotlight. However this "indexing" process is literally taking forever. As it is currently, the Finder or Spotlight is not locating / finder files that are clearly on the drive.
How can I speed up the indexing process or enable to locating of the files on the external drive?
Thanks.I do not think it is true that TM requires Spotlight indexing of the TM (or any other) drive to work. (why should it? everything it needs to know is in the usual disk catalogues, it does not need to see/search the file contents). So you can put the TM drive on the private list in System Prefs/Spotlight and this should stop Spotlight pointlessly indexing the backup drive (which will still have the usual disk catalogues so you can examine it in the Finder or with TM).
Having said this there is a genuine problem here. My machine works fine with Spotlight and TM and even though it has not been manually excluded Spotlight does not, I believe, index the TM drive anyway, at all events it does not find all the backup near-duplicates of things on the TM drive. I think there is somewhere an invisible setting that ensures this. But on my wife's machine running the same system there was/is endless disk activity whilst Spotlight tries (apparently fruitlessly - the process seems to take forever without completing) to index the TM drive. I have tried excluding the TM drive as above but it still seem to try! One can manually kill the process using Activity Monitor but this may stop all indexing.
What I really want is direct control of the indexing process (clear include/exclude by drive, say) rather than having it hidden away somewhere - maybe Apple will provide this! I wonder whether indexing a TM drive presents problems because of all the similarly-named backup file copies.... -
Getting estimated execution time via JDBC
Hi,
I have a web application that's meant to query by multiple search criteria, so queries can quickly become too complex. I know that using Resource Manager it is possible to prevent certain queries from running, based on estimated execution time.
Is there any way to query these time estimates, making them available to the calling application? (before going ahead with execution)
Thanks
IvanI am not sure if this is possible in JDBC, the best thing you can do is, get an average execution time for query and use in your application OR do a start time and end time while you are executing the scripts and get the difference.
-
I have replaced my old hard drive on a MacBook Pro midyear 2010 with a new SSD drive. I have a complete system backup of my old drive in an external hard drive using Time Machine.
Questions that I would like to get answered.
1) Can I connect my external hard drive to the macbook pro and use that to boot up my machine by pressing and holding down the Options key? Once booted up successfully, can I use Disk Utility to format the new SSD and then restore the complete time machine backup?
2) If that is not possible, can I use my old drive which I can connect using a USB adapter and use that to boot up by following the same strategy as listed in Step#1 above?
3) If neither options are possible, do I need to use a bootable USB drive for Mavericks OS X to boot up the machine,
I have Mavericks OS X ( 10.9.6) and I do not have a DVD of the OS.
Any help is appreciated.Let me first document the steps that did not work and then I will document the steps that worked.
1) Replaced the hard drive with SSD.
2) Connected the original hard drive using a USB adapter to the MacBook to make it behave like an external device.
3) Powered on the machine and on hearing the chime pressed Command-R to start in recovery mode.
4) Chose the Disk Utility option to erase and format the SSD. The format chosen was Mac OS Extended Journaled.
5) Once the formatting was done, then clicked on the "Restore" tab in Disk Utility
6) In the Source field, dragged my original hard drive from the left pane and placed it in the field
7) On the destination field, choose the new SSD drive. Clicked on "Restore". Gave me a warning, accepted the warning and the restore was under way.
8) I had 236 GB to restore so took 3.5 hours before it was done.
9) Disconnected the external hard drive ( my original internal HDD), shut down the machine and powered on again.
10) Heard the chime and after that it was a white screen with no Apple logo.
Was visibly upset and started thinking what my next move will be. Then tried these steps
1) Again powered off the machine.
2) Connected my internal HDD once more as an external drive
3) Powered on and on hearing the chime, pressed Command-R as before
4) Once the OS X utilities screen popped up, this time chose Install OS X
5) Erased the contents of SSD once more and reformatted it using Mac OS Extended Journaled.
6) Installed OS X by following the prompts.
7) Once the OS was installed, I was presented with an option on how to transfer data to this new Mac
8) Chose the option to move the data from my original HDD.
9) Took another 3 hours to move the data.
10) Removed the original HDD once the transfer was complete, powered down the machine and started it once more.
11) Booted successfully and all my content is now accessible on the new SSD.
Moral of the story - It is the spirit that counts. -
Estimated Start time in notification based on Time defined in Work center
Hi,
Following Satish post- I am trying to find solution to the same problem so i will appreciate any advise.
When the notification is created ,the estimated start time should be based on priority .This in iteslf is pretty straight & simple. However if the reported time is after work hours or towards the end of work hours or weekends , the estimated start time should be reflected accordingly based on factory calender & work center time schedule.
In other words the estimated start time should fall within the window of work hours available.
Example:
Presume the the working hours for the Organization are 8:00AM to 5:00 PM & a call comes for service at 4:00 PM. Also say , for high priority the defined response time is 5 hours. In such a instance the estimated start date should be set to next day at 11:00 AM.
Appreciate your help for the configuration that need to be done
ShirlyHi,
I think ur talking about notification malfunction start time .. currently it just takes the system date and time by default .. and if you need work center timings i believe first u need the eqpt /F.loc to get the work center data in notificaiton ...
I think u can get these dates can be modified while saving by using user exit : QQMA0014 QM/PM/SM: Checks before saving a notification or BADI IF_EX_NOTIF_EVENT_SAVE , but at the same time the eqpt or F.loc have work center details in master record ...or work center needs to be entered manually in notification ..., pls check up ..
regrds
pushpa -
Stopping a Query taking more time to execute in runtime in Oracle Forms.
Hi,
In the present application one of the oracle form screen is taking long time to execute a query, user wanted an option to stop the query in between and browse the result (whatever has been fetched before stopping the query).
We have tried three approach.
1. set max fetch record in form and block level.
2. set max fetch time in form and block level.
in above two method does not provide the appropiate solution for us.
3. the third approach we applied is setting the interaction mode to "NON BLOCKING" at the form level.
It seems to be worked, while the query took long time to execute, oracle app server prompts an message to press Esc to cancel the query and it a displaying the results fetched upto that point.
But the drawback is one pressing esc, its killing the session itself. which is causing the entire application to collapse.
Please suggest if there is any alternative approach for this or how to overcome this perticular scenario.
This kind of facility is alreday present in TOAD and PL/SQL developer where we can stop an executing query and browse the results fetched upto that point, is the similar facility is avialable in oracle forms ,please suggest.
Thanks and Regards,
Suraj
Edited by: user10673131 on Jun 25, 2009 4:55 AMHello Friend,
You query will definitely take more time or even fail in PROD,becuase the way it is written. Here are my few observations, may be it can help :-
1. XLA_AR_INV_AEL_SL_V XLA_AEL_SL_V : Never use a view inside such a long query , becuase View is just a window to the records.
and when used to join other table records, then all those tables which are used to create a view also becomes part of joining conition.
First of all please check if you really need this view. I guess you are using to check if the records have been created as Journal entries or not ?
Please check the possbility of finding it through other AR tables.
2. Remove _ALL tables instead use the corresponding org specific views (if you are in 11i ) or the sysnonymns ( in R12 )
For example : For ra_cust_trx_types_all use ra_cust_trx_types.
This will ensure that the query will execute only for those ORG_IDs which are assigned to that responsibility.
3. Check with the DBA whether the GATHER SCHEMA STATS have been run atleast for ONT and RA tables.
You can also check the same using
SELECT LAST_ANALYZED FROM ALL_TABLES WHERE TABLE_NAME = 'ra_customer_trx_all'.
If the tables are not analyzed , the CBO will not be able to tune your query.
4. Try to remove the DISTINCT keyword. This is the MAJOR reason for this problem.
5. If its a report , try to separate the logic in separate queries ( using a procedure ) and then populate the whole data in custom table, and use this custom table for generating the
report.
Thanks,
Neeraj Shrivastava
[email protected]
Edited by: user9352949 on Oct 1, 2010 8:02 PM
Edited by: user9352949 on Oct 1, 2010 8:03 PM -
Why update query takes long time ?
Hello everyone;
My update query takes long time. In emp ( self testing) just having 2 records.
when i issue update query , it takes long time;
SQL> select * from emp;
EID ENAME EQUAL ESALARY ECITY EPERK ECONTACT_NO
2 rose mca 22000 calacutta 9999999999
1 sona msc 17280 pune 9999999999
Elapsed: 00:00:00.05
SQL> update emp set esalary=12000 where eid='1';
update emp set esalary=12000 where eid='1'
* ERROR at line 1:
ORA-01013: user requested cancel of current operation
Elapsed: 00:01:11.72
SQL> update emp set esalary=15000;
update emp set esalary=15000
* ERROR at line 1:
ORA-01013: user requested cancel of current operation
Elapsed: 00:02:22.27Hi BCV;
Thanks for your reply but it doesn't provide output, please see this.
SQL> update emp set esalary=15000;
........... Lock already occured.
>> trying to trace >>
SQL> select HOLDING_SESSION from dba_blockers;
HOLDING_SESSION
144
SQL> select sid , username, event from v$session where username='HR';
SID USERNAME EVENT
144 HR SQL*Net message from client
151 HR enq: TX - row lock contention
159 HR SQL*Net message from client
>> It does n 't provide clear output about transaction lock >>
SQL> SELECT username, v$lock.SID, TRUNC (id1 / POWER (2, 16)) rbs,
2 BITAND (id1, TO_NUMBER ('ffff', 'xxxx')) + 0 slot, id2 seq, lmode,
3 request
4 FROM v$lock, v$session
5 WHERE v$lock.TYPE = 'TX'
6 AND v$lock.SID = v$session.SID
7 AND v$session.username = USER;
no rows selected
SQL> select MACHINE from v$session where sid = :sid;
SP2-0552: Bind variable "SID" not declared. -
Hi All,
I have cloned KSB1 tcode to custom one as required by business.
Below query takes more time than excepted.
Here V_DB_TABLE = COVP.
Values in Where clause are as follows
OBNJR in ( KSBB010000001224 BT KSBB012157221571)
GJAHR in blank
VERSN in '000'
WRTTP in '04' and '11'
all others are blank
VT_VAR_COND = ( CPUDT BETWEEN '20091201' and '20091208' )
SELECT (VT_FIELDS) INTO CORRESPONDING FIELDS OF GS_COVP_EXT
FROM (V_DB_TABLE)
WHERE LEDNR = '00'
AND OBJNR IN LR_OBJNR
AND GJAHR IN GR_GJAHR
AND VERSN IN GR_VERSN
AND WRTTP IN GR_WRTTP
AND KSTAR IN LR_KSTAR
AND PERIO IN GR_PERIO
AND BUDAT IN GR_BUDAT
AND PAROB IN GR_PAROB
AND (VT_VAR_COND).
Checked in table for this condition it has only 92 entries.
But when i execute program takes long time as 3 Hrs.
Could any one help me on this>1.Dont use SELECT/ENDSELECT instead use INTO TABLE addition .
> 2.Avoid using corresponding addition.create a type and reference it.
> If the select is going for dump beacause of storage limitations ,then use Cursors.
you got three large NOs .... all three recommendations are wrong!
The SE16 test is going in the right direction ... but what was filled. Nobody knows!!!!
Select options:
Did you ever try to trace the SE16? The generic statement has for every field an in-condition!
Without the information what was actually filled, nobody can say something there
are at least 2**n combinations possible!
Use ST05 for SE16 and check actual statement plus explain!
Maybe you are looking for
-
I would like to inquire about the schedule that is synchronized to iCal in CalDav protocol from our system. Schedule that is synchronized could be edited from the iPad or iPhone terminal, but I can no longer edit from iOS5.1. We did not fix anythin
-
How to use standard browser instead of opera in 51...
Hi, In my nokia 5130 mobile. it has opera mini application as a defaut browser. But I want to use the standard nokia default browser. if i press 0 key then it opens the standart nokia provided browser and displaying the home page. but there i cant
-
what do if itunes say it that my ipod touch 4g 5.1 firmware corrupt when I try to restore it
-
Hi Gurus, We have maintained various versions in SPRO under production-basic data-work center-capacity planning-active version of available capacity. For a particular main work center we enter the active version in capacity header tab in the work cen
-
I've been trying to update my iphone 4 from 4.1 to 4.2. Everytime itunes finishes downloading and starts to process this message comes up: "There was a problem downloading the software for the iphone. The network connection timed out.". I've tried do