How to know query execution time in sql plus
HI
I want to know the query execution time in sql plus along with statistics
I say set time on ;
set autotrace on ;
select * from view where usr_id='abcd';
if the result is 300 rows it scrolls till all the rows are retrieved and finally gives me execution time as 40 seconds or 1 minute.. (this is after all the records are scrolled )
but when i execute it in toad it gives 350 milli seconds..
i want to see the execution time in sql how to do this
database server 11g and client is 10g
regards
raj
what is the difference between .. the
statistics gathered in sql plus something like this and the one that i get from plan_table in toad?
how to format the execution plan I got in sqlplus in a proper understanding way?
statistics in sqlplus
tatistics
0 recursive calls
0 db block gets
164 consistent gets
0 physical reads
0 redo size
29805 bytes sent via SQL*Net to client
838 bytes received via SQL*Net from client
25 SQL*Net roundtrips to/from client
1 sorts (memory)
0 sorts (disk)
352 rows processedexecution plan in sqlplus... how to format this
xecution Plan
0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=21 Card=1 Bytes=10
03)
1 0 HASH (UNIQUE) (Cost=21 Card=1 Bytes=1003)
2 1 MERGE JOIN (CARTESIAN) (Cost=20 Card=1 Bytes=1003)
3 2 NESTED LOOPS
4 3 NESTED LOOPS (Cost=18 Card=1 Bytes=976)
5 4 NESTED LOOPS (Cost=17 Card=1 Bytes=797)
6 5 NESTED LOOPS (OUTER) (Cost=16 Card=1 Bytes=685)
7 6 NESTED LOOPS (OUTER) (Cost=15 Card=1 Bytes=556
8 7 NESTED LOOPS (Cost=14 Card=1 Bytes=427)
9 8 NESTED LOOPS (Cost=5 Card=1 Bytes=284)
10 9 TABLE ACCESS (BY INDEX ROWID) OF 'USR_XR
EF' (TABLE) (Cost=4 Card=1 Bytes=67)
11 10 INDEX (RANGE SCAN) OF 'USR_XREF_PK' (I
NDEX (UNIQUE)) (Cost=2 Card=1)
12 9 TABLE ACCESS (BY INDEX ROWID) OF 'USR_DI
M' (TABLE) (Cost=1 Card=1 Bytes=217)
13 12 INDEX (UNIQUE SCAN) OF 'USR_DIM_PK' (I
NDEX (UNIQUE)) (Cost=0 Card=1)
14 8 TABLE ACCESS (BY INDEX ROWID) OF 'HDS_FCT'
(TABLE) (Cost=9 Card=1 Bytes=143)
15 14 INDEX (RANGE SCAN) OF 'HDS_FCT_IX2' (IND
EX) (Cost=1 Card=338)
16 7 TABLE ACCESS (BY INDEX ROWID) OF 'USR_MEDIA_
COMM' (TABLE) (Cost=1 Card=1 Bytes=129)
17 16 INDEX (UNIQUE SCAN) OF 'USR_MEDIA_COMM_PK'
(INDEX (UNIQUE)) (Cost=0 Card=1)
18 6 TABLE ACCESS (BY INDEX ROWID) OF 'USR_MEDIA_CO
MM' (TABLE) (Cost=1 Card=1 Bytes=129)
19 18 INDEX (UNIQUE SCAN) OF 'USR_MEDIA_COMM_PK' (
INDEX (UNIQUE)) (Cost=0 Card=1)
20 5 TABLE ACCESS (BY INDEX ROWID) OF 'PROD_DIM' (TAB
LE) (Cost=1 Card=1 Bytes=112)
21 20 INDEX (UNIQUE SCAN) OF 'PROD_DIM_PK' (INDEX (U
NIQUE)) (Cost=0 Card=1)
22 4 INDEX (UNIQUE SCAN) OF 'CUST_DIM_PK' (INDEX (UNIQU
E)) (Cost=0 Card=1)
23 3 TABLE ACCESS (BY INDEX ROWID) OF 'CUST_DIM' (TABLE)
(Cost=1 Card=1 Bytes=179)
24 2 BUFFER (SORT) (Cost=19 Card=22 Bytes=594)
25 24 INDEX (FAST FULL SCAN) OF 'PROD_DIM_AK1' (INDEX (UNI
QUE)) (Cost=2 Card=22 Bytes=594)
Similar Messages
-
How to get query execution time without running...?
Hi ,
I had one requirement .... as follows ......
i had 3 sql statements . I need to execute only one sql which execution time is very less.
Can any one help me , how to get query execution time without running that query and without using explain plan..?
Thanks,
RajeshKim Berg Hansen wrote:
But you have ruled out explain plan for some reason, so I cannot help you.OP might get some answers if query was executed before - but since restart. Check V$SQL dynamic performance view for SQL_TEXT = your query. Then ROUND(ELAPSED_TIME / EXECUTIONS / 1000000) will give you average elapsed time.
SY.
Edited by: Solomon Yakobson on Apr 3, 2012 8:44 AM -
How to know the execution time of rule in Calculation Manager
Hi All,
How do we come to know the time of execution of rule in calculation manager ?
Regards
VikramAt this point there is no way to know the execution time of a rule in calculation Manager . If you are working on Planning rules, I believe planning displays the execution time in its job console.
-SR -
How to know the query execution time
Hi All,
I want to know the execution time taken for a particular query, How should i get that information ?
say for example,
select * from emp
after getting the result, i want to know the time taken for completing the execution.
How ?
Inputs are welcome !BTW it was already written in a response to you yestreday:
Re: Query Plan
Gints Plivna
http://www.gplivna.eu -
How to know exact query execution time.
Hi,
I want to know what is exact query execution time which excludes network access, constructing results. Please suggest me.
Thanks in advance,
Satish.GNot sure I know what you really want, but if this is a testing phase sort of thing and you are running on unix, there is the time command.
If you want something that is part of your application, you can run a timer in a separate Thread - for approximate time.
If you want more precise time, you can use java.util.Date - it has a method getTime(), which you can use before processing and again after processing and subtract the former from the later. -
How to get the execution time of a query
Hi,
Environment: 10.2.0.4.0
Just wondering how I can get the query execution time? I am not interested in the query output nor do I want the statistics, just the execution time?
Any suggestions will be appreciated
Thanks in advance
rogers42If you're using SQL*Plus
SQL> set autotrace traceonly
SQL> set timing on
SQL> <<your query here>>SQL*Plus will fetch all the data and then report the query plan, execution statistics, and elapsed time. It will not display the actual data.
SET TIMING ON alone tells SQL*Plus to display the execution time of each SQL statement-- the problem is that it also displays all the data which can skew the results because you're including the time required by SQL*Plus to pipe a bunch of data to the screen.
Justin -
How to reduce the query execution time
hai all,
We have created query on Purchasing Cube 0PUR_C01 for
Purchase Order (PO) analysis for single vendor materials, but it is taking long time to execute (about 45 sec...).
In the above Query we have used the following things:
In Columns:
i) Exceptional aggregation for maximum & minimum PO Net Price using reference characteristic as Calendar Day.
ii) Minimum PO Price value we have multiplied with Actual GR Quantity for the calculation of Impact of Lowest PO Net Price.
iii) Number of vendors calculated key figure.
In Rows:i) Only Material
In Filters:
i) Plant with variable select Option u2013 Optional.
ii) Calendar Year / Month with Select Option u2013 Optional.
iii) Material with excluded Unassigned (#).
iv) Vendor with excluded Unassigned (#).
Following are we have used for Performance:
i) Aggregates using Propose from query (only for this query).
ii) Partitioning on Calendar Year / Month (For 1 year 14 partitions) i.e. (04.2007 to 03.2008).
iii) Collapse.
iv) In RSRT we have set the following properties
Read Mode = H
Req.Status = 0
Catch Mode = 4
Persistence Mode = 3 (BLOB)
Optimization mode = 0.
Our inputs to this Query:
i) We are passing plant range 1201 to 1299.
ii) Calendar Year / Month 04.2007 to 03.2008.
So please suggest me how to reduce the execution time.
please help me.
Thanks,
kiran manyamHi,
First of all its a complete question with all the details. Good work.
As you partitioned the cube based on calmonth and you are also giving calmonth in selection, it will definitely work towards improved query performance.
As you are putting plant values in the selection, is there any aggregate available on plant characteristics? If not creating a aggregate on plant will help.
Regards,
Yogesh -
Clustering of SQL query execution times
In doing some query execution experiments I have noted a curious (to me, anyhow) clustering of execution times around two distinct points. Across about 100 tests each running 1000 queries using (pseudo-)randomly generated IDs the following pattern emerges. The queries were run from Java using all combinations of pooled/non-pooled and thin/oci driver combinations:
100 *
90 *
R 80 *
u 70 *
n 60 *
s 50 *
40 * *
30 * *
20 * * * *
10 * * * * * *
0 100 200 300 400 500 600 700 800 900 1000 1100 1200
Time(ms)Where about half of the total execution times cluster strongly about a given (short) time value with a smaller but broader clustering at a significantly slower mark, with zero intermediate values. The last point is the one I find most curious.
What I would have expected is something like this:
100
90
R 80
u 70
n 60
s 50
40 *
30 * * *
20 * * * * * *
10 * * * * * * * * * *
0 100 200 300 400 500 600 700 800 900 1000 1100 1200
Time(ms)The variables I have tentatively discounted thus far:
-query differences (single query used)
-connection differences (using single pooled connection)
-garbage collection (collection spikes independent of query execution times)
-amount of data returned in bytes (single varchar2 returned and size is independent of execution time)
-driver differences (thin and oci compared, overall times differ but pattern of clustering remains)
-differences between Statement and PreparedStatement usage (both show same pattern)
I know this is a rather open-ended question, but does the described pattern seem faniliar or spark any thoughts?
DB-side file I/O?
Thread time-slicing variations (client or DB-side)?
FWIW, the DB is 9.2.0.3 DB and the clients are running on WinXP with Java 5.0 and 9i drivers.
Thanks and regards,
MFurther context:
Are your queries only SELECT queries ?
Yes, the same SELECT query is used for all tests. The only variable is the bind variable used to identify the primary key of the selection set (i.e. SELECT a.* from a, b, c where a.x = b.x and b.y = c.y and c.pk = ?) where all PKs and FKs are indexed.Do the queries always use the same tables, the same where clauses ?
Yes, the same tables are always invoked. The where clauses invoked are identical with the excepton of the single bind variable as described above.Do your queries always use bind variables ?
A single bind variable is used in all invocations as described above.Are your queries also running in single user mode or multi user mode (do you use SELECT FOR UPDATE ?) ?
We are not using SELECT FOR UPDATEDid something else run on the database/on the server hosting the database on the same time ?
I have not eliminated the idea, but the test has been repeated roughly 100 times over the course of a week and at different times of day with the same pattern emerging. I suppose it is not out of the question that a resource-hogging process is running consistently and constantly on the DB-side box.Thanks for the input,
M -
How can I reduce BEx Query execution time
Hi,
I have a question regarding query execution time in BEx.
I have a query that takes 45 mins to 1 hour to execute in BEx analyser. This query is run on a daily basis and hence I am keen to reduce the execution time. Are there any programs or function modules that can help in reducing query execution time?
Thanks and Regards!Hi Sriprakash,
1.Check if your cube is performance tuned: in the manage cube from RSA1 / performance tab: check if all indexes and statistics are green. Aggregate IDx should as well be.
2.Condense your cubes regularly
3. Evaluate the creation of an aggregate with all characteristic used in the query (RSDDV).
4.Evaluate the creation of a "change run aggregate": based on a standalone NavAttr (without its basic char in the aggr.) but pay attention to the consequent change run when loading master data.
5. Partition (physically) your cubes systematically when possible (RSDCUBE, menu, partitioning)
6. Consider logical partitioning (by year or comp_code or ...) and make use of multiproviders in order to keep targets not too big...
7.Consider creating secondary indexes when reporting on ODS (RSDODS)
8.Check if the query runtime is due the master data read or the infoprovider itself, or the OLAP processor and/or any other cause in tx ST03N
9.Consider improving your master reads by creating customized IDX (BITMAP if possible and depending on your data) on master data table and/or attribute SIDs when using NAvs.
10.Check that your basis team did a good job and have applied the proper DB parameters
11.Last but not least: fine tune your datamodel precisely.
hope this will give you an idea.
Cheers
Sunil -
Oracle View that stores the Query execution time
Hi Gurus
i m using Oracle 10G in Unix. I wudiold like to know which Data dictionary view stores the execution of a query. If it is not stored then hw to find the query execution time other than (Set timing on) command. What is the use of elapsed time and what is the difference between execution time and elapsed time? How to calculate the execution time of a query.
THanks
RamIf you have a specific query you're going to run in SQL*Plus, just do
a 'set timing on' before you execute the query.
If you've got application SQL coming in from all over the place, you can
identify specific SQL in V$SQL/ and look at ELAPSED_TIME/EXECUTIONS
to get an average elapsed time.
If you've got an application running SQL, and you need to know the
specific timing of a specific execution (as opposed to an average),
you can use DBMS_SUPPORT to set trace in the session that your
application is running in, and then use TkProf to process the resulting
trace file. -
Hi,
I have a query which fetches around 100 records from a table which has approximately 30 million records. Unfortunately, I have to use the same table and can't go ahead with a new table.
The query executes within a second from RapidSQL. The problem I'm facing is it takes more than 10 minutes when I run it through the Java application. It doesn't throw any exceptions, it executes properly.
The query:
SELECT aaa, bbb, SUM(ccc), SUM(ddd), etc
FROM MyTable
WHERE SomeDate= date_entered_by_user AND SomeString IN ("aaa","bbb")
GROUP BY aaa,bbbI have an existing clustered index on SomeDate and SomeString fields.
To check I replaced the where clause with
WHERE SomeDate= date_entered_by_user AND SomeString = "aaa"No improvements.
What could be the problem?
Thank you,
LoboIt's hard for me to see how a stored proc will address this problem. I don't think it changes anything. Can you explain? The problem is slow query execution time. One way to speed up the execution time inside the RDBMS is to streamline the internal operations inside the interpreter.
When the engine receives a command to execute a SQL statement, it does a few things before actually executing the statement. These things take time. First, it checks to make sure there are no syntax errors in the SQL statement. Second, it checks to make sure all of the tables, columns and relationships "are in order." Third, it formulates an execution plan. This last step takes the most time out of the three. But, they all take time. The speed of these processes may vary from product to product.
When you create a stored procedure in a RDBMS, the processes above occur when you create the procedure. Most importantly, once an execution plan is created it is stored and reused whenever the stored procedure is ran. So, whenever an application calls the stored procedure, the execution plan has already been created. The engine does not have to anaylze the SELECT|INSERT|UPDATE|DELETE statements and create the plan (over and over again).
The stored execution plan will enable the engine to execute the query faster.
/> -
Identifying query execution time
Hello,
I would like to know how can I figure out the actual query execution time in Oracle.
RegardsOracle Documentation is your best friend.
http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/dynviews_2113.htm#i1417057
ELAPSED_TIME --> Elapsed time (in microseconds) used by this cursor for parsing, executing, and fetching
Asif Momen
http://momendba.blogspot.com -
Function used to find Query Execution Time
Hi All!
Could you please let me know the function name used in finding 'Query Execution Time'?
Thanks and Regards,
VikasI'm not quite sure what you mean...
In SQL*Plus: SET TIMING ON
This will display a timing message after the execution of a query. Is this what you mean?
cheers,
Anthony -
how can we reduce query execution time?which methods we have to follow to optimization?
which methods we have to follow to optimization?First, read this informative thread:
How to post a SQL statement tuning request HOW TO: Post a SQL statement tuning request - template posting
and post the relevant details we need.
Execution plans and/or TRACE/TKPROF output can help you identifying performance bottlenecks. -
QUERY EXECUTION TIME OR SEARCH TIME
Hi Guys,
Is there any way in OUAF to know how much time did the server took to retrieve the records when an User enters a filter in a Query Zone.
How to know the search time. Is this stored anywhere?
Please help me kindly.
Your help will be highly appreciatedFollow the below steps,
01. Launch the application in debug mode(?debug=true)
02. Check the Global Debug check box
03. Now do the operation which executes ur query or query zone
04. Open the log file, go thru it. You will find the each and every executed queries. spot it ur query and check the time the of execution and retried result time. just subtract the times. You will get the execution time of the query.
Maybe you are looking for
-
Movies on photo album page not working correctly
I have movies on some photo album pages, and only since updating to Snow Leopard, when I click on a movie, the sound begins to play, but the picture sticks on the poster frame. If I go "back to album" and click the movie again, it will usually play n
-
FTR_EDIT Reverse Cash Flow Issue
Hi, We are trying to reverse a cash flow on FTR_EDIT, but are receiving an error that there is "rest stock" and the reversal cannot be completed. The flow we are trying to reverse is due the same day as the final repayment so when we choose to revers
-
Need info on Cloning Server Services in BOXi3.1
Hi All, I am looking for information on Cloning Server Services in BOXi3.1. The specific points that i am looking for are mentioned below: 1. How cloning is of advantage, specially in areas where we are facing network traffic? 2. Can we monitor WEBI
-
HT1338 How to go back to lion from mountain lion????
Plese explian, How to go back to lion from mountain lion?
-
Problem With Compaq presario V3500
Currenty i have used Compaq V3500 since september 2008 ( before i bought CQ40-308TU, since i feel satisfied with HP-Compaq product). but a few days ago, my notebook suddenly crash, after (unfortunally) my guarantee has expired. After i can solve the