Tag Plugin: optimize database