Improvement to database indexing

Signed-off-by: crynobone <crynobone@gmail.com>
Merge branch 'staging' into develop