Optimize the query for series names.