将去重逻辑从数据库剥离,交给代码执行环境,提高数据库生产效率
将去重逻辑从数据库剥离,交给代码执行环境,提高数据库生产效率
def get_produced_uid_l(produced_status, lim): q = 'SELECT uid FROM (SELECT uid,COUNT(1) AS c FROM {} WHERE status={} GROUP BY uid) AS t WHERE t.c>{}'.format( db_tab, produced_status, lim) print(q) logging.info(q) try: # 将去重逻辑从数据库剥离,交给代码执行环境,提高数据库生产效率 return [i[0] for i in set(mysql_fetch(mysql_key, q))] # int except Exception as e: print(e) return False