KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > iapi > sql > execute > RunTimeStatistics


1 /*
2
3    Derby - Class org.apache.derby.iapi.sql.execute.RunTimeStatistics
4
5    Licensed to the Apache Software Foundation (ASF) under one or more
6    contributor license agreements. See the NOTICE file distributed with
7    this work for additional information regarding copyright ownership.
8    The ASF licenses this file to you under the Apache License, Version 2.0
9    (the "License"); you may not use this file except in compliance with
10    the License. You may obtain a copy of the License at
11
12       http://www.apache.org/licenses/LICENSE-2.0
13
14    Unless required by applicable law or agreed to in writing, software
15    distributed under the License is distributed on an "AS IS" BASIS,
16    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17    See the License for the specific language governing permissions and
18    limitations under the License.
19
20  */

21
22 package org.apache.derby.iapi.sql.execute;
23
24 import java.io.Serializable JavaDoc;
25
26 import java.sql.Time JavaDoc;
27 import java.sql.Timestamp JavaDoc;
28
29 /**
30     
31   * A RunTimeStatistics object is a representation of the query execution plan and run
32   * time statistics for a java.sql.ResultSet.
33   *
34   * A query execution plan is a tree
35   * of execution nodes. There are a number of possible node types. Statistics
36   * are accumulated during execution at each node. The types of statistics include
37   * the amount of time spent in specific operations (if STATISTICS TIMING is SET ON),
38   * the number of rows passed to the node by its child(ren) and the number of rows
39   * returned by the node to its parent. (The exact statistics are specific to each
40   * node type.)
41   * <P>
42   * RunTimeStatistics is most meaningful for DML statements (SELECT, INSERT, DELETE
43   * and UPDATE).
44   *
45   */

46 public interface RunTimeStatistics
47 {
48     /**
49      * Get the total compile time for the associated query in milliseconds.
50      * Compile time can be divided into parse, bind, optimize and generate times.
51      * <P>
52      * 0 is returned if STATISTICS TIMING is not SET ON.
53      *
54      * @return The total compile time for the associated query in milliseconds.
55      */

56     public long getCompileTimeInMillis();
57
58     /**
59      * Get the parse time for the associated query in milliseconds.
60      * <P>
61      * 0 is returned if STATISTICS TIMING is not SET ON.
62      *
63      * @return The parse time for the associated query in milliseconds.
64      */

65     public long getParseTimeInMillis();
66
67     /**
68      * Get the bind time for the associated query in milliseconds.
69      *
70      * @return The bind time for the associated query in milliseconds.
71      */

72     public long getBindTimeInMillis();
73
74     /**
75      * Get the optimize time for the associated query in milliseconds.
76      * <P>
77      * 0 is returned if STATISTICS TIMING is not SET ON.
78      *
79      * @return The optimize time for the associated query in milliseconds.
80      */

81     public long getOptimizeTimeInMillis();
82
83     /**
84      * Get the generate time for the associated query in milliseconds.
85      * <P>
86      * 0 is returned if STATISTICS TIMING is not SET ON.
87      *
88      * @return The generate time for the associated query in milliseconds.
89      */

90     public long getGenerateTimeInMillis();
91
92     /**
93      * Get the execute time for the associated query in milliseconds.
94      * <P>
95      * 0 is returned if STATISTICS TIMING is not SET ON.
96      *
97      * @return The execute time for the associated query in milliseconds.
98      */

99     public long getExecuteTimeInMillis();
100
101     /**
102      * Get the timestamp for the beginning of query compilation.
103      * <P>
104      * A null is returned if STATISTICS TIMING is not SET ON.
105      *
106      * @return The timestamp for the beginning of query compilation.
107      */

108     public Timestamp JavaDoc getBeginCompilationTimestamp();
109
110     /**
111      * Get the timestamp for the end of query compilation.
112      * <P>
113      * A null is returned if STATISTICS TIMING is not SET ON.
114      *
115      * @return The timestamp for the end of query compilation.
116      */

117     public Timestamp JavaDoc getEndCompilationTimestamp();
118
119     /**
120      * Get the timestamp for the beginning of query execution.
121      * <P>
122      * A null is returned if STATISTICS TIMING is not SET ON.
123      *
124      * @return The timestamp for the beginning of query execution.
125      */

126     public Timestamp JavaDoc getBeginExecutionTimestamp();
127
128     /**
129      * Get the timestamp for the end of query execution.
130      * <P>
131      * A null is returned if STATISTICS TIMING is not SET ON.
132      *
133      * @return The timestamp for the end of query execution.
134      */

135     public Timestamp JavaDoc getEndExecutionTimestamp();
136
137     /**
138      * Get the name of the associated query or statement.
139      * (This will be an internally generated name if the
140      * user did not assign a name.)
141      *
142      * @return The name of the associated query or statement.
143      */

144     public String JavaDoc getStatementName();
145
146     /**
147      * Get the name of the Stored Prepared Statement used
148      * for the statement. This method returns
149      * a value only for <i>EXECUTE STATEMENT</i> statements;
150      * otherwise, returns null.
151      * <p>
152      * Note that the name is returned in the schema.name
153      * format (e.g. APP.MYSTMT).
154      *
155      * @return The Stored Prepared Statement name of
156      * the associated statement, or null if it is not an EXECUTE
157      * STATEMENT statement.
158      */

159     public String JavaDoc getSPSName();
160
161     /**
162      * Get the text for the associated query or statement.
163      *
164      * @return The text for the associated query or statement.
165      */

166     public String JavaDoc getStatementText();
167
168     /**
169      * Get a String representation of the execution plan
170      * for the associated query or statement.
171      *
172      * @return The execution plan for the associated query or statement.
173      */

174     public String JavaDoc getStatementExecutionPlanText();
175
176     /**
177      * Get a String representation of the information on the nodes
178      * relating to table and index scans from the execution plan for
179      * the associated query or statement.
180      *
181      * @return The nodes relating to table and index scans
182      * from the execution plan for the associated query or statement.
183      */

184     public String JavaDoc getScanStatisticsText();
185
186     /**
187      * Get a String representation of the information on the nodes
188      * relating to table and index scans from the execution plan for
189      * the associated query or statement for a particular table.
190      * <P>
191      * @param tableName The table for which user desires statistics.
192      * <P>
193      * @return The nodes relating to table and index scans
194      * from the execution plan for the associated query or statement.
195      */

196     public String JavaDoc getScanStatisticsText(String JavaDoc tableName);
197
198     /**
199      * Get the estimated row count for the number of rows returned
200      * by the associated query or statement.
201      *
202      * @return The estimated number of rows returned by the associated
203      * query or statement.
204      */

205     public double getEstimatedRowCount();
206 }
207
Popular Tags