I turned on Devel mysql log; those two queries took too much time:
47773.51 ms
execute
SELECT COUNT(*) FROM (SELECT DISTINCT(node.nid) AS nid FROM node node LEFT JOIN content_type_product node_data_field_brand ON node.vid = node_data_field_brand.vid LEFT JOIN node node_node_data_field_brand ON node_data_field_brand.field_brand_nid = node_node_data_field_brand.nid LEFT JOIN image_attach image_attach ON node.nid = image_attach.nid LEFT JOIN image_attach node_node_data_field_brand__image_attach ON node_node_data_field_brand.nid = node_node_data_field_brand__image_attach.nid WHERE node.type in ('product') ) count_alias
47879.11 ms
execute
SELECT DISTINCT(node.nid) AS nid, node.title AS node_title, image_attach.iid AS image_attach_iid, node_node_data_field_brand__image_attach.iid AS node_node_data_field_brand__image_attach_iid FROM node node LEFT JOIN content_type_product node_data_field_brand ON node.vid = node_data_field_brand.vid LEFT JOIN node node_node_data_field_brand ON node_data_field_brand.field_brand_nid = node_node_data_field_brand.nid LEFT JOIN image_attach image_attach ON node.nid = image_attach.nid LEFT JOIN image_attach node_node_data_field_brand__image_attach ON node_node_data_field_brand.nid = node_node_data_field_brand__image_attach.nid WHERE node.type in ('product') ORDER BY node_title ASC LIMIT 0, 50
Also, attached image based on node reference doesn't work.
Comments
Comment #1
skyredwangTo simplify the problem, I ran this in MySQL " select node.nid from node left join image_attach on node.nid=image_attach.nid where node.type='product';" and it took 25 sec??
I have 25,000 records in {node} and 1,892 records in {image_attach}
Comment #2
skyredwangThe problem really is that {image_attach| doesn't have an index, which causes the slowness. So, I created an index for it. Please alter the table in the next release.
Comment #3
skyredwangThe image_attach view still doesn't work with the relationship
Comment #4
drewish commentedroll a freaking patch then.
Comment #5
sunPlease submit a proper patch. See http://drupal.org/patch for details.
Comment #6
skyredwangSure, I will read through the documentation, and submit a patch next week
Comment #7
sunCommitted attached patch.