Skip to Main Content
Sustainable Web Design Logo
  • Home
  • Guidelines
  • Emissions
  • Ratings
  • Contact

◂ Web Development guidelines

3.22 Reduce the number and complexity of database queries

Web Development

Optimize any information provided via databases, both in terms of access schedules and how queries are sent and received.

Criteria

  • Database queries: Human-testable
    Optimize database queries, especially for frequently accessed information. If you need information that is stored in a database, and you require it or it is likely to be requested more than once in your code, the database should only be accessed once and the data stored locally for subsequent processing. Avoid relying on framework helpers that might defer filtering to later in the process.
    • get_post_meta
    • GPF – General Policy Framework (PDF) – 4.9 – UX and UI (Server Requests)
    • GPF – General Policy Framework (PDF) – 6.5 – Front-End (Upload Triggers)
    • GPF – General Policy Framework (PDF) – 7.3 – Back-End (Background Processing)
    • High Performance MySQL: Query Performance Optimization
    • Improving PHP Performance for Web Applications
    • Minimizing SQL query response times
    • Performance Tuning SQL Queries
    • Proactive Energy Management in Database Systems (PDF)
    • Query optimization techniques in SQL Server
    • SQL Query Optimization

Benefits

  • Economic
    Optimizing the codebase to avoid pushing multiple additional demands to the server reduces bandwidth overheads, while also reducing the risk of stress failures and lost business.
  • Environment
    Filtering out unneeded data at a deeper level of the application can reduce energy usage, as it reduces the processing required for (de)serialization.
  • Performance
    Holding the data locally rather than remotely eliminates the need to wait for additional requests to process the query. Relational databases and other specialist data stores are usually heavily optimized for data filtering and retrieval. Performing transformations at this level of the application creduces processing time and delivers responses faster.

GRI

  • Materials: Low
  • Energy: Low
  • Water: Low
  • Emissions: Low

View the Guideline

Tags

NetworkingPerformance

Share

More web development guidelines

3.1 Set goals based on performance and energy impact

Web Development

3.2 Remove unnecessary or redundant information

Web Development

3.3 Modularize bandwidth-heavy components

Web Development

Learn about W3C’s Sustainable Web Interest Group:

A global community advancing sustainability on the web.

Explore the group

This site is brought to you by

Mightybytes Wholegrain Digital
Website Carbon

This page loaded in 0.25 seconds and emitted just 0.5g of CO2

Visit Website Carbon
Ecograder

How green is your website?

Visit Ecograder
© Copyright Sustainable Web Design 2025. Privacy Policy.