mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-1706: aggregate all writes does not work #2148
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 (Mar 15, 2012).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user jforet:
I have 1 entity :
In controller, i create 2 users, i persist and i flush
Results, i have 3 requests
[2012-03-15 08:23:53] doctrine.DEBUG: SET NAMES UTF8
[2012-03-15 08:23:53] doctrine.DEBUG: INSERT INTO user (name) VALUES (?) ({"1":"name-683"})
[2012-03-15 08:23:53] doctrine.DEBUG: INSERT INTO user (name) VALUES (?) ({"1":"name-638"})
I expect to have only 2 requests because i think "INSERT" lines have to be into one single transaction.
I am on dev environment, because in production, i can not know how many request i have.
@doctrinebot commented on GitHub (Mar 15, 2012):
Comment created by @beberlei:
This has nothing to do with each other. You are just showing the log output. The Begin and Commit Statements are not listed in the log, the queries are still executed consequitevly, but they are aggregated in the transaction.
@doctrinebot commented on GitHub (Mar 15, 2012):
Comment created by jforet:
Thank you, Benjamin. Ok I understand what you say.
But I think it's too simple, or the tools provide incomplete information.
1st sample :
The dev.log gives 4 queries ; the webprofiler bar in sf shows 4 queries.
[2012-03-15 11:50:01] doctrine.DEBUG: INSERT INTO user (name) VALUES (?) ({"1":"name-1"})
[2012-03-15 11:50:01] doctrine.DEBUG: INSERT INTO user (name) VALUES (?) ({"1":"name-2"})
[2012-03-15 11:50:01] doctrine.DEBUG: INSERT INTO user (name) VALUES (?) ({"1":"name-3"})
[2012-03-15 11:50:01] doctrine.DEBUG: INSERT INTO user (name) VALUES (?) ({"1":"name-4"})
2nd sample :
The dev.log gives 4 queries ; the webprofiler bar in sf shows 4 queries.
[2012-03-15 11:51:31] doctrine.DEBUG: INSERT INTO user (name) VALUES (?) ({"1":"name-1"})
[2012-03-15 11:51:31] doctrine.DEBUG: INSERT INTO user (name) VALUES (?) ({"1":"name-2"})
[2012-03-15 11:51:31] doctrine.DEBUG: INSERT INTO user (name) VALUES (?) ({"1":"name-3"})
[2012-03-15 11:51:31] doctrine.DEBUG: INSERT INTO user (name) VALUES (?) ({"1":"name-4"})
In 1st sample, there is 3 transactions.
In 2nd sample, there is 1 transaction.
Is there a possibility to know number of transactions because i think it can help developpers in order to have better performances.
Maybe it is not in doctrine, it is in Symfony webprofiler; what do you think ?
@doctrinebot commented on GitHub (Mar 15, 2012):
Comment created by @beberlei:
Well the Symfony debug profiler only shows the queries, not the transactions. If you need the transactions you can extend it of course, for example listening to the "onFlush" event that marks the start of a UnitOfwork transaction. Its still not a bug and we won't add it to the core Doctrine bundle.
EntityManager#flush wrapping the transaction is discussed at length in the documentation.
@doctrinebot commented on GitHub (Mar 15, 2012):
Issue was closed with resolution "Won't Fix"