Java Doc for Optimizable.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » iapi » sql » compile » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » db derby 10.2 » org.apache.derby.iapi.sql.compile 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


org.apache.derby.iapi.sql.compile.Optimizable

All known Subclasses:   org.apache.derby.impl.sql.compile.FromTable,
Optimizable
public interface Optimizable (Code)
Optimizable provides services for optimizing a table in a query.




Method Summary
 booleanconsiderSortAvoidancePath()
     Check whether this optimizable's sort avoidance path should be considered.
public  intconvertAbsoluteToRelativeColumnPosition(int absolutePosition)
     Convert an absolute to a relative 0-based column position. This is useful when generating qualifiers for partial rows from the store.
Parameters:
  absolutePosition - The absolute 0-based column position for the column.
 CostEstimateestimateCost(OptimizablePredicateList predList, ConglomerateDescriptor cd, CostEstimate outerCost, Optimizer optimizer, RowOrdering rowOrdering)
     Estimate the cost of scanning this Optimizable using the given predicate list with the given conglomerate.
public  booleanfeasibleJoinStrategy(OptimizablePredicateList predList, Optimizer optimizer)
    
public  booleanforUpdate()
    
public  StringgetBaseTableName()
     Get the table name of this Optimizable.
 AccessPathgetBestAccessPath()
     Get the best access path for this Optimizable.
 AccessPathgetBestSortAvoidancePath()
     Get the best sort-avoidance path for this Optimizable.
 AccessPathgetCurrentAccessPath()
    
public  DataDictionarygetDataDictionary()
     Get the DataDictionary from this Optimizable.
public  StringgetName()
    
public  intgetNumColumnsReturned()
     Get the number of the number of columns returned by this Optimizable.
public  PropertiesgetProperties()
     Get the Properties list, if any, associated with this optimizable.
 JBitSetgetReferencedTableMap()
     Get the map of referenced tables for this Optimizable.
 intgetResultSetNumber()
    
 TableDescriptorgetTableDescriptor()
     Get the table descriptor for this table (if any).
 intgetTableNumber()
    
 AccessPathgetTrulyTheBestAccessPath()
     Get the best access path overall for this Optimizable.
 booleanhasTableNumber()
    
public  int[]hashKeyColumns()
    
public  voidinitAccessPaths(Optimizer optimizer)
     Init the access paths for this optimizable.
public  intinitialCapacity()
    
 booleanisBaseTable()
    
public  booleanisCoveringIndex(ConglomerateDescriptor cd)
     Return whether or not this is a covering index.
 booleanisMaterializable()
    
public  booleanisOneRowScan()
    
public  booleanisTargetTable()
    
public  booleanlegalJoinOrder(JBitSet assignedTableMap)
     Can this Optimizable appear at the current location in the join order.
public  floatloadFactor()
    
public  intmaxCapacity(JoinStrategy joinStrategy, int maxMemoryPerTable)
     Return the maximum capacity of the hash table, for hash join strategy
Parameters:
  maxMemoryPerTable - The maximum number of bytes to be used.
public  booleanmemoryUsageOK(double rowCount, int maxMemoryPerTable)
    
 OptimizablemodifyAccessPath(JBitSet outerTables)
     Modify the access path for this Optimizable, as necessary.
 booleannextAccessPath(Optimizer optimizer, OptimizablePredicateList predList, RowOrdering rowOrdering)
     Choose the next access path to evaluate for this Optimizable.
Parameters:
  optimizer - Optimizer to use.
Parameters:
  predList - The predicate list for this optimizable.The optimizer always passes null, and it is upto the optimizable object to pass along itsown predicate list, if appropriate, when delegatingthis method.
Parameters:
  rowOrdering - The row ordering for all the outer tables inthe join order.
 CostEstimateoptimizeIt(Optimizer optimizer, OptimizablePredicateList predList, CostEstimate outerCost, RowOrdering rowOrdering)
     Choose the best access path for this Optimizable.
Parameters:
  optimizer - Optimizer to use.
Parameters:
  predList - The predicate list to optimize against
Parameters:
  outerCost - The CostEstimate for the outer tables in the join order,telling how many times this Optimizable will be scanned.
Parameters:
  rowOrdering - The row ordering for all the tables in thejoin order, including this one.
 voidpullOptPredicates(OptimizablePredicateList optimizablePredicates)
     Pull all the OptimizablePredicates from this Optimizable and put them in the given OptimizablePredicateList.
 booleanpushOptPredicate(OptimizablePredicate optimizablePredicate)
     Push an OptimizablePredicate down, if this node accepts it.
