1.

What do you understand by query optimisation in the context of SQL?

Answer»

A single query can be run using various methods or rewritten in various formats and STRUCTURES. As a result, the topic of query optimization arises: which of these forms or paths is the most efficient? The query optimizer considers all alternative query plans to discover the most efficient way to EXECUTE a query.

The purpose of query optimization is to reduce the number of system resources necessary to complete a query, allowing the user to receive the proper result set more quickly.

  • It gives the user faster results, making the application appear to be speedier.
  • Second, because each request takes less time than unoptimized queries, the system can HANDLE more queries in the same amount of time.
  • Finally, query optimization decreases the amount of WEAR on the server's hardware (for example, disk drives) and allows it to run more efficiently (e.g. lower power consumption, less memory usage).

A query can be optimised in one of two ways: 

  • Analyze and alter RELATIONAL phrases that are equivalent: Reduce the number of tuples and columns in the intermediate and final query processes (discussed here).
  • For each operation, multiple algorithms can be used: These underlying techniques influence the frequency of disk and block accesses by determining how tuples are accessed from the data structures they are stored in, indexing, hashing, and data retrieval.


Discussion

No Comment Found