From 4b67d0451c995d42fae0cf805e55cdba666df7d0 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Tue, 29 Sep 2009 16:06:56 +0200 Subject: [PATCH] Add index modification in update_sqlite/sqlite3/postgresql scripts --- bacula/src/cats/update_postgresql_tables.in | 7 +++++++ bacula/src/cats/update_sqlite3_tables.in | 5 +++++ bacula/src/cats/update_sqlite_tables.in | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/bacula/src/cats/update_postgresql_tables.in b/bacula/src/cats/update_postgresql_tables.in index 87381c29f2..756c4412d6 100644 --- a/bacula/src/cats/update_postgresql_tables.in +++ b/bacula/src/cats/update_postgresql_tables.in @@ -29,6 +29,13 @@ CREATE INDEX jobhisto_idx ON JobHisto ( starttime ); UPDATE Version SET VersionId=11; COMMIT; +BEGIN; +-- Replace the broken file_fp_idx by a better one +DROP INDEX file_fp_idx; +CREATE INDEX file_jpfid_idx on file (jobid, pathid, filenameid); +ANALYSE; +COMMIT; + -- If you have already this table, you can remove it with: -- DROP TABLE JobHistory; diff --git a/bacula/src/cats/update_sqlite3_tables.in b/bacula/src/cats/update_sqlite3_tables.in index 54a407d26f..f07f7ba0cb 100644 --- a/bacula/src/cats/update_sqlite3_tables.in +++ b/bacula/src/cats/update_sqlite3_tables.in @@ -224,4 +224,9 @@ CREATE TABLE JobHisto ( ); CREATE INDEX inx61 ON JobHisto (StartTime); +-- Replace the index on (FilenameId, PathId) by (JobId, PathId, FilenameId); +DROP INDEX IF EXISTS inx4; +CREATE INDEX IF NOT EXISTS file_jpf_idx ON File (JobId, PathId, FilenameId); + + END-OF-DATA diff --git a/bacula/src/cats/update_sqlite_tables.in b/bacula/src/cats/update_sqlite_tables.in index 10a88753a4..e9fb72a214 100644 --- a/bacula/src/cats/update_sqlite_tables.in +++ b/bacula/src/cats/update_sqlite_tables.in @@ -224,4 +224,8 @@ CREATE TABLE JobHisto ( ); CREATE INDEX inx61 ON JobHisto (StartTime); +-- Replace the index on (FilenameId, PathId) by (JobId, PathId, FilenameId); +DROP INDEX inx4; +CREATE INDEX file_jpf_idx ON File (JobId, PathId, FilenameId); + END-OF-DATA -- 2.39.5