TOptimizingSqlDatabase

Performs optimizations to the execution of SQL quries before they are sent to the decorated database.

Inheritance

LevelAncestorDescription
1TObjectUltimate ancestor in a class hierarchy
2TSqlStatementExecutorAbstract base class for a facility that executes a TSqlStatement
3TSqlDatabase Abstract base class for connections to databases that can be queried using SQL statements.
4TLogicalSqlDatabase Abstract base class for TSqlDatabase implementations that manipulate or translate queries before they sent to an actual physical TSqlDatabase.
5TOptimizingSqlDatabase

Source

Sql.Database.Logical.Optimizing.pas (70)

Description

Some database systems may not optimize every query as one would expect. TOptimizingSqlDatabase provides some optimizations that are found to be lacking from external database systems. For instance, queries of the form SELECT COUNT(*) FROM (SELECT ... FROM ...) AS table WHERE table.ID=... sometimes are executed by first evaluating the inner SELECT in its entirety and then applying the WHERE from the outer SELECT. In many cases it is possible to push down the restrictions from the outer query to the inner query.

Methods

ScopeVisibilityResultNameDescription
InstanceprivateTSqlResultHandleDecoratedStatement(Statement: TSqlStatement; ResultMethod: TSqlQueryResultMethod)
InstancepublicTSqlResultQuery(Statement: TSqlStatement; ResultMethod: TSqlQueryResultMethod)