Good morning,

I wanted to propose a very little code change for (at least) Bacula 5.2.13 binary. When using Postgresql and is version 9.3 or better and you run a 
.bvfs_update from bconsole, this process can take ages. The reason of the so long duration is the query : 

 "INSERT INTO PathVisibility (PathId, JobId)  "
   "SELECT a.PathId,%s "
   "FROM ( "
     "SELECT DISTINCT h.PPathId AS PathId "
       "FROM PathHierarchy AS h "
       "JOIN  PathVisibility AS p ON (h.PathId=p.PathId) "
      "WHERE p.JobId=%s) AS a LEFT JOIN "
       "(SELECT PathId "
          "FROM PathVisibility "
         "WHERE JobId=%s) AS b ON (a.PathId = b.PathId) "
   "WHERE b.PathId IS NULL",  jobid, jobid, jobid);

If you do a explain analyze of this query you will see it’s doing a nested loop causing this planner action the so huge query duration.

I wanted to propose this patch, which basically speeds up this query hugely… let’s say from 8 hours in some jobs to 10 minutes.

Attachment: bacula-egoitz.patch
Description: Binary data


Please if you see something that could cause any kind of damage in the patch , just tell me but I think it’s successfully to have it applied. I have applied 
it on bacula 5.2.13.

Thank you so much,
Best regards,



sarenet
Egoitz Aurrekoetxea
Departamento de sistemas
944 209 470
Parque Tecnológico. Edificio 103
48170 Zamudio (Bizkaia)

Antes de imprimir este correo electrónico piense si es necesario hacerlo.

------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
Bacula-devel mailing list
Bacula-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-devel

Reply via email to