Java Doc for OptimizerImpl.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » impl » 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.impl.sql.compile 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.derby.impl.sql.compile.OptimizerImpl

All known Subclasses:   org.apache.derby.impl.sql.compile.Level2OptimizerImpl,
OptimizerImpl
public class OptimizerImpl implements Optimizer(Code)
This will be the Level 1 Optimizer. RESOLVE - it's a level 0 optimizer right now. Current State: o No costing services o We can only cost a derived table with a join once. Optimizer uses OptimizableList to keep track of the best join order as it builds it. For each available slot in the join order, we cost all of the Optimizables from that slot til the end of the OptimizableList. Later, we will choose the best Optimizable for that slot and reorder the list accordingly. In order to do this, we probably need to move the temporary pushing and pulling of join clauses into Optimizer, since the logic will be different for other implementations. (Of course, we're not pushing and pulling join clauses between permutations yet.)


Field Summary
protected  JBitSetassignedTableMap
    
protected  CostEstimateImplbestCost
    
protected  int[]bestJoinOrder
    
protected  CostEstimateImplcurrentCost
    
protected  CostEstimateImplcurrentSortAvoidanceCost
    
protected  longcurrentTime
    
 DataDictionarydDictionary
    
 booleandesiredJoinOrderFound
    
 CostEstimatefinalCostEstimate
    
protected  intjoinPosition
    
protected  intmaxMemoryPerTable
    
 JBitSetnonCorrelatedTableMap
    
 intnumOptimizables
    
 intnumTablesInQuery
    
protected  OptimizableListoptimizableList
    
protected  booleanoptimizerTrace
    
protected  booleanoptimizerTraceHtml
    
 OptimizablePredicateListpredicateList
    
protected  int[]proposedJoinOrder
    
protected  RequiredRowOrderingrequiredRowOrdering
    
protected  CostEstimatesortCost
    
protected  booleantimeExceeded
    
protected  doubletimeLimit
    
protected  longtimeOptimizationStarted
    

Constructor Summary
protected  OptimizerImpl(OptimizableList optimizableList, OptimizablePredicateList predicateList, DataDictionary dDictionary, boolean ruleBasedOptimization, boolean noTimeout, boolean useStatistics, int maxMemoryPerTable, JoinStrategy[] joinStrategies, int tableLockThreshold, RequiredRowOrdering requiredRowOrdering, int numTablesInQuery)
    

Method Summary
protected  voidaddScopedPredicatesToList(PredicateList pList)
     Add scoped predicates to this optimizer's predicateList.
public  voidconsiderCost(Optimizable optimizable, OptimizablePredicateList predList, CostEstimate estimatedCost, CostEstimate outerCost)
     This is the version of costOptimizable for non-base-tables.
public  voidcostOptimizable(Optimizable optimizable, TableDescriptor td, ConglomerateDescriptor cd, OptimizablePredicateList predList, CostEstimate outerCost)
    
public  voidcostPermutation()
    
public  DataDictionarygetDataDictionary()
    
public  CostEstimategetFinalCost()
    
See Also:   Optimizer.getFinalCost
See Also:   Sum up the cost of all of the trulyTheBestAccessPaths
See Also:   for the Optimizables in our list.
public  JoinStrategygetJoinStrategy(int whichStrategy)
    
public  JoinStrategygetJoinStrategy(String whichStrategy)
    
public  intgetLevel()
    
public  intgetMaxMemoryPerTable()
    
public  CostEstimateImplgetNewCostEstimate(double theCost, double theRowCount, double theSingleScanRowCount)
    
public  booleangetNextDecoratedPermutation()
    
public  booleangetNextPermutation()
    
public  intgetNumberOfJoinStrategies()
     Get the number of join strategies supported by this optimizer.
public  CostEstimategetOptimizedCost()
    
public  voidmodifyAccessPaths()
    
public  CostEstimatenewCostEstimate()
    
public  voidprepForNextRound()
     This method is called before every "round" of optimization, where we define a "round" to be the period between the last time a call to getOptimizer() (on either a ResultSetNode or an OptimizerFactory) returned _this_ OptimizerImpl and the time a call to this OptimizerImpl's getNextPermutation() method returns FALSE.
 voidpushPredicates(Optimizable curTable, JBitSet outerTables)
    
