plot_relscore.py: more efficient query.