--- /dev/null
+/*\r
+\r
+ Derby - Class org.apache.derby.vti.VTICosting\r
+\r
+ Licensed to the Apache Software Foundation (ASF) under one or more\r
+ contributor license agreements. See the NOTICE file distributed with\r
+ this work for additional information regarding copyright ownership.\r
+ The ASF licenses this file to You under the Apache License, Version 2.0\r
+ (the "License"); you may not use this file except in compliance with\r
+ the License. You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+\r
+ */\r
+\r
+package org.apache.derby.vti;\r
+\r
+import java.sql.SQLException;\r
+\r
+/**\r
+ * VTICosting is the interface that the query optimizer uses\r
+ * to cost VTIs.\r
+ * \r
+ The methods on the interface provide the optimizer\r
+ * with the following information:\r
+ <UL> \r
+ <LI> the estimated number of rows returned by the VTI in a single instantiation.\r
+ <LI> the estimated cost to instantiate and iterate through the VTI.\r
+ <LI> whether or not the VTI can be instantiated multiple times within a single query execution\r
+ </UL>\r
+ * <P>\r
+ * This class can only be used within an SQL-J statement. Using the methods\r
+ * in application-side Java code results in Exceptions being thrown.\r
+ *\r
+ * @see org.apache.derby.vti.VTIEnvironment\r
+ */\r
+public interface VTICosting\r
+{\r
+ /**\r
+ * A useful constant: the default estimated number of rows returned by a VTI.\r
+ */\r
+ public static final double defaultEstimatedRowCount = 10000d;\r
+ /**\r
+ A useful constant: The default estimated cost of instantiating and iterating throught a VTI.\r
+ */\r
+ public static final double defaultEstimatedCost = 100000d;\r
+\r
+ /**\r
+ * Get the estimated row count for a single scan of a VTI.\r
+ *\r
+ * @param vtiEnvironment The VTIEnvironment.\r
+ *\r
+ * @return The estimated row count for a single scan of a VTI.\r
+ *\r
+ * @exception SQLException thrown if the costing fails.\r
+ */\r
+ public double getEstimatedRowCount(VTIEnvironment vtiEnvironment)\r
+ throws SQLException;\r
+\r
+ /**\r
+ * Get the estimated cost for a single instantiation of a VTI.\r
+ *\r
+ * @param vtiEnvironment The VTIEnvironment.\r
+ *\r
+ * @return The estimated cost for a single instantiation of a VTI.\r
+ *\r
+ * @exception SQLException thrown if the costing fails.\r
+ */\r
+ public double getEstimatedCostPerInstantiation(VTIEnvironment vtiEnvironment)\r
+ throws SQLException;\r
+\r
+ /**\r
+ Find out if the ResultSet of the VTI can be instantiated multiple times.\r
+\r
+ @param vtiEnvironment The VTIEnvironment.\r
+\r
+ @return True if the ResultSet can be instantiated multiple times, false if\r
+ can only be instantiated once.\r
+\r
+ @exception SQLException thrown if the costing fails.\r
+ */\r
+ public boolean supportsMultipleInstantiations(VTIEnvironment vtiEnvironment)\r
+ throws SQLException;\r
+}\r