]> git.sur5r.net Git - bacula/bacula/commitdiff
Remove the file_fp_idx index for Postgresql (FilenameId, PathId) on
authorEric Bollengier <eric@eb.homelinux.org>
Mon, 28 Sep 2009 19:33:09 +0000 (21:33 +0200)
committerEric Bollengier <eric@eb.homelinux.org>
Mon, 28 Sep 2009 19:33:09 +0000 (21:33 +0200)
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

index bd136c6a0b4225622852ca5e7ccf1c125600bfd1..91bf1efc4734eb765b277404eeaa21bd16b51867 100644 (file)
@@ -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
 (