Skip to content

Commit

Permalink
Switch from LEFT to INNER joins.
Browse files Browse the repository at this point in the history
INNER joins are often more efficient as they can result in fewer rows
being examined before a result set is generated.

Fixes #3968
  • Loading branch information
markstory committed Aug 7, 2013
1 parent dc15c78 commit e36c537
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Cake/Model/AclNode.php
Expand Up @@ -85,7 +85,7 @@ public function node($ref = null) {
'joins' => array(array(
'table' => $table,
'alias' => "{$type}0",
'type' => 'LEFT',
'type' => 'INNER',
'conditions' => array("{$type}0.alias" => $start)
)),
'order' => $db->name("{$type}.lft") . ' DESC'
Expand All @@ -97,7 +97,7 @@ public function node($ref = null) {
$queryData['joins'][] = array(
'table' => $table,
'alias' => "{$type}{$i}",
'type' => 'LEFT',
'type' => 'INNER',
'conditions' => array(
$db->name("{$type}{$i}.lft") . ' > ' . $db->name("{$type}{$j}.lft"),
$db->name("{$type}{$i}.rght") . ' < ' . $db->name("{$type}{$j}.rght"),
Expand Down

0 comments on commit e36c537

Please sign in to comment.