casting identifier to string since it is a varchar database field #1432
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have had some strange performance issues with the Translatable Behavior after having arount 1 million rows in ext_translations. Queries were dropping to around 300 - 400ms. Checking the Queries I found the following:
This query, generated by the behavior, is slow ( ~300ms ):
SELECT * FROM
ext_translations
WHEREobject_class
= 'Demo\DemoBundle\Entity\Demo' ANDlocale
= 'en' ANDforeign_key
= 111This query is fast ( ~1ms ):
SELECT * FROM
ext_translations
WHEREobject_class
= 'Demo\DemoBundle\Entity\Demo' ANDlocale
= 'en' ANDforeign_key
= '111'There are two posibilities to "solve" this. Changing the the foreign_key column to integer did the same performance boost. But since ids can also be alphanumeric this is probably a bad idea to change globally. Casting the identifier to string seems to be no problem, since it is a varchar field anyways. Local tests only increased performance so far.
Thanks for discussing this change with me ( maybe there is a totally easy and obvious different solution to this issue :) ).
Regards,
Mario