[TYPO3-mvc] multiple Queries for same object and queries for empty Relations
Jonas Götze
jonnsn at gmail.com
Wed Dec 4 11:57:03 CET 2013
Hi all,
I currently have a big performance issue with an extbase extension.
I hope I have not overlooked any existing bug reports or posts related
to this - If you know something I could not find I would be glad about a
hint.
I have a record with a 1-to-1 relation to fe_users (Type
Tx_Extbase_Domain_Model_FrontendUser). The property frontendUser of my
Record is optional.
If all the Main records are fetched there is a sql Query for every
frontendUser Property assigned to it.
2 Problems occur:
- if there is no relation at all (means 0 in the database) there will be
a query like 'where fe_users.uid IN('0') (one per main Record) -
obviously there will never be result for this.
- if there is a valid relation there will be a query for every single
main Record again - though the data was fetched already multiple times
if the relation points to the same User again and again.
While this is not a huge problem with not so many records, it becomes a
performance problem with (only!) some hundred records (~270 in my case).
The relations point to ~5 different Users overall actually but there are
hundreds of queries. Furthermore this also happens for relations to
other tables, fe_users is just my example here.
All in all I have some thousand queries with a single plugin.
To reproduce this I created a simple example Extension (created with
extension_builder on a plain TYPO3 v6.1.6 with small adjustments
afterwards) which you can download [1] if interested. Tested also on
current git master of TYPO3 v6.2.
Install:
- install the extension in EM
- include static template
- create at least 1 Frontenduser with type
"Tx_Extbase_Domain_Model_FrontendUser"
- include plugin to a page of our choice
- set storagePid (or pages in Flexforms) to be able to find the user-Record
- enable sql Debug in Install tool to see the Queries
In the Frontend you can create multiple records - either with a relation
to your FrontendUser or without. The SQL Debug will show as much queries
to fe_users as there are "Report"-Records anyhow.
I found this bug entry which might be related, but latest 6.2 from git
still has the same behaviour:
http://forge.typo3.org/issues/53514
I think this is a bug, but I just wanted to be sure I have not
overlooked something and maybe there are a few persons who can confirm
the Problem too.
The Problem occurs since about 2months. Earlier everything was fine -
the only things I am aware of that might have changed are the number of
records and the TYPO3 version.
Thanks a lot for your hints/questions/suggestions/notes/...!
Best Regards
Jonas
[1] https://www.dropbox.com/s/ks1vaoisnb2nhe0/debugme_0.0.1.zip
More information about the TYPO3-project-typo3v4mvc
mailing list