From: Eric Bollengier Date: Mon, 28 Sep 2009 19:33:09 +0000 (+0200) Subject: Remove the file_fp_idx index for Postgresql (FilenameId, PathId) on X-Git-Tag: Release-3.0.3~46 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=dfa80c453721ae7a579fee60a94a77662444b5ed;p=bacula%2Fbacula Remove the file_fp_idx index for Postgresql (FilenameId, PathId) on File table. It is useless for common usage, and causes performance issues. This index fragments over the time and the update cost grows very quickly. (This index is not present on Mysql schema) --- diff --git a/bacula/src/cats/make_postgresql_tables.in b/bacula/src/cats/make_postgresql_tables.in index bd136c6a0b..91bf1efc47 100644 --- a/bacula/src/cats/make_postgresql_tables.in +++ b/bacula/src/cats/make_postgresql_tables.in @@ -40,8 +40,12 @@ CREATE TABLE file primary key (fileid) ); -CREATE INDEX file_jobid_idx on file (jobid); -CREATE INDEX file_fp_idx on file (filenameid, pathid); +CREATE INDEX file_jpfid_idx on file (jobid, pathid, filenameid); + +-- If you need performances, you can remove this index +-- the database engine is able to use the composite index +-- to find all records with a given JobId +CREATE INDEX file_jobid_idx on file(jobid); -- -- Add this if you have a good number of job @@ -54,7 +58,6 @@ CREATE INDEX file_fp_idx on file (filenameid, pathid); -- -- CREATE INDEX file_pathid_idx on file(pathid); -- CREATE INDEX file_filenameid_idx on file(filenameid); --- CREATE INDEX file_jpfid_idx on file (jobid, pathid, filenameid); CREATE TABLE job (