Posted by matt_paz on April 19, 2008 at 6:50pm
So, it may be premature to ask this and this may not be the right place, but here is some sql generated from a view I built using the latest dev build of views 2 (as of Friday). Two questions ...
1) shouldn't the joins use term_node's vid instead of nid (More Info)
2) shouldn't the joins on term_node use INNER JOIN instead of LEFT JOIN
SELECT DISTINCT(node.nid) AS nid,
node_data_field_face_plate.field_face_plate_value AS node_data_field_face_plate_field_face_plate_value,
node_data_field_face_plate.nid AS node_data_field_face_plate_nid,
node_data_field_sort_index.field_sort_index_value AS node_data_field_sort_index_field_sort_index_value,
node_counter.totalcount AS node_counter_totalcount
FROM {node} node
LEFT JOIN {content_type_usernode} node_data_field_profile_display ON node.vid = node_data_field_profile_display.vid
LEFT JOIN {term_node} term_node_37520 ON node.nid = term_node_37520.nid AND (term_node_37520.tid = 37520)
LEFT JOIN {content_field_face_plate} node_data_field_face_plate ON node.vid = node_data_field_face_plate.vid
LEFT JOIN {content_field_sort_index} node_data_field_sort_index ON node.vid = node_data_field_sort_index.vid
LEFT JOIN {node_counter} node_counter ON node.nid = node_counter.nid
WHERE (node.status <> 0) AND (node_data_field_profile_display.field_profile_display_value IN ('1', '2')) AND (term_node_37520.tid = 37520)
ORDER BY node_data_field_sort_index_field_sort_index_value DESC, node_counter_totalcount DESCBTW, I'm loving what I've seen from Views 2 thus far
Comments
I believe you're right about
I believe you're right about the nid/vid.
Views generally prefers to use LEFT joins, though I guess when filtering an INNER join is preferable. It may be possible to change it because we're being very particular about the join in that case anyhow.
You should post this as an issue in the queue.
Filed in the queue
Cool. I filed two seperate issues ... not sure about the INNER JOIN option .... maybe only if the taxonomy filter is being used in an AND context. 'Been fun to monitor the progress.
http://drupal.org/node/248749
http://drupal.org/node/248750
Thanks!