From: Eric Bollengier Date: Mon, 31 Oct 2011 09:54:55 +0000 (+0100) Subject: Improve speed of BVFS with SQLite, Thanks to J.Starek X-Git-Tag: Release-7.0.0~483 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=01a5f7a567178c87042c18a5058944160cd43731;p=bacula%2Fbacula Improve speed of BVFS with SQLite, Thanks to J.Starek --- diff --git a/bacula/src/cats/bvfs.c b/bacula/src/cats/bvfs.c index 56d94c3663..0e75beb8c0 100644 --- a/bacula/src/cats/bvfs.c +++ b/bacula/src/cats/bvfs.c @@ -378,7 +378,17 @@ static void update_path_hierarchy_cache(JCR *jcr, free(result); } - Mmsg(mdb->cmd, + if (mdb->db_get_type_index() == SQL_TYPE_SQLITE3) { + Mmsg(mdb->cmd, + "INSERT INTO PathVisibility (PathId, JobId) " + "SELECT DISTINCT h.PPathId AS PathId, %s " + "FROM PathHierarchy AS h " + "WHERE h.PathId IN (SELECT PathId FROM PathVisibility WHERE JobId=%s) " + "AND h.PPathId NOT IN (SELECT PathId FROM PathVisibility WHERE JobId=%s)", + jobid, jobid, jobid ); + + } else { + Mmsg(mdb->cmd, "INSERT INTO PathVisibility (PathId, JobId) " "SELECT a.PathId,%s " "FROM ( " @@ -390,6 +400,7 @@ static void update_path_hierarchy_cache(JCR *jcr, "FROM PathVisibility " "WHERE JobId=%s) AS b ON (a.PathId = b.PathId) " "WHERE b.PathId IS NULL", jobid, jobid, jobid); + } do { QUERY_DB(jcr, mdb, mdb->cmd);