a query optimizer is a part of the relational database software which is meant to analyze a SQL query and then figure out what the best to run that query.
How does a cost based optimizer work?
A cost based optimizer will look at all of the possible ways or scenarios in which a query can be executed – and each scenario will be assigned a ‘cost’, which indicates how efficiently that query can be run. Then, the cost based optimizer will pick the scenario that has the least cost and execute the query using that scenario.
Cost based optimizers have to use certain statistics that they collect from the database. Some examples of the types of statistics include the number of number of unique values an indexed column has or even just the number of rows in a table.
A rule based optimizer is an optimizer that just applies a set of rules to a SQL statement instead of looking at cost estimates in order to determine what the best way is to execute that SQL statement.
It highly recommends the use of cost based optimization.
Read full article from What is cost based optimization?
How does a cost based optimizer work?
A cost based optimizer will look at all of the possible ways or scenarios in which a query can be executed – and each scenario will be assigned a ‘cost’, which indicates how efficiently that query can be run. Then, the cost based optimizer will pick the scenario that has the least cost and execute the query using that scenario.
Cost based optimizers have to use certain statistics that they collect from the database. Some examples of the types of statistics include the number of number of unique values an indexed column has or even just the number of rows in a table.
A rule based optimizer is an optimizer that just applies a set of rules to a SQL statement instead of looking at cost estimates in order to determine what the best way is to execute that SQL statement.
It highly recommends the use of cost based optimization.
Read full article from What is cost based optimization?
No comments:
Post a Comment