Parameters:
  optimizablePredicate - OptimizablePredicate to push down.
public  voidrememberAsBest(int planType, Optimizer optimizer)
     Remember the current access path as the best one (so far).
 voidrememberJoinStrategyAsBest(AccessPath ap)
     Remember the current join strategy as the best one so far in this join order.
 voidrememberSortAvoidancePath()
     Mark this optimizable so that its sort avoidance path will be considered.
public  voidsetHashKeyColumns(int[] columnNumbers)
    
public  voidsetProperties(Properties tableProperties)
     Set the Properties list for this optimizalbe.
public  voidstartOptimizing(Optimizer optimizer, RowOrdering rowOrdering)
     Begin the optimization process for this Optimizable.
 booleansupportsMultipleInstantiations()
    
public  doubleuniqueJoin(OptimizablePredicateList predList)
     Does this optimizable have a uniqueness condition on the given predicate list, and if so, how many unique keys will be returned per scan.
public  voidupdateBestPlanMap(short action, Object planKey)
     When remembering "truly the best" access path for an Optimizable, we have to keep track of which OptimizerImpl the "truly the best" access is for.
public  voidverifyProperties(DataDictionary dDictionary)
    



Method Detail
considerSortAvoidancePath
boolean considerSortAvoidancePath()(Code)
Check whether this optimizable's sort avoidance path should be considered.



convertAbsoluteToRelativeColumnPosition
public int convertAbsoluteToRelativeColumnPosition(int absolutePosition)(Code)
Convert an absolute to a relative 0-based column position. This is useful when generating qualifiers for partial rows from the store.
Parameters:
  absolutePosition - The absolute 0-based column position for the column. The relative 0-based column position for the column.



estimateCost
CostEstimate estimateCost(OptimizablePredicateList predList, ConglomerateDescriptor cd, CostEstimate outerCost, Optimizer optimizer, RowOrdering rowOrdering) throws StandardException(Code)
Estimate the cost of scanning this Optimizable using the given predicate list with the given conglomerate. It is assumed that the predicate list has already been classified. This cost estimate is just for one scan, not for the life of the query.
See Also:   OptimizablePredicateList.classify
Parameters:
  predList - The predicate list to optimize against
Parameters:
  cd - The conglomerate descriptor to get the cost of
Parameters:
  outerCost - The estimated cost of the part of the plan outerto this optimizable.
Parameters:
  optimizer - The optimizer to use to help estimate the cost
Parameters:
  rowOrdering - The row ordering for all the tables in thejoin order, including this one. The estimated cost of doing the scan
exception:
  StandardException - Thrown on error



feasibleJoinStrategy
public boolean feasibleJoinStrategy(OptimizablePredicateList predList, Optimizer optimizer) throws StandardException(Code)
Is the current proposed join strategy for this optimizable feasible given the predicate list?
Parameters:
  predList - The predicate list that has been pushed down tothis optimizable
Parameters:
  optimizer - The optimizer to use. true means feasible
exception:
  StandardException - Thrown on error



forUpdate
public boolean forUpdate()(Code)
Return true if this is the target table of an update



getBaseTableName
public String getBaseTableName()(Code)
Get the table name of this Optimizable. Only base tables have table names (by the time we use this method, all views will have been resolved).



getBestAccessPath
AccessPath getBestAccessPath()(Code)
Get the best access path for this Optimizable.



getBestSortAvoidancePath
AccessPath getBestSortAvoidancePath()(Code)
Get the best sort-avoidance path for this Optimizable.



getCurrentAccessPath
AccessPath getCurrentAccessPath()(Code)
Get the current access path under consideration for this Optimizable



getDataDictionary
public DataDictionary getDataDictionary() throws StandardException(Code)
Get the DataDictionary from this Optimizable. This is useful for code generation because we need to get the constraint name if scanning a back index so that RunTimeStatistics can display the correct info. The DataDictionary to use.
exception:
  StandardException - Thrown on error



getName
public String getName() throws StandardException(Code)
Get the (exposed) name of this Optimizable The name of this Optimizable.
exception:
  StandardException - Thrown on error



getNumColumnsReturned
public int getNumColumnsReturned()(Code)
Get the number of the number of columns returned by this Optimizable. The number of the number of columns returned by this Optimizable.



getProperties
public Properties getProperties()(Code)
Get the Properties list, if any, associated with this optimizable. The Properties list, if any, associated with this optimizable.



getReferencedTableMap
JBitSet getReferencedTableMap()(Code)
Get the map of referenced tables for this Optimizable. JBitSet Referenced table map.



