]> git.sur5r.net Git - bacula/bacula/commitdiff
Change SELECT count(*) to SELECT 1 .. LIMIT 1 to speed up PostgreSQL and Innodb in...
authorEric Bollengier <eric@eb.homelinux.org>
Fri, 17 Dec 2010 14:03:38 +0000 (15:03 +0100)
committerKern Sibbald <kern@sibbald.com>
Sat, 20 Apr 2013 12:39:46 +0000 (14:39 +0200)
bacula/src/dird/ua_purge.c

index 3e98455e09928d463cd9ea4bf966041c70521273..ce69e3e32e23df13d3a987f1b2109b6effb5267a 100644 (file)
@@ -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));