KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derby > iapi > store > access > RowCountable


1 /*
2
3    Derby - Class org.apache.derby.iapi.store.access.RowCountable
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.store.access;
23
24 import org.apache.derby.iapi.error.StandardException;
25
26 /**
27
28 RowCountable provides the interfaces to read and write row counts in
29 tables.
30 <p>
31 @see ScanController
32 @see StoreCostController
33
34 **/

35
36 public interface RowCountable
37 {
38     /**
39      * Get the total estimated number of rows in the container.
40      * <p>
41      * The number is a rough estimate and may be grossly off. In general
42      * the server will cache the row count and then occasionally write
43      * the count unlogged to a backing store. If the system happens to
44      * shutdown before the store gets a chance to update the row count it
45      * may wander from reality.
46      * <p>
47      * For btree conglomerates this call will return the count of both
48      * user rows and internal implementaation rows. The "BTREE" implementation
49      * generates 1 internal implementation row for each page in the btree, and
50      * it generates 1 internal implementation row for each branch row. For
51      * this reason it is recommended that clients if possible use the count
52      * of rows in the heap table to estimate the number of rows in the index
53      * rather than use the index estimated row count.
54      *
55      * @return The total estimated number of rows in the conglomerate.
56      *
57      * @exception StandardException Standard exception policy.
58      **/

59     public long getEstimatedRowCount()
60         throws StandardException;
61
62     /**
63      * Set the total estimated number of rows in the container.
64      * <p>
65      * Often, after a scan, the client of RawStore has a much better estimate
66      * of the number of rows in the container than what store has. For
67      * instance if we implement some sort of update statistics command, or
68      * just after a create index a complete scan will have been done of the
69      * table. In this case this interface allows the client to set the
70      * estimated row count for the container, and store will use that number
71      * for all future references.
72      * <p>
73      * This routine can also be used to set the estimated row count in the
74      * index to the number of rows in the base table, another workaround for
75      * the problem that index estimated row count includes non-user rows.
76      *
77      * @param count the estimated number of rows in the container.
78      *
79      * @exception StandardException Standard exception policy.
80      **/

81     public void setEstimatedRowCount(long count)
82         throws StandardException;
83
84 }
85
Popular Tags