title: Sqlalchemy query is very slow after using the in_() method
body: <pre><code>filters.append(Flow.time_point &gt;= datetime.strptime(start_time, '%Y-%m-%d %H:%M:%S'))
  filters.append(Flow.time_point &lt;= datetime.strptime(end_time, '%Y-%m-%d %H:%M:%S'))
  if domain_name != 'all':
      filters.append(Bandwidth.domain_name.in_(domain_name.split('|')))
  
  flow_list = db.session.query(Flow.time_point, db.func.sum(Flow.value).label('value')).filter(*filters).group_by(Flow.time_point).order_by(Flow.time_point.asc()).all()
  </code></pre>
  
  <p>The query time is 3 to 4 seconds when domain_name is <code>'all'</code>, otherwise the query time is 5 minutes. I have tried to add an index to a column but to no avail. What could be the reason for this?</p>