Top Description Fields Constructors Methods
org.apache.derby.diag

public Class SpaceTable

Additional top-level class in compilation unit: ConglomInfo.

extends VTITemplate
implements VTICosting
Class Inheritance
All Implemented Interfaces
org.apache.derby.vti.VTICosting
Imports
org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.shared.common.error.StandardException, .PublicAPI, org.apache.derby.iapi.sql.conn.LanguageConnectionContext, .ConnectionUtil, org.apache.derby.iapi.sql.dictionary.DataDictionary, .SchemaDescriptor, .TableDescriptor, .ConglomerateDescriptor, org.apache.derby.iapi.store.access.TransactionController, .ConglomerateController, .SpaceInfo, org.apache.derby.iapi.sql.ResultColumnDescriptor, org.apache.derby.impl.jdbc.EmbedResultSetMetaData, java.sql.ResultSetMetaData, .SQLException, .Types, org.apache.derby.vti.VTITemplate, .VTICosting, .VTIEnvironment

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 TABLE(SYSCS_DIAG.SPACE_TABLE('MYSCHEMA', 'MYTABLE')) T;  
If the schema name is not supplied, the default schema is used.
 SELECT * FROM TABLE(SYSCS_DIAG.SPACE_TABLE('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:

To get space information on all schemas and tables, use a query such as

    select v.*
    from SYS.SYSSCHEMAS s,
         SYS.SYSTABLES t,
         TABLE(SYSCS_DIAG.SPACE_TABLE(SCHEMANAME, TABLENAME)) v
    where s.SCHEMAID = t.SCHEMAID;
    

Field Summary

Modifier and TypeField and Description
private static final ResultColumnDescriptor[]
private ConglomInfo[]
pack-priv int
pack-priv boolean
private static final ResultSetMetaData
private String
private SpaceInfo
private String
private TransactionController
private boolean

Constructor Summary

AccessConstructor and Description
public
public
SpaceTable(String schemaName, String tableName)

public
SpaceTable(String tableName)

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements java.sql.ResultSet.close.

Releases this ResultSet object's database and JDBC resources immediately instead of waiting for this to happen when it is automatically closed.

private void
public double
getEstimatedCostPerInstantiation(VTIEnvironment
The state variable for optimizing the Table Function.
vtiEnvironment
)

Implements org.apache.derby.vti.VTICosting.getEstimatedCostPerInstantiation.

Get the estimated cost for a single instantiation of a Table Function.

public double
getEstimatedRowCount(VTIEnvironment
The state variable for optimizing the Table Function.
vtiEnvironment
)

Implements org.apache.derby.vti.VTICosting.getEstimatedRowCount.

Get the estimated row count for a single scan of a Table Function.

public int
getInt(int
the first column is 1, the second is 2, ...
columnNumber
)

Overrides org.apache.derby.vti.VTITemplate.getInt.

Implements java.sql.ResultSet.getInt.

Retrieves the value of the designated column in the current row of this ResultSet object as an int in the Java programming language.

public long
getLong(int
the first column is 1, the second is 2, ...
columnNumber
)

Overrides org.apache.derby.vti.VTITemplate.getLong.

Implements java.sql.ResultSet.getLong.

Retrieves the value of the designated column in the current row of this ResultSet object as a long in the Java programming language.

public ResultSetMetaData
getMetaData()

Overrides org.apache.derby.vti.VTITemplate.getMetaData.

Implements java.sql.ResultSet.getMetaData.

Retrieves the number, types and properties of this ResultSet object's columns.

public short
getShort(int
the first column is 1, the second is 2, ...
columnNumber
)

Overrides org.apache.derby.vti.VTITemplate.getShort.

Implements java.sql.ResultSet.getShort.

Retrieves the value of the designated column in the current row of this ResultSet object as a short in the Java programming language.

private void
getSpaceInfo(int index)

public String
getString(int
the first column is 1, the second is 2, ...
columnNumber
)

Overrides org.apache.derby.vti.VTITemplate.getString.

Implements java.sql.ResultSet.getString.

Retrieves the value of the designated column in the current row of this ResultSet object as a String in the Java programming language.

public boolean
next()

Implements java.sql.ResultSet.next.

Moves the cursor forward one row from its current position.

public boolean

Returns:

true
supportsMultipleInstantiations
(VTIEnvironment
The state variable for optimizing the Table Function.
vtiEnvironment
)

Implements org.apache.derby.vti.VTICosting.supportsMultipleInstantiations.

Find out if the ResultSet of the Table Function can be instantiated multiple times.

public boolean
wasNull()

Overrides org.apache.derby.vti.VTITemplate.wasNull.

Implements java.sql.ResultSet.wasNull.

Reports whether the last column read had a value of SQL NULL.

Inherited from org.apache.derby.vti.VTITemplate:
absoluteafterLastbeforeFirstcancelRowUpdatesclearWarningsdeleteRowfindColumnfirstgetArraygetArraygetAsciiStreamgetAsciiStreamgetBigDecimalgetBigDecimalgetBigDecimalgetBigDecimalgetBinaryStreamgetBinaryStreamgetBlobgetBlobgetBooleangetBooleangetBytegetBytegetBytesgetBytesgetCharacterStreamgetCharacterStreamgetClobgetClobgetConcurrencygetContextgetCursorNamegetDategetDategetDategetDategetDoublegetDoublegetFetchDirectiongetFetchSizegetFloatgetFloatgetHoldabilitygetIntgetLonggetNCharacterStreamgetNCharacterStreamgetNClobgetNClobgetNStringgetNStringgetObjectgetObjectgetObjectgetObjectgetObjectgetObjectgetRefgetRefgetReturnTableSignaturegetRowgetRowIdgetRowIdgetShortgetSQLXMLgetSQLXMLgetStatementgetStringgetTimegetTimegetTimegetTimegetTimestampgetTimestampgetTimestampgetTimestampgetTypegetUnicodeStreamgetUnicodeStreamgetURLgetURLgetWarningsinsertRowisAfterLastisBeforeFirstisClosedisFirstisLastisWrapperForlastmoveToCurrentRowmoveToInsertRownotImplementedpreviousrefreshRowrelativerowDeletedrowInsertedrowUpdatedsetContextsetFetchDirectionsetFetchSizeunwrapupdateArrayupdateArrayupdateAsciiStreamupdateAsciiStreamupdateAsciiStreamupdateAsciiStreamupdateAsciiStreamupdateAsciiStreamupdateBigDecimalupdateBigDecimalupdateBinaryStreamupdateBinaryStreamupdateBinaryStreamupdateBinaryStreamupdateBinaryStreamupdateBinaryStreamupdateBlobupdateBlobupdateBlobupdateBlobupdateBlobupdateBlobupdateBooleanupdateBooleanupdateByteupdateByteupdateBytesupdateBytesupdateCharacterStreamupdateCharacterStreamupdateCharacterStreamupdateCharacterStreamupdateCharacterStreamupdateCharacterStreamupdateClobupdateClobupdateClobupdateClobupdateClobupdateClobupdateDateupdateDateupdateDoubleupdateDoubleupdateFloatupdateFloatupdateIntupdateIntupdateLongupdateLongupdateNCharacterStreamupdateNCharacterStreamupdateNCharacterStreamupdateNCharacterStreamupdateNClobupdateNClobupdateNClobupdateNClobupdateNClobupdateNClobupdateNStringupdateNStringupdateNullupdateNullupdateObjectupdateObjectupdateObjectupdateObjectupdateRefupdateRefupdateRowupdateRowIdupdateRowIdupdateShortupdateShortupdateSQLXMLupdateSQLXMLupdateStringupdateStringupdateTimeupdateTimeupdateTimestampupdateTimestamp

Field Detail

columnInfoback to summary
private static final ResultColumnDescriptor[] columnInfo
conglomTableback to summary
private ConglomInfo[] conglomTable
currentRowback to summary
pack-priv int currentRow
initializedback to summary
pack-priv boolean initialized
metadataback to summary
private static final ResultSetMetaData metadata
schemaNameback to summary
private String schemaName
spaceInfoback to summary
private SpaceInfo spaceInfo
tableNameback to summary
private String tableName
tcback to summary
private TransactionController tc
wasNullback to summary
private boolean wasNull

Constructor Detail

SpaceTableback to summary
public SpaceTable()
SpaceTableback to summary
public SpaceTable(String schemaName, String tableName)
SpaceTableback to summary
public SpaceTable(String tableName)

Method Detail

closeback to summary
public void close()

Implements java.sql.ResultSet.close.

Doc from java.sql.ResultSet.close.

Releases this ResultSet object's database and JDBC resources immediately instead of waiting for this to happen when it is automatically closed.

The closing of a ResultSet object does not close the Blob, Clob or NClob objects created by the ResultSet. Blob, Clob or NClob objects remain valid for at least the duration of the transaction in which they are created, unless their free method is invoked.

When a ResultSet is closed, any ResultSetMetaData instances that were created by calling the getMetaData method remain accessible.

Note

A ResultSet object is automatically closed by the Statement object that generated it when that Statement object is closed, re-executed, or is used to retrieve the next result from a sequence of multiple results.

Calling the method close on a ResultSet object that is already closed is a no-op.

See Also
java.sql.ResultSet#close
getConglomInfoback to summary
private void getConglomInfo(LanguageConnectionContext lcc) throws StandardException
getEstimatedCostPerInstantiationback to summary
public double getEstimatedCostPerInstantiation(VTIEnvironment vtiEnvironment)

Implements org.apache.derby.vti.VTICosting.getEstimatedCostPerInstantiation.

Doc from org.apache.derby.vti.VTICosting.getEstimatedCostPerInstantiation.

Get the estimated cost for a single instantiation of a Table Function.

Parameters
vtiEnvironment:VTIEnvironment

The state variable for optimizing the Table Function.

Returns:double

The estimated cost for a single instantiation of the Table Function.

See Also
VTICosting#getEstimatedCostPerInstantiation
getEstimatedRowCountback to summary
public double getEstimatedRowCount(VTIEnvironment vtiEnvironment)

Implements org.apache.derby.vti.VTICosting.getEstimatedRowCount.

Doc from org.apache.derby.vti.VTICosting.getEstimatedRowCount.

Get the estimated row count for a single scan of a Table Function.

Parameters
vtiEnvironment:VTIEnvironment

The state variable for optimizing the Table Function.

Returns:double

The estimated row count for a single scan of the Table Function.

See Also
VTICosting#getEstimatedRowCount
getIntback to summary
public int getInt(int columnNumber)

Overrides org.apache.derby.vti.VTITemplate.getInt.

Implements java.sql.ResultSet.getInt.

Doc from java.sql.ResultSet.getInt.

Retrieves the value of the designated column in the current row of this ResultSet object as an int in the Java programming language.

Parameters
columnNumber:int

the first column is 1, the second is 2, ...

Returns:int

the column value; if the value is SQL NULL, the value returned is 0

See Also
java.sql.ResultSet#getInt
getLongback to summary
public long getLong(int columnNumber)

Overrides org.apache.derby.vti.VTITemplate.getLong.

Implements java.sql.ResultSet.getLong.

Doc from java.sql.ResultSet.getLong.

Retrieves the value of the designated column in the current row of this ResultSet object as a long in the Java programming language.

Parameters
columnNumber:int

the first column is 1, the second is 2, ...

Returns:long

the column value; if the value is SQL NULL, the value returned is 0

See Also
java.sql.ResultSet#getLong
getMetaDataback to summary
public ResultSetMetaData getMetaData()

Overrides org.apache.derby.vti.VTITemplate.getMetaData.

Implements java.sql.ResultSet.getMetaData.

Doc from java.sql.ResultSet.getMetaData.

Retrieves the number, types and properties of this ResultSet object's columns.

Returns:ResultSetMetaData

the description of this ResultSet object's columns

See Also
java.sql.ResultSet#getMetaData
getShortback to summary
public short getShort(int columnNumber)

Overrides org.apache.derby.vti.VTITemplate.getShort.

Implements java.sql.ResultSet.getShort.

Doc from java.sql.ResultSet.getShort.

Retrieves the value of the designated column in the current row of this ResultSet object as a short in the Java programming language.

Parameters
columnNumber:int

the first column is 1, the second is 2, ...

Returns:short

the column value; if the value is SQL NULL, the value returned is 0

See Also
java.sql.ResultSet#getShort
getSpaceInfoback to summary
private void getSpaceInfo(int index) throws StandardException
getStringback to summary
public String getString(int columnNumber)

Overrides org.apache.derby.vti.VTITemplate.getString.

Implements java.sql.ResultSet.getString.

Doc from java.sql.ResultSet.getString.

Retrieves the value of the designated column in the current row of this ResultSet object as a String in the Java programming language.

Parameters
columnNumber:int

the first column is 1, the second is 2, ...

Returns:String

the column value; if the value is SQL NULL, the value returned is null

See Also
java.sql.ResultSet#getString
nextback to summary
public boolean next() throws SQLException

Implements java.sql.ResultSet.next.

Doc from java.sql.ResultSet.next.

Moves the cursor forward one row from its current position. A ResultSet cursor is initially positioned before the first row; the first call to the method next makes the first row the current row; the second call makes the second row the current row, and so on.

When a call to the next method returns false, the cursor is positioned after the last row. Any invocation of a ResultSet method which requires a current row will result in a SQLException being thrown. If the result set type is TYPE_FORWARD_ONLY, it is vendor specified whether their JDBC driver implementation will return false or throw an SQLException on a subsequent call to next.

If an input stream is open for the current row, a call to the method next will implicitly close it. A ResultSet object's warning chain is cleared when a new row is read.

Returns:boolean

true if the new current row is valid; false if there are no more rows

Exceptions
SQLException:
if no transaction context can be found
See Also
java.sql.ResultSet#next
supportsMultipleInstantiationsback to summary
public boolean supportsMultipleInstantiations(VTIEnvironment vtiEnvironment)

Implements org.apache.derby.vti.VTICosting.supportsMultipleInstantiations.

Doc from org.apache.derby.vti.VTICosting.supportsMultipleInstantiations.

Find out if the ResultSet of the Table Function can be instantiated multiple times.

Parameters
vtiEnvironment:VTIEnvironment

The state variable for optimizing the Table Function.

Returns:boolean

true

See Also
VTICosting#supportsMultipleInstantiations
wasNullback to summary
public boolean wasNull()

Overrides org.apache.derby.vti.VTITemplate.wasNull.

Implements java.sql.ResultSet.wasNull.

Doc from java.sql.ResultSet.wasNull.

Reports whether the last column read had a value of SQL NULL. Note that you must first call one of the getter methods on a column to try to read its value and then call the method wasNull to see if the value read was SQL NULL.

Returns:boolean

true if the last column value read was SQL NULL and false otherwise

See Also
java.sql.ResultSet#wasNull