|
|||||||||
| Home >> All >> org >> apache >> derby >> [ diag overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.derby.diag
Class SpaceTable

java.lang.Objectorg.apache.derby.vti.VTITemplate
org.apache.derby.diag.SpaceTable
- All Implemented Interfaces:
- java.sql.ResultSet, org.apache.derby.vti.VTICosting
- public class SpaceTable
- extends org.apache.derby.vti.VTITemplate
- implements org.apache.derby.vti.VTICosting
- extends org.apache.derby.vti.VTITemplate
SpaceTable is a virtual table that shows the space usage of a particular table and its indexes. This virtual table can be invoked by calling it directly, and supplying the schema name and table name as arguments.
select * from new org.apache.derby.diag.SpaceTable('MYSCHEMA','MYTABLE') t;
If the schema name is not supplied, the default schema is used.
select * from new org.apache.derby.diag.SpaceTable('MYTABLE') t;
Alternatively, the table can be invoked through the system alias SpaceTable
select * from new SPACETABLE('MYTABLE') t;
NOTE: Both the schema name and the table name must be any expression that evaluates to a string data type. If you created a schema or table name as a non-delimited identifier, you must present their names in all upper case.
The SpaceTable virtual table can be used to estimate whether space might be saved by compressing a table and its indexes.
The SpaceTable virtual table has the following columns:
- CONGLOMERATENAME varchar(128) - nullable. The name of the conglomerate, which is either the table name or the index name. (Unlike the SYSCONGLOMERATES column of the same name, table ID's do not appear here).
- ISINDEX SMALLINT - not nullable. Is not zero if the conglomerate is an index, 0 otherwise.
- NUMALLOCATEDPAGES bigint - not nullable. The number of pages actively linked into the table. The total number of pages in the file is the sum of NUMALLOCATEDPAGES + NUMFREEPAGES.
- NUMFREEPAGES bigint - not nullable. The number of free pages that belong to the table. When a new page is to be linked into the table the system will move a page from the NUMFREEPAGES list to the NUMALLOCATEDPAGES list. The total number of pages in the file is the sum of NUMALLOCATEDPAGES + NUMFREEPAGES.
- NUMUNFILLEDPAGES bigint - not nullable. The number of unfilled pages that belong to the table. Unfilled pages are allocated pages that are not completely full. Note that the number of unfilled pages is an estimate and is not exact. Running the same query twice can give different results on this column.
- PAGESIZE integer - not nullable. The size of the page in bytes for that conglomerate.
- ESTIMSPACESAVING bigint - not nullable. The estimated space which could possibly be saved by compressing the conglomerate, in bytes.
To get space information on all schemas and tables, use a query such as
select v.*
from SYS.SYSSCHEMAS s,
SYS.SYSTABLES t,
new org.apache.derby.diag.SpaceTable(SCHEMANAME,TABLENAME) v
where s.SCHEMAID = t.SCHEMAID;
| Field Summary | |
private static org.apache.derby.iapi.sql.ResultColumnDescriptor[] |
columnInfo
|
private ConglomInfo[] |
conglomTable
|
(package private) int |
currentRow
|
(package private) boolean |
initialized
|
private static java.sql.ResultSetMetaData |
metadata
|
private java.lang.String |
schemaName
|
private org.apache.derby.iapi.store.access.SpaceInfo |
spaceInfo
|
private java.lang.String |
tableName
|
private org.apache.derby.iapi.store.access.TransactionController |
tc
|
private boolean |
wasNull
|
| Fields inherited from interface org.apache.derby.vti.VTICosting |
defaultEstimatedCost, defaultEstimatedRowCount |
| Fields inherited from interface java.sql.ResultSet |
CLOSE_CURSORS_AT_COMMIT, CONCUR_READ_ONLY, CONCUR_UPDATABLE, FETCH_FORWARD, FETCH_REVERSE, FETCH_UNKNOWN, HOLD_CURSORS_OVER_COMMIT, TYPE_FORWARD_ONLY, TYPE_SCROLL_INSENSITIVE, TYPE_SCROLL_SENSITIVE |
| Constructor Summary | |
SpaceTable(java.lang.String tableName)
|
|
SpaceTable(java.lang.String schemaName,
java.lang.String tableName)
|
|
| Method Summary | |
void |
close()
This method closes the result set and frees any associated resources. |
private void |
getConglomInfo(org.apache.derby.iapi.sql.conn.LanguageConnectionContext lcc)
|
double |
getEstimatedCostPerInstantiation(org.apache.derby.vti.VTIEnvironment vtiEnvironment)
Get the estimated cost for a single instantiation of a VTI. |
double |
getEstimatedRowCount(org.apache.derby.vti.VTIEnvironment vtiEnvironment)
Get the estimated row count for a single scan of a VTI. |
int |
getInt(int columnNumber)
This method returns the value of the specified column as a Java int. |
long |
getLong(int columnNumber)
This method returns the value of the specified column as a Java long. |
java.sql.ResultSetMetaData |
getMetaData()
This method returns data about the columns returned as part of the result set as a ResultSetMetaData instance. |
short |
getShort(int columnNumber)
This method returns the value of the specified column as a Java short. |
private void |
getSpaceInfo(int index)
|
java.lang.String |
getString(int columnNumber)
This method returns the value of the specified column as a Java String. |
boolean |
next()
This method advances to the next row in the result set. |
boolean |
supportsMultipleInstantiations(org.apache.derby.vti.VTIEnvironment vtiEnvironment)
Find out if the ResultSet of the VTI can be instantiated multiple times. |
boolean |
wasNull()
This method tests whether the value of the last column that was fetched was actually a SQL NULL value. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
conglomTable
private ConglomInfo[] conglomTable
initialized
boolean initialized
currentRow
int currentRow
wasNull
private boolean wasNull
schemaName
private java.lang.String schemaName
tableName
private java.lang.String tableName
spaceInfo
private org.apache.derby.iapi.store.access.SpaceInfo spaceInfo
tc
private org.apache.derby.iapi.store.access.TransactionController tc
columnInfo
private static final org.apache.derby.iapi.sql.ResultColumnDescriptor[] columnInfo
metadata
private static final java.sql.ResultSetMetaData metadata
| Constructor Detail |
SpaceTable
public SpaceTable(java.lang.String schemaName, java.lang.String tableName)
SpaceTable
public SpaceTable(java.lang.String tableName)
| Method Detail |
getConglomInfo
private void getConglomInfo(org.apache.derby.iapi.sql.conn.LanguageConnectionContext lcc) throws org.apache.derby.iapi.error.StandardException
getSpaceInfo
private void getSpaceInfo(int index)
throws org.apache.derby.iapi.error.StandardException
getMetaData
public java.sql.ResultSetMetaData getMetaData()
- Description copied from interface:
java.sql.ResultSet - This method returns data about the columns returned as part of the
result set as a
ResultSetMetaDatainstance.- Specified by:
getMetaDatain interfacejava.sql.ResultSet
next
public boolean next()
throws java.sql.SQLException
- Description copied from interface:
java.sql.ResultSet - This method advances to the next row in the result set. Any streams
open on the current row are closed automatically.
- Specified by:
nextin interfacejava.sql.ResultSet
close
public void close()
- Description copied from interface:
java.sql.ResultSet - This method closes the result set and frees any associated resources.
- Specified by:
closein interfacejava.sql.ResultSet
getString
public java.lang.String getString(int columnNumber)
- Description copied from interface:
java.sql.ResultSet - This method returns the value of the specified column as a Java
String.- Specified by:
getStringin interfacejava.sql.ResultSet
getLong
public long getLong(int columnNumber)
- Description copied from interface:
java.sql.ResultSet - This method returns the value of the specified column as a Java
long.- Specified by:
getLongin interfacejava.sql.ResultSet
getShort
public short getShort(int columnNumber)
- Description copied from interface:
java.sql.ResultSet - This method returns the value of the specified column as a Java
short.- Specified by:
getShortin interfacejava.sql.ResultSet
getInt
public int getInt(int columnNumber)
- Description copied from interface:
java.sql.ResultSet - This method returns the value of the specified column as a Java
int.- Specified by:
getIntin interfacejava.sql.ResultSet
wasNull
public boolean wasNull()
- Description copied from interface:
java.sql.ResultSet - This method tests whether the value of the last column that was fetched
was actually a SQL NULL value.
- Specified by:
wasNullin interfacejava.sql.ResultSet
getEstimatedRowCount
public double getEstimatedRowCount(org.apache.derby.vti.VTIEnvironment vtiEnvironment)
- Description copied from interface:
org.apache.derby.vti.VTICosting - Get the estimated row count for a single scan of a VTI.
- Specified by:
getEstimatedRowCountin interfaceorg.apache.derby.vti.VTICosting
getEstimatedCostPerInstantiation
public double getEstimatedCostPerInstantiation(org.apache.derby.vti.VTIEnvironment vtiEnvironment)
- Description copied from interface:
org.apache.derby.vti.VTICosting - Get the estimated cost for a single instantiation of a VTI.
- Specified by:
getEstimatedCostPerInstantiationin interfaceorg.apache.derby.vti.VTICosting
supportsMultipleInstantiations
public boolean supportsMultipleInstantiations(org.apache.derby.vti.VTIEnvironment vtiEnvironment)
- Description copied from interface:
org.apache.derby.vti.VTICosting - Find out if the ResultSet of the VTI can be instantiated multiple times.
- Specified by:
supportsMultipleInstantiationsin interfaceorg.apache.derby.vti.VTICosting
|
|||||||||
| Home >> All >> org >> apache >> derby >> [ diag overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC