Permalink
Browse files

Switch from LEFT to INNER joins.

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...
1 parent dc15c78 commit e36c537cf62935a7bd299a5fd63736a316ab1785 @markstory markstory committed Aug 7, 2013
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/Cake/Model/AclNode.php
@@ -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'
@@ -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"),

0 comments on commit e36c537

Please sign in to comment.