Bacula-users

[Bacula-users] Req: restore 2 slow, CREATE INDEX FilenameId ON File(FilenameId);

2014-02-11 08:07:54
Subject: [Bacula-users] Req: restore 2 slow, CREATE INDEX FilenameId ON File(FilenameId);
From: Hans Schou <hans AT moc DOT net>
To: bacula-users AT lists.sourceforge DOT net
Date: Tue, 11 Feb 2014 13:32:48 +0100
Hi

When going into restore:
   2: List Jobs where a given File is saved
it takes quite a lot of time to get the list.

To speed it up I have added an index:
   CREATE INDEX FilenameId ON File(FilenameId);

Am I doing something wrong or could this be added to futufre releases 
(and then what will be the name of the index?).

It will add a little more time when adding/deleting files as the index 
has to be maintained but I think it is worth it.

If you have a lot of files and want to test it, run:
   time mysql bacula -e "SELECT * FROM File WHERE File.FilenameId=7;" # 
replace the number
then add the index and run again.

The select which actually is run:
SELECT
   Job.JobId as JobId,
   CONCAT(Path.Path,Filename.Name) as Name,
   StartTime,
   Type as JobType,
   JobStatus,JobFiles,
   JobBytes
FROM
   Client, Job, File, Filename, Path
WHERE
   Client.Name='serv0047'
   AND Client.ClientId=Job.ClientId
   AND Job.JobId=File.JobId
   AND File.FileIndex > 0
   AND Path.PathId=File.PathId
   AND Filename.FilenameId=File.FilenameId
   AND Filename.Name='resolv.conf'
ORDER BY
   StartTime DESC
LIMIT 20;

-- 
Venlig hilsen
Hans Schou
tel:46923438


------------------------------------------------------------------------------
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users

<Prev in Thread] Current Thread [Next in Thread>