Optimizing queries
Similar to tables, database queries are the most crucial element of any database. Applications interact with the databases using queries. Queries are also called executable SQL statements. This section focuses on techniques to improve the performance of query execution.
Optimizing SQL statements
SQL statements are used to perform the core logic of any database application. It does not matter whether the statements are issued directly through an interpreter or submitted behind the scenes by an API. This section outlines guidelines to improve the performance of SQL operations that read and write data in the database.
SELECT
statements perform all of the lookup operations in the database. Considering the frequency of SELECT
statements, it becomes important to tune these statements at the top priority. The tuning techniques must be applied to constructs like CREATE TABLE...AS SELECT
, INSERT INTO...SELECT
, and WHERE
clauses in DELETE
statements.
The following are the main considerations...