yohoushi/yohoushi — pull request #46 by niku4i (2014-05-01 12:49:08+00:00)
Title: Index was missing (breaks backward compatibility)

Add necessary indexes. I found that index for path in nodes table is not valid.

On my environment, there are more than 200,000 graphs in InnoDB. I found this bug because I am facing slow queries. When I added about 1,000 graphs to GrowthForecast, then I noticed that adding new graphs by the worker took too long time about over 10 minutes. Also ajax loading in the accordion graph becomes slow.

Following is slow query log when adding graphs by worker.

```
Count: 1 Time=0.25s (0s) Lock=0.00s (0s) Rows=0.0 (0), yohoushi[yohoushi]@localhost
SELECT `nodes`.* FROM `nodes` WHERE `nodes`.`type` IN ('S') AND `nodes`.`path` = 'S' LIMIT N

Count: 1922 Time=0.23s (450s) Lock=0.00s (0s) Rows=0.0 (0), yohoushi[yohoushi]@localhost
SELECT `nodes`.* FROM `nodes` WHERE `nodes`.`type` IN ('S') AND `nodes`.`path` = 'S' ORDER BY `nodes`.`id` ASC LIMIT N

Count: 8017 Time=0.09s (749s) Lock=0.00s (0s) Rows=0.9 (7563), yohoushi[yohoushi]@localhost
SELECT id FROM `nodes` WHERE `nodes`.`type` IN ('S') AND `nodes`.`path` = 'S' ORDER BY `nodes`.`id` ASC LIMIT N
```