Fixed
Project:
Entity Data
Version:
1.1.0
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 Feb 2025 at 13:25 UTC
Updated:
19 Oct 2026 at 10:06 UTC
Jump to comment: Most recent
Slow views queries when entity_data.value is attached to a view with a relationship.
Attach the entity_id value field to a view that references a relationship.
It seems that entity_id is a varchar, but other entity ids are int
Comments
Comment #2
lobsterr commentedEntity id can be not only int
Comment #3
lobsterr commentedComment #4
lobsterr commentedhow many rows do you in the tables you are trying to join ?
Comment #5
thebarton_steven commentedThousands. Pretty much any node query is slow because node entity ids are ints.
Comment #7
lobsterr commentedI found a solution, The node ID is stored as a number, but entity_data.entity_id is stored as text. When MySQL compares a number with text, it converts the text to a number. For example, text IDs '1', '01', and '1suffix' can all compare equal to numeric ID 1. This conversion also prevents efficient use of the text index. CAST(... AS CHAR CHARACTER SET ascii) turns the node ID into matching text first. MySQL then compares text with text and can use the index efficiently.
I did some performance tests and I see boost up to 50 times