KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > vti > VTICosting


1 /*
2
3    Derby - Class org.apache.derby.vti.VTICosting
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.vti;
23
24 import java.sql.SQLException JavaDoc;
25
26 /**
27   * VTICosting is the interface that the query optimizer uses
28   * to cost VTIs.
29   *
30   The methods on the interface provide the optimizer
31   * with the following information:
32   <UL>
33   <LI> the estimated number of rows returned by the VTI in a single instantiation.
34   <LI> the estimated cost to instantiate and iterate through the VTI.
35   <LI> whether or not the VTI can be instantiated multiple times within a single query execution
36   </UL>
37   * <P>
38   * This class can only be used within an SQL-J statement. Using the methods
39   * in application-side Java code results in Exceptions being thrown.
40   *
41   * @see org.apache.derby.vti.VTIEnvironment
42  */

43 public interface VTICosting
44 {
45     /**
46      * A useful constant: the default estimated number of rows returned by a VTI.
47      */

48     public static final double defaultEstimatedRowCount = 10000d;
49     /**
50        A useful constant: The default estimated cost of instantiating and iterating throught a VTI.
51      */

52     public static final double defaultEstimatedCost = 100000d;
53
54     /**
55      * Get the estimated row count for a single scan of a VTI.
56      *
57      * @param vtiEnvironment The VTIEnvironment.
58      *
59      * @return The estimated row count for a single scan of a VTI.
60      *
61      * @exception SQLException thrown if the costing fails.
62      */

63     public double getEstimatedRowCount(VTIEnvironment vtiEnvironment)
64         throws SQLException JavaDoc;
65
66     /**
67      * Get the estimated cost for a single instantiation of a VTI.
68      *
69      * @param vtiEnvironment The VTIEnvironment.
70      *
71      * @return The estimated cost for a single instantiation of a VTI.
72      *
73      * @exception SQLException thrown if the costing fails.
74      */

75     public double getEstimatedCostPerInstantiation(VTIEnvironment vtiEnvironment)
76         throws SQLException JavaDoc;
77
78     /**
79          Find out if the ResultSet of the VTI can be instantiated multiple times.
80
81          @param vtiEnvironment The VTIEnvironment.
82
83          @return True if the ResultSet can be instantiated multiple times, false if
84          can only be instantiated once.
85
86          @exception SQLException thrown if the costing fails.
87      */

88     public boolean supportsMultipleInstantiations(VTIEnvironment vtiEnvironment)
89         throws SQLException JavaDoc;
90 }
91
Popular Tags