Efficient queries

From Green software

Jump to: navigation, search

Most Web applications of any size involve the use of a database. Typically, a Web application allows the addition or creation of new records (for example, when a new user registers on the site), and the reading and searching of many records in a database. The most common bottleneck when developing a Web application is in the reading of a large number of records from a database, or executing a particularly complex SELECT statement against the database. Source:



Besides energy efficiency often usability is also improved and even servers can be consolidated after queries have been improved.


The way to optimize a database is very specific for each database and task. Optimizing database queries is a task often requiring specialists for the specific database technique.


Some basic techniques to optimize database querying:

  • Eliminating any unnecessary ORDER BY clauses
  • Watching for complex SELECTs
  • Use indexes


Theoretically databases are best when they adhere to a high degree of normal form and hold no redundant information. In practice introducing data redundancy and denormalisation can sometimes help support more efficient queries.


In Energy efficient software, this practice was empirically evaluated on the MySQL Database Server. The application of the practice caused a 25% decrease in energy consumption.

See Also


Increase LINQ Query Performance: http//msdn.microsoft.com/en-us/magazine/cc721610.


This best practices was recognized as such by IT professionals, described in Energy efficient software.

Personal tools