title: Mysql innodb: Choosing index type for 'greater than >=' select
body: <p>I'm optimizing an update query:</p>
  
  <pre><code>UPDATE projects SET rgt = rgt + 2 WHERE rgt &gt;= @superRgt;
  </code></pre>
  
  <p>The table has a lot of rows (~63000), and the query runs slow. When I</p>
  
  <pre><code>explain SELECT * FROM projects WHERE rgt &gt;= @superRgt;
  </code></pre>
  
  <p>I get this result:</p>
  
  <pre><code>+----+-------------+----------+------+---------------+------+---------+------+-------+-------------+
  | id | select_type | table    | type | possible_keys | key  | key_len | ref  | rows  | Extra       |
  +----+-------------+----------+------+---------------+------+---------+------+-------+-------------+
  |  1 | SIMPLE      | projects | ALL  | rgt           | NULL | NULL    | NULL | 69971 | Using where |
  +----+-------------+----------+------+---------------+------+---------+------+-------+-------------+
  </code></pre>
  
  <p>The rgt key is defined as:</p>
  
  <pre><code>+----------+------------+------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
  | Table    | Non_unique | Key_name   | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
  +----------+------------+------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
  | projects |          1 | rgt        |            1 | rgt         | A         |       72770 |     NULL | NULL   |      | BTREE      |         |
  +----------+------------+------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
  </code></pre>
  
  <p>I'm wondering if I could optimize the UPDATE query by choosing an index type that can be used with <code>WHERE rgt &gt;= @superRgt</code> ?</p>