Skip to content

Reduce Database Queries and Network Calls #378

Open

Description

@j-ruch

Describe the pattern you'd like to propose
As a software developer or architect, I want to reduce the number of database requests, so that the application performs its operations more efficiently in terms of latency, overall run time, and energy consumption.

Especially ORM tools like Hibernate in Java can execute additional, unwanted queries if relationships between entities are wrongly configured.

Describe specific emission impact from this pattern
Reducing the number of database requests reduces the amount of blocking I/O operations, which improves the overall performance of the application and thereby reduces its energy consumption.

SCI score: SCI = (E * I) + M per R
The energy consumed (E) is reduced by reducing the amount of requests that travel the network, and by reducing the execution time of services, so they can be scaled down earlier.

References to this pattern
I haven't seen this as a pattern, but I eager/lazy loading issues in Hibernate/JPA are a well known problem (e.g. N+1 problem).

Additional context
A selected use case performs an operation on a large dataset resulting in too many database requests, such as N+1 requests, where N is the amount of items in the dataset, and +1 refers to an additional request to fetch an eagerly loaded relation for each item.
The issue of too many database requests may also arise from lazy loaded relations that are accessed after the initial fetch of the dataset.

Activity

  1. russelltrow commented on Nov 24, 2025

    @russelltrow
    Member

    Hey @j-ruch thank you so much for proposing a new pattern.

    @franziska-warncke @LiyaMath can you please review and provide your feedback.

  2. franziska-warncke commented on Dec 19, 2025

    @franziska-warncke
    Contributor

    Hi @j-ruch ,
    at the moment we are in the phase of re-categorizing our patterns catalog, which leads to a delay for reviewing open issues. We will have a look, when we finished creating our new structure to categorize patterns.

    Many thanks and have a good time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

proposed patternAn idea for a new pattern to submit

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions