Class TableDescriptor
- All Implemented Interfaces:
Dependable
,Dependent
,Provider
- external interface
- public String getSchemaName();
- public String getQualifiedName();
- public int getTableType();
- public long getHeapConglomerateId() throws StandardException;
- public int getNumberOfColumns();
- public FormatableBitSet getReferencedColumnMap();
- public void setReferencedColumnMap(FormatableBitSet referencedColumnMap);
- public int getMaxColumnID() throws StandardException;
- public void setUUID(UUID uuid);
- public char getLockGranularity();
- public void setTableName(String newTableName);
- public void setLockGranularity(char lockGranularity);
- public ExecRow getEmptyExecRow( ContextManager cm) throws StandardException;
- public boolean tableNameEquals(String otherSchemaName, String otherTableName);
- public ReferencedKeyConstraintDescriptor getPrimaryKey() throws StandardException;
- public void removeConglomerateDescriptor(ConglomerateDescriptor cd) throws StandardException;
- public void removeConstraintDescriptor(ConstraintDescriptor cd) throws StandardException;
- public void getAffectedIndexes(...) throws StandardException;
- public void getAllRelevantTriggers(...) throws StandardException;
- public void getAllRelevantConstraints(...) throws StandardException
- public ColumnDescriptorList getColumnDescriptorList();
- public String[] getColumnNamesArray();
- public long[] getAutoincIncrementArray();
- public ColumnDescriptor getColumnDescriptor(String columnName);
- public ColumnDescriptor getColumnDescriptor(int columnNumber);
- public ConglomerateDescriptor[] getConglomerateDescriptors() throws StandardException;
- public ConglomerateDescriptor getConglomerateDescriptor(long conglomerateNumber) throws StandardException;
- public ConglomerateDescriptor getConglomerateDescriptor(UUID conglomerateUUID) throws StandardException;
- public IndexLister getIndexLister() throws StandardException;
- public ViewDescriptor getViewDescriptor();
- public boolean tableHasAutoincrement();
- public boolean statisticsExist(ConglomerateDescriptor cd) throws StandardException;
- public double selectivityForConglomerate(...)throws StandardException;
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
(package private) ColumnDescriptorList
(package private) ConglomerateDescriptorList
(package private) ConstraintDescriptorList
static final char
static final int
private long
The id of the heap conglomerate for the table described by this instance.private String
private boolean
static final int
static final int
static final double
private char
(package private) UUID
private boolean
private boolean
static final char
(package private) SchemaDescriptor
private List
<StatisticsDescriptor> A list of statistics pertaining to this table--static final int
static final int
static final char
(package private) String
(package private) int
private TriggerDescriptorList
static final int
(package private) ViewDescriptor
static final int
Fields inherited from interface org.apache.derby.catalog.Dependable
ACTIVATION, ALIAS, COLUMNS_IN_TABLE, COLUMNS_PERMISSION, CONGLOMERATE, CONSTRAINT, DEFAULT, FILE, HEAP, INDEX, PERM, PREPARED_STATEMENT, ROLE_GRANT, ROUTINE_PERMISSION, SCHEMA, SEQUENCE, STORED_PREPARED_STATEMENT, TABLE, TABLE_PERMISSION, TRIGGER, VIEW
-
Constructor Summary
ConstructorsConstructorDescriptionTableDescriptor
(DataDictionary dataDictionary, String tableName, SchemaDescriptor schema, int tableType, boolean onCommitDeleteRows, boolean onRollbackDeleteRows) Constructor for a TableDescriptor (this is for a temporary table).TableDescriptor
(DataDictionary dataDictionary, String tableName, SchemaDescriptor schema, int tableType, char lockGranularity) Constructor for a TableDescriptor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Empty the constraint descriptor listvoid
Empty the trigger descriptor listvoid
getAllRelevantConstraints
(int statementType, int[] changedColumnIds, boolean[] needsDeferredProcessing, ConstraintDescriptorList relevantConstraints) Gets all of the relevant constraints for a statement, given its statement type and its list of updated columns.void
getAllRelevantTriggers
(int statementType, int[] changedColumnIds, TriggerDescriptorList relevantTriggers) Builds a list of all triggers which are relevant to a given statement type, given a list of updated columns.boolean
Tells if the index statistics for the indexes associated with this table are consideres up-to-date, and clears the state.long[]
gets an array of increment values for autoincrement columns in the target table.Get the provider's type.int[]
Return an array of collation ids for this table.getColumnDescriptor
(int columnNumber) getColumnDescriptor
(String columnName) Get the descriptor for a column in the table, either by the column name or by its ordinal position (column number).Gets the column descriptor listint[]
getColumnIDs
(String[] names) Turn an array of column names into the corresponding 1-based column positions.String[]
Gets an array of column names.getConglomerateDescriptor
(long conglomerateNumber) Gets a conglomerate descriptor for the given table and conglomerate number.getConglomerateDescriptor
(UUID conglomerateUUID) Gets a conglomerate descriptor for the given table and conglomerate UUID String.Gets the conglomerate descriptor listGets a ConglomerateDescriptor[] to loop through all the conglomerate descriptors for the table.getConglomerateDescriptors
(long conglomerateNumber) Gets array of conglomerate descriptors for the given table and conglomerate number.getConglomerateDescriptors
(UUID conglomerateUUID) Gets array of conglomerate descriptors for the given table and conglomerate UUID.Gets the constraint descriptor listprivate static Context
getContextOrNull
(String contextID) Privileged lookup of a Context.Get an object which can be written to disk and which, when read from disk, will find or reconstruct this in-memory Dependable.Each descriptor must identify itself with its type; i.e index, check constraint whatever.Gets an ExecRow for rows stored in the table this describes.Gets the list of columns defined by generation clauses.long
Gets the id for the heap conglomerate of the table.Gets an object which lists out all the index row generators on a table together with their conglomerate ids.Returns the update criteria telling why the statistics are considered stale.char
Gets the lock granularity for the table.int
Gets the highest column id in the table.getName()
Gets the name of the table.int
Gets the number of columns in the table.Get the provider's UUIDReturn the name of this Provider.Gets the primary key, may return null if no primary keyGets the full, qualified name of the table.int
getQualifiedNumberOfIndexes
(int minColCount, boolean nonUniqeTrumpsColCount) Returns the number of indexes matching the criteria.Get the referenced column map of the table.Gets the SchemaDescriptor for this TableDescriptor.Gets the name of the schema the table lives in.Returns a list of statistics for this table.int
Gets an identifier telling what type of table this is (base table, declared global temporary table, view, etc.)int
Gets the number of indexes on the table, including the backing indexes.Gets the trigger descriptor listgetUUID()
Gets the UUID of the table.Gets the view descriptor for this TableDescriptor.boolean
Gets the on commit behavior for the declared global temporary table.boolean
Gets the on rollback behavior for the declared global temporary table.boolean
Is this provider persistent?boolean
Is this descriptor represents a synonym?boolean
isValid()
Check that all of the dependent's dependencies are valid.Given a list of columns in the table, construct a bit map of those columns' ids.void
makeInvalid
(int action, LanguageConnectionContext lcc) Mark the dependent as invalid (due to at least one of its dependencies being invalid).static String
makeSequenceName
(UUID tableID) Make the name of an identity sequence generator from a table IDvoid
markForIndexStatsUpdate
(long tableRowCountEstimate) Marks the cardinality statistics for the indexes associated with this table for update if they are considered stale, or for creation if they don't exist, and if it is considered useful to update/create them.void
prepareToInvalidate
(Provider p, int action, LanguageConnectionContext lcc) Prepare to mark the dependent as invalid (due to at least one of its dependencies being invalid).private FormatableBitSet
private void
referencedColumnMapPut
(FormatableBitSet newReferencedColumnMap) void
Remove this descriptorvoid
Remove this descriptor.void
Sets the heapConglomNumber to -1 for temporary table since the table was dropped and recreated at the commit time and hence its conglomerate id has changed.double
selectivityForConglomerate
(ConglomerateDescriptor cd, int numKeys) For this conglomerate (index), return the selectivity of the first numKeys.void
Sets the constraint descriptor listvoid
setLockGranularity
(char lockGranularity) Sets the lock granularity for the table to the specified value.void
setReferencedColumnMap
(FormatableBitSet referencedColumnMap) Set the referenced column map of the table.void
setTableName
(String newTableName) Sets the the table name in case of rename table.void
Sets the trigger descriptor listvoid
Sets the UUID of the tablevoid
setViewDescriptor
(ViewDescriptor viewDescriptor) Set (cache) the view descriptor for this TableDescriptorboolean
Are there statistics for this particular conglomerate.boolean
Does the table have an auto-increment column or not?boolean
tableNameEquals
(String otherTableName, String otherSchemaName) Compare the tables descriptors based on the names.toString()
Prints the contents of the TableDescriptorMethods inherited from class org.apache.derby.iapi.sql.dictionary.TupleDescriptor
getColumnDependableFinder, getDataDictionary, getDependableFinder, setDataDictionary
-
Field Details
-
BASE_TABLE_TYPE
public static final int BASE_TABLE_TYPE- See Also:
-
SYSTEM_TABLE_TYPE
public static final int SYSTEM_TABLE_TYPE- See Also:
-
VIEW_TYPE
public static final int VIEW_TYPE- See Also:
-
GLOBAL_TEMPORARY_TABLE_TYPE
public static final int GLOBAL_TEMPORARY_TABLE_TYPE- See Also:
-
SYNONYM_TYPE
public static final int SYNONYM_TYPE- See Also:
-
VTI_TYPE
public static final int VTI_TYPE- See Also:
-
ROW_LOCK_GRANULARITY
public static final char ROW_LOCK_GRANULARITY- See Also:
-
TABLE_LOCK_GRANULARITY
public static final char TABLE_LOCK_GRANULARITY- See Also:
-
DEFAULT_LOCK_GRANULARITY
public static final char DEFAULT_LOCK_GRANULARITY- See Also:
-
ISTATS_CREATE_THRESHOLD
public static final int ISTATS_CREATE_THRESHOLD -
ISTATS_ABSDIFF_THRESHOLD
public static final int ISTATS_ABSDIFF_THRESHOLD -
ISTATS_LNDIFF_THRESHOLD
public static final double ISTATS_LNDIFF_THRESHOLD -
lockGranularity
private char lockGranularity -
onCommitDeleteRows
private boolean onCommitDeleteRows -
onRollbackDeleteRows
private boolean onRollbackDeleteRows -
indexStatsUpToDate
private boolean indexStatsUpToDate -
indexStatsUpdateReason
-
schema
SchemaDescriptor schema -
tableName
String tableName -
oid
UUID oid -
tableType
int tableType -
heapConglomNumber
private volatile long heapConglomNumberThe id of the heap conglomerate for the table described by this instance. The value -1 means it's uninitialized, in which case it will be initialized lazily when
getHeapConglomerateId()
is called.It is declared volatile to ensure that concurrent callers of
getHeapConglomerateId()
whileheapConglomNumber
is uninitialized, will either see the value -1 or the fully initialized conglomerate number, and never see a partially initialized value (as was the case in DERBY-5358 because reads/writes of a long field are not guaranteed to be atomic unless the field is declared volatile). -
columnDescriptorList
ColumnDescriptorList columnDescriptorList -
conglomerateDescriptorList
ConglomerateDescriptorList conglomerateDescriptorList -
constraintDescriptorList
ConstraintDescriptorList constraintDescriptorList -
triggerDescriptorList
-
viewDescriptor
ViewDescriptor viewDescriptor -
statisticsDescriptorList
A list of statistics pertaining to this table--
-
-
Constructor Details
-
TableDescriptor
public TableDescriptor(DataDictionary dataDictionary, String tableName, SchemaDescriptor schema, int tableType, boolean onCommitDeleteRows, boolean onRollbackDeleteRows) Constructor for a TableDescriptor (this is for a temporary table).- Parameters:
dataDictionary
- The data dictionary that this descriptor lives intableName
- The name of the temporary tableschema
- The schema descriptor for this table.tableType
- An integer identifier for the type of the table : declared global temporary tableonCommitDeleteRows
- If true, on commit delete rows else on commit preserve rows of temporary table.onRollbackDeleteRows
- If true, on rollback, delete rows from temp tables which were logically modified. true is the only supported value
-
TableDescriptor
public TableDescriptor(DataDictionary dataDictionary, String tableName, SchemaDescriptor schema, int tableType, char lockGranularity) Constructor for a TableDescriptor.- Parameters:
dataDictionary
- The data dictionary that this descriptor lives intableName
- The name of the tableschema
- The schema descriptor for this table.tableType
- An integer identifier for the type of the table (base table, view, etc.)lockGranularity
- The lock granularity.
-
-
Method Details
-
referencedColumnMapGet
-
referencedColumnMapPut
-
getSchemaName
Gets the name of the schema the table lives in.- Returns:
- A String containing the name of the schema the table lives in.
-
getSchemaDescriptor
Gets the SchemaDescriptor for this TableDescriptor.- Specified by:
getSchemaDescriptor
in classUniqueSQLObjectDescriptor
- Returns:
- SchemaDescriptor The SchemaDescriptor.
-
getName
Gets the name of the table.- Specified by:
getName
in classUniqueSQLObjectDescriptor
- Returns:
- A String containing the name of the table.
-
setTableName
Sets the the table name in case of rename table. This is used only by rename table- Parameters:
newTableName
- The new table name.
-
getQualifiedName
Gets the full, qualified name of the table.- Returns:
- A String containing the name of the table.
-
getUUID
Gets the UUID of the table.- Specified by:
getUUID
in classUniqueTupleDescriptor
- Returns:
- The UUID of the table.
-
getTableType
public int getTableType()Gets an identifier telling what type of table this is (base table, declared global temporary table, view, etc.)- Returns:
- An identifier telling what type of table this is.
-
getHeapConglomerateId
Gets the id for the heap conglomerate of the table. There may also be keyed conglomerates, these are stored separately in the conglomerates table.- Returns:
- the id of the heap conglomerate for the table.
- Throws:
StandardException
- Thrown on error
-
getNumberOfColumns
public int getNumberOfColumns()Gets the number of columns in the table.- Returns:
- the number of columns in the table.
-
getReferencedColumnMap
Get the referenced column map of the table.- Returns:
- the referencedColumnMap of the table.
-
setReferencedColumnMap
Set the referenced column map of the table.- Parameters:
referencedColumnMap
- FormatableBitSet of referenced columns.
-
makeColumnMap
Given a list of columns in the table, construct a bit map of those columns' ids.- Parameters:
cdl
- list of columns whose positions we want to record in the bit map
-
getMaxColumnID
Gets the highest column id in the table. For now this is the same as the number of columns. However, in the future, after we implement ALTER TABLE DROP COLUMN, this correspondence won't hold any longer.- Returns:
- the highest column ID in the table
- Throws:
StandardException
- Thrown on error
-
setUUID
Sets the UUID of the table- Parameters:
oid
- The UUID of the table to be set in the descriptor
-
getLockGranularity
public char getLockGranularity()Gets the lock granularity for the table.- Returns:
- A char representing the lock granularity for the table.
-
setLockGranularity
public void setLockGranularity(char lockGranularity) Sets the lock granularity for the table to the specified value.- Parameters:
lockGranularity
- The new lockGranularity.
-
isOnRollbackDeleteRows
public boolean isOnRollbackDeleteRows()Gets the on rollback behavior for the declared global temporary table.- Returns:
- A boolean representing the on rollback behavior for the declared global temporary table.
-
isOnCommitDeleteRows
public boolean isOnCommitDeleteRows()Gets the on commit behavior for the declared global temporary table.- Returns:
- A boolean representing the on commit behavior for the declared global temporary table.
-
resetHeapConglomNumber
public void resetHeapConglomNumber()Sets the heapConglomNumber to -1 for temporary table since the table was dropped and recreated at the commit time and hence its conglomerate id has changed. This is used for temporary table descriptors only -
getEmptyExecRow
Gets an ExecRow for rows stored in the table this describes.- Returns:
- the row.
- Throws:
StandardException
- Thrown on failure
-
getColumnCollationIds
Return an array of collation ids for this table.Return an array of collation ids, one for each column in the columnDescriptorList. This is useful for passing collation id info down to store, for instance in createConglomerate(). This is only expected to get called during ddl, so object allocation is ok.
- Throws:
StandardException
- Standard exception policy.
-
getConglomerateDescriptorList
Gets the conglomerate descriptor list- Returns:
- The conglomerate descriptor list for this table descriptor
-
getViewDescriptor
Gets the view descriptor for this TableDescriptor.- Returns:
- ViewDescriptor The ViewDescriptor, if any.
-
setViewDescriptor
Set (cache) the view descriptor for this TableDescriptor- Parameters:
viewDescriptor
- The view descriptor to cache.
-
isPersistent
public boolean isPersistent()Is this provider persistent? A stored dependency will be required if both the dependent and provider are persistent.- Specified by:
isPersistent
in interfaceDependable
- Overrides:
isPersistent
in classTupleDescriptor
- Returns:
- boolean Whether or not this provider is persistent.
-
isSynonymDescriptor
public boolean isSynonymDescriptor()Is this descriptor represents a synonym?- Returns:
- boolean Whether or not this represents a synonym
-
getTotalNumberOfIndexes
Gets the number of indexes on the table, including the backing indexes.- Returns:
- the number of columns in the table.
- Throws:
StandardException
- See Also:
-
getQualifiedNumberOfIndexes
public int getQualifiedNumberOfIndexes(int minColCount, boolean nonUniqeTrumpsColCount) Returns the number of indexes matching the criteria.- Parameters:
minColCount
- the minimum number of ordered columns in the indexes we want to countnonUniqeTrumpsColCount
- iftrue
a non-unique index will be included in the count even if it has less thanminColCount
ordered columns- Returns:
- Number of matching indexes.
- See Also:
-
getAllRelevantTriggers
public void getAllRelevantTriggers(int statementType, int[] changedColumnIds, TriggerDescriptorList relevantTriggers) throws StandardException Builds a list of all triggers which are relevant to a given statement type, given a list of updated columns.- Parameters:
statementType
- defined in StatementTypechangedColumnIds
- array of changed columnsrelevantTriggers
- IN/OUT. Passed in as an empty list. Filled in as we go.- Throws:
StandardException
- Thrown on error
-
getAllRelevantConstraints
public void getAllRelevantConstraints(int statementType, int[] changedColumnIds, boolean[] needsDeferredProcessing, ConstraintDescriptorList relevantConstraints) throws StandardException Gets all of the relevant constraints for a statement, given its statement type and its list of updated columns.- Parameters:
statementType
- As defined in StatementType.changedColumnIds
- If null, all columns being changed, otherwise array of 1-based column ids for columns being changedneedsDeferredProcessing
- IN/OUT. true if the statement already needs deferred processing. set while evaluating this routine if a trigger or constraint requires deferred processingrelevantConstraints
- IN/OUT. Empty list is passed in. We hang constraints on it as we go.- Throws:
StandardException
- Thrown on error
-
getDependableFinder
Description copied from interface:Dependable
Get an object which can be written to disk and which, when read from disk, will find or reconstruct this in-memory Dependable.- Specified by:
getDependableFinder
in interfaceDependable
- Returns:
- the stored form of this provider
- See Also:
-
getObjectName
Return the name of this Provider. (Useful for errors.)- Specified by:
getObjectName
in interfaceDependable
- Returns:
- String The name of this provider.
-
getObjectID
Get the provider's UUID- Specified by:
getObjectID
in interfaceDependable
- Returns:
- String The provider's UUID
-
getClassType
Get the provider's type.- Specified by:
getClassType
in interfaceDependable
- Returns:
- String The provider's type.
-
toString
Prints the contents of the TableDescriptor -
getColumnDescriptorList
Gets the column descriptor list- Returns:
- The column descriptor list for this table descriptor
-
getGeneratedColumns
Gets the list of columns defined by generation clauses. -
getColumnIDs
Turn an array of column names into the corresponding 1-based column positions. -
getConstraintDescriptorList
Gets the constraint descriptor list- Returns:
- The constraint descriptor list for this table descriptor
- Throws:
StandardException
- Thrown on failure
-
setConstraintDescriptorList
Sets the constraint descriptor list- Parameters:
newCDL
- The new constraint descriptor list for this table descriptor
-
emptyConstraintDescriptorList
Empty the constraint descriptor list- Throws:
StandardException
- Thrown on failure
-
getPrimaryKey
Gets the primary key, may return null if no primary key- Returns:
- The priamry key or null
- Throws:
StandardException
- Thrown on failure
-
getTriggerDescriptorList
Gets the trigger descriptor list- Returns:
- The trigger descriptor list for this table descriptor
- Throws:
StandardException
- Thrown on failure
-
setTriggerDescriptorList
Sets the trigger descriptor list- Parameters:
newCDL
- The new trigger descriptor list for this table descriptor
-
emptyTriggerDescriptorList
Empty the trigger descriptor list- Throws:
StandardException
- Thrown on failure
-
tableNameEquals
Compare the tables descriptors based on the names. Null schema names match.- Parameters:
otherTableName
- the other table nameotherSchemaName
- the other schema name- Returns:
- boolean Whether or not the 2 TableNames are equal.
-
removeConglomerateDescriptor
Remove this descriptor- Parameters:
cd
- The conglomerate descriptor- Throws:
StandardException
- on error
-
removeConstraintDescriptor
Remove this descriptor. Warning, removes by using object reference, not uuid.- Parameters:
cd
- constraint descriptor- Throws:
StandardException
- on error
-
getColumnDescriptor
Get the descriptor for a column in the table, either by the column name or by its ordinal position (column number). Returns NULL for columns that do not exist.- Parameters:
columnName
- A String containing the name of the column- Returns:
- A ColumnDescriptor describing the column
-
getColumnDescriptor
- Parameters:
columnNumber
- The ordinal (1-based) position of the column in the table- Returns:
- A ColumnDescriptor describing the column
-
getConglomerateDescriptors
Gets a ConglomerateDescriptor[] to loop through all the conglomerate descriptors for the table.- Returns:
- A ConglomerateDescriptor[] for looping through the table's conglomerates
-
getConglomerateDescriptor
public ConglomerateDescriptor getConglomerateDescriptor(long conglomerateNumber) throws StandardException Gets a conglomerate descriptor for the given table and conglomerate number.- Parameters:
conglomerateNumber
- The conglomerate number we're interested in- Returns:
- A ConglomerateDescriptor describing the requested conglomerate. Returns NULL if no such conglomerate.
- Throws:
StandardException
- Thrown on failure
-
getConglomerateDescriptors
public ConglomerateDescriptor[] getConglomerateDescriptors(long conglomerateNumber) throws StandardException Gets array of conglomerate descriptors for the given table and conglomerate number. More than one descriptors if duplicate indexes share one conglomerate.- Parameters:
conglomerateNumber
- The conglomerate number we're interested in- Returns:
- Array of ConglomerateDescriptors with the requested conglomerate number. Returns size 0 array if no such conglomerate.
- Throws:
StandardException
- Thrown on failure
-
getConglomerateDescriptor
public ConglomerateDescriptor getConglomerateDescriptor(UUID conglomerateUUID) throws StandardException Gets a conglomerate descriptor for the given table and conglomerate UUID String.- Parameters:
conglomerateUUID
- The UUID for the conglomerate we're interested in- Returns:
- A ConglomerateDescriptor describing the requested conglomerate. Returns NULL if no such conglomerate.
- Throws:
StandardException
- Thrown on failure
-
getConglomerateDescriptors
public ConglomerateDescriptor[] getConglomerateDescriptors(UUID conglomerateUUID) throws StandardException Gets array of conglomerate descriptors for the given table and conglomerate UUID. More than one descriptors if duplicate indexes share one conglomerate.- Parameters:
conglomerateUUID
- The conglomerate UUID we're interested in- Returns:
- Array of ConglomerateDescriptors with the requested conglomerate UUID. Returns size 0 array if no such conglomerate.
- Throws:
StandardException
- Thrown on failure
-
getIndexLister
Gets an object which lists out all the index row generators on a table together with their conglomerate ids.- Returns:
- An object to list out the index row generators.
- Throws:
StandardException
- Thrown on failure
-
tableHasAutoincrement
public boolean tableHasAutoincrement()Does the table have an auto-increment column or not?- Returns:
- TRUE if the table has at least one auto-increment column, false otherwise
-
getColumnNamesArray
Gets an array of column names.- Returns:
- An array, filled with the column names in the table.
-
getAutoincIncrementArray
public long[] getAutoincIncrementArray()gets an array of increment values for autoincrement columns in the target table. If column is not an autoincrement column, then increment value is 0. If table has no autoincrement columns, returns NULL.- Returns:
- array containing the increment values of autoincrement columns.
-
getStatistics
Returns a list of statistics for this table.- Throws:
StandardException
-
markForIndexStatsUpdate
Marks the cardinality statistics for the indexes associated with this table for update if they are considered stale, or for creation if they don't exist, and if it is considered useful to update/create them.- Parameters:
tableRowCountEstimate
- row count estimate for this table- Throws:
StandardException
- if obtaining index statistics fails
-
getAndClearIndexStatsIsUpToDate
public boolean getAndClearIndexStatsIsUpToDate()Tells if the index statistics for the indexes associated with this table are consideres up-to-date, and clears the state.- Returns:
true
if the statistics are considered up-to-date,false
if not.
-
getIndexStatsUpdateReason
Returns the update criteria telling why the statistics are considered stale.This method is used for debugging.
- Returns:
- A string describing the update criteria that were met.
-
statisticsExist
Are there statistics for this particular conglomerate.- Parameters:
cd
- Conglomerate/Index for which we want to check if statistics exist. cd can be null in which case user wants to know if there are any statistics at all on the table.- Throws:
StandardException
-
selectivityForConglomerate
public double selectivityForConglomerate(ConglomerateDescriptor cd, int numKeys) throws StandardException For this conglomerate (index), return the selectivity of the first numKeys. This basically returns the reciprocal of the number of unique values in the leading numKey columns of the index. It is assumed that statistics exist for the conglomerate if this function is called. However, no locks are held to prevent the statistics from being dropped, so the method also handles the case of missing statistics by using a heuristic to estimate the selectivity.- Parameters:
cd
- ConglomerateDescriptor (Index) whose cardinality we are interested in.numKeys
- Number of leading columns of the index for which cardinality is desired.- Throws:
StandardException
-
getDescriptorName
- Overrides:
getDescriptorName
in classTupleDescriptor
- See Also:
-
getDescriptorType
Description copied from class:TupleDescriptor
Each descriptor must identify itself with its type; i.e index, check constraint whatever.- Overrides:
getDescriptorType
in classTupleDescriptor
- See Also:
-
isValid
public boolean isValid()Check that all of the dependent's dependencies are valid. -
prepareToInvalidate
public void prepareToInvalidate(Provider p, int action, LanguageConnectionContext lcc) throws StandardException Prepare to mark the dependent as invalid (due to at least one of its dependencies being invalid).- Specified by:
prepareToInvalidate
in interfaceDependent
- Parameters:
p
- the provideraction
- The action causing the invalidationlcc
- The LanguageConnectionContext- Throws:
StandardException
- thrown if unable to make it invalid
-
makeInvalid
Mark the dependent as invalid (due to at least one of its dependencies being invalid). Always an error for a table -- should never have gotten here.- Specified by:
makeInvalid
in interfaceDependent
- Parameters:
action
- The action causing the invalidationlcc
- The LanguageConnectionContext- Throws:
StandardException
- thrown if called in sanity mode
-
makeSequenceName
Make the name of an identity sequence generator from a table ID -
getContextOrNull
Privileged lookup of a Context. Must be private so that user code can't call this entry point.
-