mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-1402: Huge performance leak in SingleTablePersister #1756
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 (Oct 4, 2011).
Originally assigned to: @beberlei on GitHub.
Jira issue originally created by user sb_demarque:
This code :
Will output:
With the first and last SELECT queries as:
Notes:
* Last 100 SELECT queries take more than 14 seconds to execute! (table is empty)
Analysis:
Calls to *SingleTablePersister::_getSelectColumnListSQL()* do not use BasicEntityPersister::$_selectColumnListSql
This generates a lot of calls to _getSelectColumnSQL() (See last SELECT query with alias counter up to 16800)
This generates a lot of calls to addFieldResult()
And this fills up pretty quickly ResultSetMapping::$declaringClasses
To finally put a huge burden on *SimpleObjectHydrator::_prepare()* where it iterates on _$this->rsm->declaringClasses and calls getClassMetadata() for each one!
And all that, including _prepare(), is executed for each SELECT, even though none of them find any result (the table is empty).
I fixed my project using the following patch:
I do not know if this patch is safe for everybody.
But, well, you can easily reproduce the problem and analyze the phenomenon using a profiler on the sample code provided.
Thanks for this great piece of software. I hope this will help you find and fix the bug.
@doctrinebot commented on GitHub (Oct 10, 2011):
Comment created by @beberlei:
good catch, thank you very much!
fixed and merged back into 2.1.x
@doctrinebot commented on GitHub (Oct 10, 2011):
Issue was closed with resolution "Fixed"
@doctrinebot commented on GitHub (Dec 13, 2015):
Imported 1 attachments from Jira into https://gist.github.com/ca1b504847773836ba21