getResultSetNumber
int getResultSetNumber()(Code)
Get this Optimizable's result set number



getTableDescriptor
TableDescriptor getTableDescriptor()(Code)
Get the table descriptor for this table (if any). Only base tables have table descriptors - for the rest of the optimizables, this method returns null.



getTableNumber
int getTableNumber()(Code)
Get this Optimizable's table number



getTrulyTheBestAccessPath
AccessPath getTrulyTheBestAccessPath()(Code)
Get the best access path overall for this Optimizable.



hasTableNumber
boolean hasTableNumber()(Code)
Return true if this Optimizable has a table number



hashKeyColumns
public int[] hashKeyColumns()(Code)
Return the hash key column numbers, for hash join strategy



initAccessPaths
public void initAccessPaths(Optimizer optimizer)(Code)
Init the access paths for this optimizable.
Parameters:
  optimizer - The optimizer being used.



initialCapacity
public int initialCapacity()(Code)
Return the initial capacity of the hash table, for hash join strategy



isBaseTable
boolean isBaseTable()(Code)
Tell whether this Optimizable represents a base table



isCoveringIndex
public boolean isCoveringIndex(ConglomerateDescriptor cd) throws StandardException(Code)
Return whether or not this is a covering index. We expect to call this during generation, after access path selection is complete.
Parameters:
  cd - ConglomerateDesriptor for index to consider boolean Whether or not this is a covering index.
exception:
  StandardException - Thrown on error



isMaterializable
boolean isMaterializable() throws StandardException(Code)
Tell whether this Optimizable is materializable
exception:
  StandardException - Thrown on error



isOneRowScan
public boolean isOneRowScan() throws StandardException(Code)
Will the optimizable return at most 1 row per scan? Whether or not the optimizable will return at most 1 row per scan?
exception:
  StandardException - Thrown on error



isTargetTable
public boolean isTargetTable()(Code)
Is the optimizable the target table of an update or delete? Whether or not the optimizable the target table of an update or delete.



legalJoinOrder
public boolean legalJoinOrder(JBitSet assignedTableMap)(Code)
Can this Optimizable appear at the current location in the join order. In other words, have the Optimizable's dependencies been satisfied?
Parameters:
  assignedTableMap - The tables that have been placed so far in the join order. Where or not this Optimizable can appear at the current location in the join order.



loadFactor
public float loadFactor()(Code)
Return the load factor of the hash table, for hash join strategy



maxCapacity
public int maxCapacity(JoinStrategy joinStrategy, int maxMemoryPerTable) throws StandardException(Code)
Return the maximum capacity of the hash table, for hash join strategy
Parameters:
  maxMemoryPerTable - The maximum number of bytes to be used. Ignored if the user has set a maximumnumber of rows for the Optimizable.
exception:
  StandardException - Standard error policy



memoryUsageOK
public boolean memoryUsageOK(double rowCount, int maxMemoryPerTable) throws StandardException(Code)

Parameters:
  rowCount -
Parameters:
  maxMemoryPerTable - true if the memory usage of the proposed access path is OK, false if not.
exception:
  StandardException - standard error policy



modifyAccessPath
Optimizable modifyAccessPath(JBitSet outerTables) throws StandardException(Code)
Modify the access path for this Optimizable, as necessary. This includes things like adding a result set to translate from index rows to base rows
Parameters:
  outerTables - Bit map of the tables that are outer to this onein the join order. The (potentially new) Optimizable at the top of the tree.
exception:
  StandardException - Thrown on error



nextAccessPath
boolean nextAccessPath(Optimizer optimizer, OptimizablePredicateList predList, RowOrdering rowOrdering) throws StandardException(Code)
Choose the next access path to evaluate for this Optimizable.
Parameters:
  optimizer - Optimizer to use.
Parameters:
  predList - The predicate list for this optimizable.The optimizer always passes null, and it is upto the optimizable object to pass along itsown predicate list, if appropriate, when delegatingthis method.
Parameters:
  rowOrdering - The row ordering for all the outer tables inthe join order. This method will add the orderingof the next access path to the given RowOrdering. true means another access path was chosen, false meansno more access paths to evaluate.
exception:
  StandardException - Thrown on error



optimizeIt
CostEstimate optimizeIt(Optimizer optimizer, OptimizablePredicateList predList, CostEstimate outerCost, RowOrdering rowOrdering) throws StandardException(Code)
Choose the best access path for this Optimizable.
Parameters:
  optimizer - Optimizer to use.
Parameters:
  predList - The predicate list to optimize against
Parameters:
  outerCost - The CostEstimate for the outer tables in the join order,telling how many times this Optimizable will be scanned.
