mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-894: Performance improvement in AbstractQuery: Cache should be checked *before* flushing the unit of work, not after doing it #1112
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Nov 25, 2010).
Jira issue originally created by user dalvarez:
In /Doctrine/ORM/AbstractQuery.php, starting on line 490, the unit of work is flushed
if needed before processing the query:
If there is a subsequent cache hit, this turns out to be unnecessary later.
Checking the cache first and flushing the unit of work only on cache misses could increase
performance significantly in some scenarios (batch-jobs that are heavy on inserts) and does not cost a dime.
Otherwise the ORM is performing a significant amount of non-work, when we
could as well happily continue feeding the unit of work.
@doctrinebot commented on GitHub (Dec 27, 2010):
Comment created by @beberlei:
We removed the flush inside AbstractQuery and clearly documented this behavior in the docs. If you need a clean query, you have to call EM->flush() yourself, explicit behavior is better in this case.
The cache issue then becomes a non-issue.
@doctrinebot commented on GitHub (Dec 27, 2010):
Issue was closed with resolution "Invalid"