From dfa80c453721ae7a579fee60a94a77662444b5ed Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Mon, 28 Sep 2009 21:33:09 +0200 Subject: [PATCH] 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) --- bacula/src/cats/make_postgresql_tables.in | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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 ( -- 2.39.5