I had attentioned that views always use LEFT JOIN to joining the tables.
but there is a INNER JOIN which runs more quickly . so I need a INNER JOIN support.
example:.

#1:SELECT node.nid, node_area.code AS node_area_code, node.title AS node_title, node.changed AS node_changed FROM node node LEFT JOIN node_area node_area ON node.nid = node_area.nid WHERE (node.type IN ('node_area')) ORDER BY node_area.code ASC LIMIT 0, 30
THE query use 3513.09ms	.
#2: some as #1,but replace LEFT JOIN to INNER JOIN
SELECT node.nid, node_area.code AS node_area_code, node.title AS node_title, node.changed AS node_changed FROM node node INNER JOIN node_area node_area ON node.nid = node_area.nid WHERE (node.type IN ('node_area')) ORDER BY node_area.code ASC LIMIT 0, 30
THE #2 query only use 33.87 ms  about 100 plus.

An INNER JOIN returns only those rows from the left table having a matching row in the right table based on the join criteria. and that is all what i need .
sometimes I do not need left join.

Comments

merlinofchaos’s picture

Status: Active » Fixed

While the UI cannot tell it to use an inner join (the UI doesn't even really understand the concept of a join) the data itself can use 'type' => 'inner' in the joininfo.

Anonymous’s picture

Status: Fixed » Closed (fixed)