From 800bfcf1f55357ea4debb702804ce260a0a24164 Mon Sep 17 00:00:00 2001 From: Neil Williams Date: Wed, 4 Jan 2012 11:28:40 -0800 Subject: [PATCH] tdb_sql: Use IN instead of ORs for fetching things. Postgres likes this a lot. --- r2/r2/lib/db/tdb_sql.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/r2/r2/lib/db/tdb_sql.py b/r2/r2/lib/db/tdb_sql.py index 71734829f..338e527ae 100644 --- a/r2/r2/lib/db/tdb_sql.py +++ b/r2/r2/lib/db/tdb_sql.py @@ -515,8 +515,8 @@ def fetch_query(table, id_col, thing_id): single = True thing_id = (thing_id,) - s = sa.select([table], sa.or_(*[id_col == tid - for tid in thing_id])) + s = sa.select([table], id_col.in_(thing_id)) + try: r = add_request_info(s).execute().fetchall() except Exception, e: