Database structure optimization