Mysql – Slow sqlalchemy ".in_" clause
I'm trying to execute the following query using sqlalchemy: query = session.query( func.count(ExampleTable.id) ).filter(ExampleTable.environment == self.environment)) if ids_list: query = query.filter(ExampleTable.id.in_(ids_list)) I noticed it was slow, so i did a simple timing "benchmark": start = perf_counter() query.first() print(format(perf_counter() - start,…