Parameters:
  rowOrdering - The row ordering for all the tables in thejoin order, including this one. The optimizer's estimated cost of the best access path.
exception:
  StandardException - Thrown on error



pullOptPredicates
void pullOptPredicates(OptimizablePredicateList optimizablePredicates) throws StandardException(Code)
Pull all the OptimizablePredicates from this Optimizable and put them in the given OptimizablePredicateList.
Parameters:
  optimizablePredicates - The list to put the pulled predicatesin.
exception:
  StandardException - Thrown on error



pushOptPredicate
boolean pushOptPredicate(OptimizablePredicate optimizablePredicate) throws StandardException(Code)
Push an OptimizablePredicate down, if this node accepts it.
Parameters:
  optimizablePredicate - OptimizablePredicate to push down. Whether or not the predicate was pushed down.
exception:
  StandardException - Thrown on error



rememberAsBest
public void rememberAsBest(int planType, Optimizer optimizer) throws StandardException(Code)
Remember the current access path as the best one (so far).
Parameters:
  planType - The type of plan (one of Optimizer.NORMAL_PLANor Optimizer.SORT_AVOIDANCE_PLAN)
Parameters:
  optimizer - The OptimizerImpl that is telling this Optimizableto remember its current path as "truly the best".
exception:
  StandardException - thrown on error.



rememberJoinStrategyAsBest
void rememberJoinStrategyAsBest(AccessPath ap)(Code)
Remember the current join strategy as the best one so far in this join order.



rememberSortAvoidancePath
void rememberSortAvoidancePath()(Code)
Mark this optimizable so that its sort avoidance path will be considered.



setHashKeyColumns
public void setHashKeyColumns(int[] columnNumbers)(Code)
Set the hash key column numbers, for hash join strategy



setProperties
public void setProperties(Properties tableProperties)(Code)
Set the Properties list for this optimizalbe.
Parameters:
  tableProperties - The Properties list for this optimizable.



startOptimizing
public void startOptimizing(Optimizer optimizer, RowOrdering rowOrdering)(Code)
Begin the optimization process for this Optimizable. This can be called many times for an Optimizable while optimizing a query - it will typically be called every time the Optimizable is placed in a potential join order.



supportsMultipleInstantiations
boolean supportsMultipleInstantiations()(Code)
Tell whether this Optimizable can be instantiated multiple times



uniqueJoin
public double uniqueJoin(OptimizablePredicateList predList) throws StandardException(Code)
Does this optimizable have a uniqueness condition on the given predicate list, and if so, how many unique keys will be returned per scan.
Parameters:
  predList - The predicate list to check <= 0 means there is no uniqueness condition> 0 means there is a uniqueness condition,and the return value is the number of rows per scan.
exception:
  StandardException - Thrown on error



updateBestPlanMap
public void updateBestPlanMap(short action, Object planKey) throws StandardException(Code)
When remembering "truly the best" access path for an Optimizable, we have to keep track of which OptimizerImpl the "truly the best" access is for. In most queries there will only be one OptimizerImpl in question, but in cases where there are nested subqueries, there will be one OptimizerImpl for every level of nesting, and each OptimizerImpl might have its own idea of what this Optimizable's "truly the best path" access path really is. In addition, there could be Optimizables above this Optimizable that might need to override the best path chosen during optimization. So whenever we save a "truly the best" path, we take note of which Optimizer/Optimizable told us to do so. Then as each level of subquery finishes optimization, the corresponding OptimizerImpl/Optimizable can load its preferred access path into this Optimizable's trulyTheBestAccessPath field and pass it up the tree, until eventually the outer-most OptimizerImpl can choose to either use the best path that it received from below (by calling "rememberAsBest()") or else use the path that it found to be "best" for itself. This method is what allows us to keep track of which OptimizerImpl or Optimizable saved which "best plan", and allows us to load the appropriate plans after each round of optimization.
Parameters:
  action - Indicates whether we're adding, loading, or removinga best plan for the OptimizerImpl/Optimizable.
Parameters:
  planKey - Object to use as the map key when adding/looking upa plan. If it is an instance of OptimizerImpl then it correspondsto an outer query; otherwise it's some Optimizable above thisOptimizable that could potentially reject plans chosen by theOptimizerImpl to which this Optimizable belongs.



verifyProperties
public void verifyProperties(DataDictionary dDictionary) throws StandardException(Code)
Verify that the Properties list with optimizer overrides, if specified, is valid
Parameters:
  dDictionary - The DataDictionary to use.
exception:
  StandardException - Thrown on error



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.