From: Eric Bollengier Date: Fri, 17 Dec 2010 14:03:38 +0000 (+0100) Subject: Change SELECT count(*) to SELECT 1 .. LIMIT 1 to speed up PostgreSQL and Innodb in... X-Git-Tag: Release-7.0.0~1265 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=e876917de6785e03b32ee4a4cbefeb18b9c1209e;p=bacula%2Fbacula Change SELECT count(*) to SELECT 1 .. LIMIT 1 to speed up PostgreSQL and Innodb in is_volume_purged() --- diff --git a/bacula/src/dird/ua_purge.c b/bacula/src/dird/ua_purge.c index 3e98455e09..ce69e3e32e 100644 --- a/bacula/src/dird/ua_purge.c +++ b/bacula/src/dird/ua_purge.c @@ -529,7 +529,7 @@ bool is_volume_purged(UAContext *ua, MEDIA_DBR *mr, bool force) /* If purged, mark it so */ cnt.count = 0; - Mmsg(query, "SELECT count(*) FROM JobMedia WHERE MediaId=%s", + Mmsg(query, "SELECT 1 FROM JobMedia WHERE MediaId=%s LIMIT 1", edit_int64(mr->MediaId, ed1)); if (!db_sql_query(ua->db, query.c_str(), del_count_handler, (void *)&cnt)) { ua->error_msg("%s", db_strerror(ua->db));