BDB
tables:BDB
storage engine maintains
log files. For maximum performance you should place these on another disk
than your databases by using the --bdb-logdir
option.
BDB
log
file is started, and removes any log files that are not needed for
current transactions. One can also run FLUSH LOGS
at any time
to checkpoint the Berkeley DB tables.
For disaster recovery, one should use table backups plus
MySQL's binary log. See section 4.4.1 Database Backups.
Warning: If you delete old log files that are in use, BDB
will
not be able to do recovery at all and you may lose data if something
goes wrong.
PRIMARY KEY
in each BDB
table to be
able to refer to previously read rows. If you don't create one,
MySQL will create an maintain a hidden PRIMARY KEY
for
you. The hidden key has a length of 5 bytes and is incremented for each
insert attempt.
BDB
table are part of the same index or
part of the primary key, then MySQL can execute the query
without having to access the actual row. In a MyISAM
table the
above holds only if the columns are part of the same index.
PRIMARY KEY
will be faster than any other key, as the
PRIMARY KEY
is stored together with the row data. As the other keys are
stored as the key data + the PRIMARY KEY
, it's important to keep the
PRIMARY KEY
as short as possible to save disk and get better speed.
LOCK TABLES
works on BDB
tables as with other tables. If
you don't use LOCK TABLE
, MySQL will issue an internal
multiple-write lock on the table to ensure that the table will be
properly locked if another thread issues a table lock.
BDB
tables is done on page level.
SELECT COUNT(*) FROM table_name
is slow as BDB
tables doesn't
maintain a count of the number of rows in the table.
MyISAM
tables as the data in
BDB
tables stored in B-trees and not in a separate datafile.
BDB
table may make an automatic rollback and any
read may fail with a deadlock error.
MyISAM
tables. In other words, the key information will take a little more
space in BDB
tables compared to MyISAM
tables.
BDB
table to allow you to insert new rows in
the middle of the key tree. This makes BDB
tables somewhat larger than
MyISAM
tables.
BDB
table. If you don't
issue a lot of DELETE
or ROLLBACK
statements, this number
should be accurate enough for the MySQL optimiser, but as MySQL
only stores the number on close, it may be incorrect if MySQL dies
unexpectedly. It should not be fatal even if this number is not 100%
correct. One can update the number of rows by executing ANALYZE
TABLE
or OPTIMIZE TABLE
. See section 4.5.2 ANALYZE TABLE
Syntax . See section 4.5.1 OPTIMIZE TABLE
Syntax.
BDB
table, you will get an error
(probably error 28) and the transaction should roll back. This is in
contrast with MyISAM
and ISAM
tables where mysqld
will
wait for enough free disk before continuing.
Posted by Federico Razzoli on Friday February 7 2003, @4:45am | [Delete] [Edit] |
Sorry, I don't understand why one should use BDB instead of InnoDB. You say table scan is slow, COUNT(*) is slow, more space is required... I don't see any advantage!
Posted by Daniel Solin on Thursday February 20 2003, @4:35am | [Delete] [Edit] |
Transactions support! :)
What one could question though is why one would want to use BDB now when we have InnoDB. InnoDB, which like BDB provides MySQL with a transactions capable storage engine, seems to be fast, come with more features, and it's obviously also more widely supported by MySQL AB.
Posted by Thom Leigh on Thursday April 3 2003, @9:44am | [Delete] [Edit] |
The advantage of BDB over innoDB isn't necessarily technical. Consider licensing.