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-Url: https://git.sur5r.net/?a=commitdiff_plain;h=aad75655ed55a9244b70878fbccd7dab088a05e3;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));