简体   繁体   中英

Why in Joomla 3.0.1 installation sql script ENGINE=InnoDB is used?

Can someone please explain why in Joomla! 3.0.1 installation sql script for MySQL is used ENGINE=InnoDB !?! Is there a particular reason !??!?

The 2 major types of table storage engines for MySQL databases are InnoDB and MyISAM. To summarize the differences of features and performance,

  1. InnoDB is newer while MyISAM is older.

  2. InnoDB is more complex while MyISAM is simpler.

  3. InnoDB is more strict in data integrity while MyISAM is loose.

  4. InnoDB implements row-level lock for inserting and updating while MyISAM implements table-level lock.

  5. InnoDB has transactions while MyISAM does not.

  6. InnoDB has foreign keys and relationship contraints while MyISAM does not.

  7. InnoDB has better crash recovery while MyISAM is poor at recovering data integrity at system crashes.

  8. MyISAM has full-text search index while InnoDB has not.

    In light of these differences, InnoDB and MyISAM have their unique advantages and disadvantages against each other. They each are more suitable in some scenarios than the other.

Advantages of InnoDB

InnoDB should be used where data integrity comes a priority because it inherently takes care of them by the help of relationship constraints and transactions.

Faster in write-intensive (inserts, updates) tables because it utilizes row-level locking and only hold up changes to the same row that's being inserted or updated.

Disadvantages of InnoDB

Because InnoDB has to take care of the different relationships between tables, database administrator and scheme creators have to take more time in designing the data models which are more complex than those of MyISAM.

Consumes more system resources such as RAM. As a matter of fact, it is recommended by many that InnoDB engine be turned off if there's no substantial need for it after installation of MySQL.

No full-text indexing.

Advantages of MyISAM

Simpler to design and create, thus better for beginners. No worries about the foreign relationships between tables.

Faster than InnoDB on the whole as a result of the simpler structure thus much less costs of server resources.

Full-text indexing.

Especially good for read-intensive (select) tables.

Disadvantages of MyISAM

No data integrity (eg relationship constraints) check, which then comes a responsibility and overhead of the database administrators and application developers.

Doesn't support transactions which is essential in critical data applications such as that of banking.

Slower than InnoDB for tables that are frequently being inserted to or updated, because the entire table is locked for any insert or update.

The comparison is pretty straightforward.

InnoDB is more suitable for data critical situations that require frequent inserts and updates.

MyISAM, on the other hand, performs better with applications that don't quite depend on the data integrity and mostly just select and display the data.

Read more

Considering the fact that they aren't using any foreign key constraints it's actually a really good question.

Since they are not using foreign constraints themselves there are a couple of reasons that come to my mind why they might use InnoDB over MyISAM which are:

  1. They have some future plans to stricten data integrity at some point in time.

  2. They want to allow people who write extensions for Joomla to refer to existing data and make hard constraints if that's what the creator desires. IE: Let's imagine a component that stores notes for users in Joomla system. An author could then create a table like so:

     CREATE TABLE IF NOT EXISTS `#__notes` ( `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, `note` VARCHAR(255) NOT NULL, `owner` INT(11) NOT NULL, PRIMARY KEY (`id`), INDEX (`owner`), CONSTRAINT FOREIGN KEY (`owner`) REFERENCES `#__users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8; 

    then the author could be sure that an owner for the notes actually exists and he won't have any garbage leftover in case a user is removed from the system as all the notes that belongs to a certain user would be removed as well due to set CASCADE on delete action which is very convenient if you don't want to maintain clean database manually which would not be possible if databases you would want to refer to would use different engine, namely MyISAM.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM