#
# shell script to create Bacula MySQL tables
#
-bindir=@SQL_BINDIR@
+# Important note:
+# You won't get any support for performance issue if you changed the default
+# schema.
+#
+bindir=@MYSQL_BINDIR@
PATH="$bindir:$PATH"
db_name=${db_name:-@db_name@}
INDEX (Path(255))
);
+-- We strongly recommend to avoid the temptation to add new indexes.
+-- In general, these will cause very significant performance
+-- problems in other areas. A better approch is to carefully check
+-- that all your memory configuation parameters are
+-- suitable for the size of your installation. If you backup
+-- millions of files, you need to adapt the database memory
+-- configuration parameters concerning sorting, joining and global
+-- memory. By default, sort and join parameters are very small
+-- (sometimes 8Kb), and having sufficient memory specified by those
+-- parameters is extremely important to run fast.
+
-- In File table
-- FileIndex can be 0 for FT_DELETED files
-- FileNameId can link to Filename.Name='' for directories
JobId INTEGER UNSIGNED NOT NULL REFERENCES Job,
PathId INTEGER UNSIGNED NOT NULL REFERENCES Path,
FilenameId INTEGER UNSIGNED NOT NULL REFERENCES Filename,
+ DeltaSeq SMALLINT UNSIGNED DEFAULT 0,
MarkId INTEGER UNSIGNED DEFAULT 0,
LStat TINYBLOB NOT NULL,
MD5 TINYBLOB,
);
CREATE TABLE RestoreObject (
- RestoreObjectId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT;
- Fname BLOB NOT NULL,
- Path BLOB NOT NULL,
- RestoreObject BLOB NOT NULL,
+ RestoreObjectId INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
+ ObjectName BLOB NOT NULL,
+ RestoreObject LONGBLOB NOT NULL,
PluginName TINYBLOB NOT NULL,
+ ObjectLength INTEGER DEFAULT 0,
+ ObjectFullLength INTEGER DEFAULT 0,
ObjectIndex INTEGER DEFAULT 0,
ObjectType INTEGER DEFAULT 0,
FileIndex INTEGER UNSIGNED DEFAULT 0,
JobId INTEGER UNSIGNED NOT NULL REFERENCES Job,
+ ObjectCompression INTEGER DEFAULT 0,
PRIMARY KEY(RestoreObjectId),
INDEX (JobId)
);
#
# Possibly add one or more of the following indexes
# to the above File table if your Verifies are
-# too slow.
+# too slow, but they can slow down backups.
#
# INDEX (PathId),
# INDEX (FilenameId),
-# INDEX (FilenameId, PathId)
-# INDEX (JobId),
#
CREATE TABLE MediaType (
HasCache TINYINT DEFAULT 0,
Reviewed TINYINT DEFAULT 0,
Comment BLOB,
+ INDEX (JobId),
INDEX (StartTime)
);
CREATE TABLE Counters (
Counter TINYBLOB NOT NULL,
- MinValue INTEGER DEFAULT 0,
- MaxValue INTEGER DEFAULT 0,
+ \`MinValue\` INTEGER DEFAULT 0,
+ \`MaxValue\` INTEGER DEFAULT 0,
CurrentValue INTEGER DEFAULT 0,
WrapCounter TINYBLOB NOT NULL,
PRIMARY KEY (Counter(128))
);
-- Initialize Version
-INSERT INTO Version (VersionId) VALUES (12);
+INSERT INTO Version (VersionId) VALUES (@BDB_VERSION@);
END-OF-DATA
then