Index: src/dird/job.c
===================================================================
---- src/dird/job.c (révision 8436)
-+++ src/dird/job.c (copie de travail)
+--- src/dird/job.c (revision 8436)
++++ src/dird/job.c (working copy)
@@ -860,6 +860,7 @@
jcr->jr.JobStatus = jcr->JobStatus;
jcr->jr.JobFiles = jcr->JobFiles;
jcr->jr.JobErrors = jcr->Errors;
Index: src/cats/sql_update.c
===================================================================
---- src/cats/sql_update.c (révision 8436)
-+++ src/cats/sql_update.c (copie de travail)
+--- src/cats/sql_update.c (revision 8436)
++++ src/cats/sql_update.c (working copy)
@@ -161,7 +161,7 @@
time_t ttime;
struct tm tm;
rdt,
Index: src/cats/update_postgresql_tables.in
===================================================================
---- src/cats/update_postgresql_tables.in (révision 8436)
-+++ src/cats/update_postgresql_tables.in (copie de travail)
-@@ -11,13 +11,20 @@
+--- src/cats/update_postgresql_tables.in (revision 8436)
++++ src/cats/update_postgresql_tables.in (working copy)
+@@ -11,13 +11,24 @@
if $bindir/psql -f - -d ${db_name} $* <<END-OF-DATA
++-- The alter table operation can be faster with a big maintenance_work_mem
++-- SET maintenance_work_mem = '1G';
++
+BEGIN;
+ALTER TABLE file ALTER fileid TYPE bigint ;
+ALTER TABLE basefiles ALTER fileid TYPE bigint;
+
-- Create a table like Job for long term statistics
CREATE TABLE JobHistory (LIKE Job);
++CREATE INDEX jobhistory_idx ON jobhistory ( starttime );
-UPDATE Version SET VersionId=11;
-
echo "Update of Bacula PostgreSQL tables succeeded."
Index: src/cats/make_sqlite3_tables.in
===================================================================
---- src/cats/make_sqlite3_tables.in (révision 8436)
-+++ src/cats/make_sqlite3_tables.in (copie de travail)
+--- src/cats/make_sqlite3_tables.in (revision 8436)
++++ src/cats/make_sqlite3_tables.in (working copy)
@@ -64,6 +64,7 @@
VolSessionTime INTEGER UNSIGNED DEFAULT 0,
JobFiles INTEGER UNSIGNED DEFAULT 0,
PRAGMA default_cache_size = 100000;
Index: src/cats/cats.h
===================================================================
---- src/cats/cats.h (révision 8436)
-+++ src/cats/cats.h (copie de travail)
+--- src/cats/cats.h (revision 8436)
++++ src/cats/cats.h (working copy)
@@ -88,7 +88,7 @@
#if defined(BUILDING_CATS)
#ifdef HAVE_SQLITE
Index: src/cats/update_sqlite3_tables.in
===================================================================
---- src/cats/update_sqlite3_tables.in (révision 8436)
-+++ src/cats/update_sqlite3_tables.in (copie de travail)
+--- src/cats/update_sqlite3_tables.in (revision 8436)
++++ src/cats/update_sqlite3_tables.in (working copy)
@@ -15,10 +15,15 @@
db_name=@db_name@
END-OF-DATA
Index: src/cats/make_postgresql_tables.in
===================================================================
---- src/cats/make_postgresql_tables.in (révision 8436)
-+++ src/cats/make_postgresql_tables.in (copie de travail)
+--- src/cats/make_postgresql_tables.in (revision 8436)
++++ src/cats/make_postgresql_tables.in (working copy)
@@ -29,7 +29,7 @@
CREATE TABLE file
joberrors integer default 0,
jobmissingfiles integer default 0,
poolid integer default 0,
-@@ -300,7 +301,7 @@
+@@ -88,7 +89,9 @@
+
+ -- Create a table like Job for long term statistics
+ CREATE TABLE JobHistory (LIKE Job);
++CREATE INDEX jobhistory_idx ON jobhistory ( starttime );
+
++
+ CREATE TABLE Location (
+ LocationId serial not null,
+ Location text not null,
+@@ -300,7 +303,7 @@
(
baseid serial not null,
jobid integer not null,
fileindex integer ,
basejobid integer ,
primary key (baseid)
-@@ -377,7 +378,7 @@
+@@ -377,7 +380,7 @@
INSERT INTO Status (JobStatus,JobStatusLong) VALUES
('i', 'Doing batch insert file records');
Index: src/cats/update_sqlite_tables.in
===================================================================
---- src/cats/update_sqlite_tables.in (révision 8436)
-+++ src/cats/update_sqlite_tables.in (copie de travail)
+--- src/cats/update_sqlite_tables.in (revision 8436)
++++ src/cats/update_sqlite_tables.in (working copy)
@@ -17,9 +17,11 @@
${bindir}/${sqlite} $* ${db_name}.db <<END-OF-DATA
BEGIN TRANSACTION;
END-OF-DATA
Index: src/cats/update_mysql_tables.in
===================================================================
---- src/cats/update_mysql_tables.in (révision 8436)
-+++ src/cats/update_mysql_tables.in (copie de travail)
-@@ -12,16 +12,47 @@
+--- src/cats/update_mysql_tables.in (revision 8436)
++++ src/cats/update_mysql_tables.in (working copy)
+@@ -12,16 +12,48 @@
if $bindir/mysql $* -f <<END-OF-DATA
USE ${db_name};
+ FileSetId INTEGER UNSIGNED DEFAULT 0,
+ PriorJobId INTEGER UNSIGNED DEFAULT 0,
+ PurgedFiles TINYINT DEFAULT 0,
-+ HasBase TINYINT DEFAULT 0
++ HasBase TINYINT DEFAULT 0,
++ INDEX (StartTime)
+ );
+
END-OF-DATA
echo "Update of Bacula MySQL tables succeeded."
Index: src/cats/make_sqlite_tables.in
===================================================================
---- src/cats/make_sqlite_tables.in (révision 8436)
-+++ src/cats/make_sqlite_tables.in (copie de travail)
+--- src/cats/make_sqlite_tables.in (revision 8436)
++++ src/cats/make_sqlite_tables.in (working copy)
@@ -64,6 +64,7 @@
VolSessionTime INTEGER UNSIGNED DEFAULT 0,
JobFiles INTEGER UNSIGNED DEFAULT 0,
PRAGMA default_synchronous = OFF;
Index: src/cats/sql_get.c
===================================================================
---- src/cats/sql_get.c (révision 8436)
-+++ src/cats/sql_get.c (copie de travail)
+--- src/cats/sql_get.c (revision 8436)
++++ src/cats/sql_get.c (working copy)
@@ -297,13 +297,13 @@
Mmsg(mdb->cmd, "SELECT VolSessionId,VolSessionTime,"
"PoolId,StartTime,EndTime,JobFiles,JobBytes,JobTDate,Job,JobStatus,"
jr->EndTime = str_to_utime(jr->cEndTime);
Index: src/cats/make_mysql_tables.in
===================================================================
---- src/cats/make_mysql_tables.in (révision 8436)
-+++ src/cats/make_mysql_tables.in (copie de travail)
+--- src/cats/make_mysql_tables.in (revision 8436)
++++ src/cats/make_mysql_tables.in (working copy)
@@ -29,7 +29,7 @@
then
Index: src/bc_types.h
===================================================================
---- src/bc_types.h (révision 8436)
-+++ src/bc_types.h (copie de travail)
+--- src/bc_types.h (revision 8436)
++++ src/bc_types.h (working copy)
@@ -57,7 +57,7 @@
* In principle, the only field that really should need to be
* 64 bits is the FileId_t