yohoushi/yohoushi — pull request #59 by sonots (2014-12-15 16:12:21+00:00)
Title: add ancestry index to nodes

@niku4i

Same thing with https://github.com/yohoushi/yohoushi/commit/3e507b1b006d0440bab7a5ecae866036d6af6a8d

```
$ mysql -uroot yohoushi;
mysql> set global log_queries_not_using_indexes = 1;
mysql> set global long_query_time = 10;
mysql> set global slow_query_log_file = '/tmp/slowquery.log';
$ mysqldumpslow /tmp/slowquery.log
Count: 1 Time=0.12s (0s) Lock=0.00s (0s) Rows=0.0 (0), root[root]@localhost SELECT `nodes`.`ancestry` FROM `nodes` WHERE (ancestry IN ('S','S','S','S')) AND (type = 'S') GROUP BY ancestry

Count: 1 Time=0.08s (0s) Lock=0.00s (0s) Rows=4.0 (4), root[root]@localhost
SELECT `nodes`.* FROM `nodes` WHERE `nodes`.`ancestry` = 'S' AND `nodes`.`visible` = N ORDER BY path ASC, type DESC

Count: 1 Time=0.00s (0s) Lock=0.00s (0s) Rows=1.0 (1), root[root]@localhost
SELECT `nodes`.* FROM `nodes` WHERE `nodes`.`ancestry` IS NULL ORDER BY `nodes`.`id` ASC LIMIT N
```

visible is just true or false.