public  voidsetOuterRows(double outerRows)
    
public  inttableLockThreshold()
    
public  voidtrace(int traceFlag, int intParam1, int intParam2, double doubleParam, Object objectParam1)
    
public  doubleuniqueJoinWithOuterTable(OptimizablePredicateList predList)
    
protected  voidupdateBestPlanMaps(short action, Object planKey)
     Process (i.e.
public  booleanuseStatistics()
    

Field Detail
assignedTableMap
protected JBitSet assignedTableMap(Code)



bestCost
protected CostEstimateImpl bestCost(Code)



bestJoinOrder
protected int[] bestJoinOrder(Code)



currentCost
protected CostEstimateImpl currentCost(Code)



currentSortAvoidanceCost
protected CostEstimateImpl currentSortAvoidanceCost(Code)



currentTime
protected long currentTime(Code)



dDictionary
DataDictionary dDictionary(Code)



desiredJoinOrderFound
boolean desiredJoinOrderFound(Code)



finalCostEstimate
CostEstimate finalCostEstimate(Code)



joinPosition
protected int joinPosition(Code)



maxMemoryPerTable
protected int maxMemoryPerTable(Code)



nonCorrelatedTableMap
JBitSet nonCorrelatedTableMap(Code)



numOptimizables
int numOptimizables(Code)



numTablesInQuery
int numTablesInQuery(Code)



optimizableList
protected OptimizableList optimizableList(Code)



optimizerTrace
protected boolean optimizerTrace(Code)



optimizerTraceHtml
protected boolean optimizerTraceHtml(Code)



predicateList
OptimizablePredicateList predicateList(Code)



proposedJoinOrder
protected int[] proposedJoinOrder(Code)



requiredRowOrdering
protected RequiredRowOrdering requiredRowOrdering(Code)



sortCost
protected CostEstimate sortCost(Code)



timeExceeded
protected boolean timeExceeded(Code)



timeLimit
protected double timeLimit(Code)



timeOptimizationStarted
protected long timeOptimizationStarted(Code)




Constructor Detail
OptimizerImpl
protected OptimizerImpl(OptimizableList optimizableList, OptimizablePredicateList predicateList, DataDictionary dDictionary, boolean ruleBasedOptimization, boolean noTimeout, boolean useStatistics, int maxMemoryPerTable, JoinStrategy[] joinStrategies, int tableLockThreshold, RequiredRowOrdering requiredRowOrdering, int numTablesInQuery) throws StandardException(Code)




Method Detail
addScopedPredicatesToList
protected void addScopedPredicatesToList(PredicateList pList) throws StandardException(Code)
Add scoped predicates to this optimizer's predicateList. This method is intended for use during the modifyAccessPath() phase of compilation, as it allows nodes (esp. SelectNodes) to add to the list of predicates available for the final "push" before code generation. Just as the constructor for this class allows a caller to specify a predicate list to use during the optimization phase, this method allows a caller to specify a predicate list to use during the modify-access-paths phase. Before adding the received predicates, this method also clears out any scoped predicates that might be sitting in OptimizerImpl's list from the last round of optimizing.
Parameters:
  pList - List of predicates to add to this OptimizerImpl'sown list for pushing.



considerCost
public void considerCost(Optimizable optimizable, OptimizablePredicateList predList, CostEstimate estimatedCost, CostEstimate outerCost) throws StandardException(Code)
This is the version of costOptimizable for non-base-tables.
See Also:   Optimizer.considerCost
exception:
  StandardException - Thrown on error



costOptimizable
public void costOptimizable(Optimizable optimizable, TableDescriptor td, ConglomerateDescriptor cd, OptimizablePredicateList predList, CostEstimate outerCost) throws StandardException(Code)

See Also:   org.apache.derby.iapi.sql.compile.Optimizer.costOptimizable
exception:
  StandardException - Thrown on error



costPermutation
public void costPermutation() throws StandardException(Code)

See Also:   org.apache.derby.iapi.sql.compile.Optimizer.costPermutation
exception:
  StandardException - Thrown on error



getDataDictionary
public DataDictionary getDataDictionary()(Code)

See Also:   org.apache.derby.iapi.sql.compile.Optimizer.getDataDictionary



getFinalCost
public CostEstimate getFinalCost()(Code)

See Also:   Optimizer.getFinalCost
See Also:   Sum up the cost of all of the trulyTheBestAccessPaths
See Also:   for the Optimizables in our list. Assumption is that
See Also:   we only get here after optimization has completed--i.e.
See Also:   while modifying access paths.



getJoinStrategy
public JoinStrategy getJoinStrategy(int whichStrategy)(Code)

See Also:   Optimizer.getJoinStrategy
See Also:   



getJoinStrategy
public JoinStrategy getJoinStrategy(String whichStrategy)(Code)

See Also:   Optimizer.getJoinStrategy
See Also:   



getLevel
public int getLevel()(Code)

See Also:   Optimizer.getLevel
See Also:   



getMaxMemoryPerTable
public int getMaxMemoryPerTable()(Code)



getNewCostEstimate
public CostEstimateImpl getNewCostEstimate(double theCost, double theRowCount, double theSingleScanRowCount)(Code)



getNextDecoratedPermutation
public boolean getNextDecoratedPermutation() throws StandardException(Code)

See Also:   Optimizer.getNextDecoratedPermutation
exception:
  StandardException - Thrown on error



getNextPermutation
public boolean getNextPermutation() throws StandardException(Code)

See Also:   Optimizer.getNextPermutation
exception:
  StandardException - Thrown on error



getNumberOfJoinStrategies
public int getNumberOfJoinStrategies()(Code)
Get the number of join strategies supported by this optimizer.



getOptimizedCost
public CostEstimate getOptimizedCost()(Code)

See Also:   Optimizer.getOptimizedCost
See Also:   



modifyAccessPaths
public void modifyAccessPaths() throws StandardException(Code)

See Also:   Optimizer.modifyAccessPaths
exception:
  StandardException - Thrown on error



newCostEstimate
public CostEstimate newCostEstimate()(Code)

See Also:   Optimizer.newCostEstimate
See Also:   



prepForNextRound
public void prepForNextRound()(Code)
This method is called before every "round" of optimization, where we define a "round" to be the period between the last time a call to getOptimizer() (on either a ResultSetNode or an OptimizerFactory) returned _this_ OptimizerImpl and the time a call to this OptimizerImpl's getNextPermutation() method returns FALSE. Any re-initialization of state that is required before each round should be done in this method.



pushPredicates
void pushPredicates(Optimizable curTable, JBitSet outerTables) throws StandardException(Code)



setOuterRows
public void setOuterRows(double outerRows)(Code)

See Also:   Optimizer.setOuterRows
See Also:   



tableLockThreshold
public int tableLockThreshold()(Code)

See Also:   Optimizer.tableLockThreshold
See Also:   



trace
public void trace(int traceFlag, int intParam1, int intParam2, double doubleParam, Object objectParam1)(Code)



uniqueJoinWithOuterTable
public double uniqueJoinWithOuterTable(OptimizablePredicateList predList) throws StandardException(Code)

See Also:   Optimizer.uniqueJoinWithOuterTable
exception:
  StandardException - Thrown on error



updateBestPlanMaps
protected void updateBestPlanMaps(short action, Object planKey) throws StandardException(Code)
Process (i.e. add, load, or remove) current best join order as the best one for some outer query or ancestor node, represented by another OptimizerImpl or an instance of FromTable, respectively. Then iterate through our optimizableList and tell each Optimizable to do the same. See Optimizable.updateBestPlan() for more on why this is necessary.
Parameters:
  action - Indicates whether to add, load, or remove the plan
Parameters:
  planKey - Object to use as the map key when adding/looking upa plan. If this is an instance of OptimizerImpl then it correspondsto an outer query; otherwise it's some Optimizable above thisOptimizerImpl that could potentially reject plans chosen by thisOptimizerImpl.



useStatistics
public boolean useStatistics()(Code)

See Also:   Optimizer.useStatistics
See Also:   



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

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