8000 Issue with Query Cache in Doctrine ORM Causing Cache Memory Overflow · Issue #11112 · doctrine/orm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Issue with Query Cache in Doctrine ORM Causing Cache Memory Overflow #11112
Closed
@alebedev80

Description

@alebedev80

Bug Report

Q A
BC Break no
Version 2.17.1

Summary

I am experiencing an issue with Doctrine ORM's query caching mechanism, leading to Redis memory overflow. This is primarily due to the way 'limit' and 'offset' values are handled in cached queries.

Current Behavior

In my production environment, Doctrine ORM caches each query including 'limit' and 'offset' as literal values in the SQL statement, rather than as parameters. As a result, every paginated request results in a new cache entry, with the only difference being the varying 'limit' and 'offset' values. This leads to an excessive number of cache entries in Redis.

How to Reproduce

  • Configure Doctrine ORM with query caching, using Redis as the cache storage.
  • Run a query that includes 'limit' and 'offset' clauses.
  • Increment the 'offset' value (simulate pagination) and re-execute the query.
  • Observe the creation of multiple cache entries in Redis for each query variation.

See test code here

Expected Behavior

The expected behavior is for Doctrine ORM to treat 'limit' and 'offset' as parameters rather than literals in the query. This approach would allow for a single cache entry to be applicable to multiple paginated requests of the same query, thereby reducing the number of cache entries and preventing cache memory overflow.

Additional Information
Redis version: 7
PHP version: 8.2
DB: MySQL 8
Environment: Production
Addressing this issue is critical for optimizing query caching efficiency in Doctrine ORM, especially for applications that heavily rely on pagination.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0