Finds index for clustering with MySQL