From 01a5f7a567178c87042c18a5058944160cd43731 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Mon, 31 Oct 2011 10:54:55 +0100 Subject: [PATCH] Improve speed of BVFS with SQLite, Thanks to J.Starek --- bacula/src/cats/bvfs.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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); -- 2.39.5