--- /dev/null
+/*\r
+\r
+ Derby - Class org.apache.derby.iapi.store.access.RowCountable\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.iapi.store.access;\r
+\r
+import org.apache.derby.iapi.error.StandardException; \r
+\r
+/**\r
+\r
+RowCountable provides the interfaces to read and write row counts in\r
+tables.\r
+<p>\r
+@see ScanController\r
+@see StoreCostController\r
+\r
+**/\r
+\r
+public interface RowCountable\r
+{\r
+ /**\r
+ * Get the total estimated number of rows in the container.\r
+ * <p>\r
+ * The number is a rough estimate and may be grossly off. In general\r
+ * the server will cache the row count and then occasionally write\r
+ * the count unlogged to a backing store. If the system happens to \r
+ * shutdown before the store gets a chance to update the row count it\r
+ * may wander from reality.\r
+ * <p>\r
+ * For btree conglomerates this call will return the count of both\r
+ * user rows and internal implementaation rows. The "BTREE" implementation\r
+ * generates 1 internal implementation row for each page in the btree, and \r
+ * it generates 1 internal implementation row for each branch row. For\r
+ * this reason it is recommended that clients if possible use the count\r
+ * of rows in the heap table to estimate the number of rows in the index\r
+ * rather than use the index estimated row count.\r
+ *\r
+ * @return The total estimated number of rows in the conglomerate.\r
+ *\r
+ * @exception StandardException Standard exception policy.\r
+ **/\r
+ public long getEstimatedRowCount()\r
+ throws StandardException;\r
+\r
+ /**\r
+ * Set the total estimated number of rows in the container.\r
+ * <p>\r
+ * Often, after a scan, the client of RawStore has a much better estimate\r
+ * of the number of rows in the container than what store has. For \r
+ * instance if we implement some sort of update statistics command, or\r
+ * just after a create index a complete scan will have been done of the\r
+ * table. In this case this interface allows the client to set the\r
+ * estimated row count for the container, and store will use that number\r
+ * for all future references.\r
+ * <p>\r
+ * This routine can also be used to set the estimated row count in the\r
+ * index to the number of rows in the base table, another workaround for\r
+ * the problem that index estimated row count includes non-user rows.\r
+ *\r
+ * @param count the estimated number of rows in the container.\r
+ *\r
+ * @exception StandardException Standard exception policy.\r
+ **/\r
+ public void setEstimatedRowCount(long count)\r
+ throws StandardException;\r
+\r
+}\r