Questions tagged [innodb]

InnoDB is an ACID-compliant transactional storage engine for MySQL that uses MultiVersion Concurrency Control (MVCC). It has been the default storage engine for MySQL since version 5.5.5

InnoDB is an ACID-compliant transactional storage engine for MySQL that uses MultiVersion Concurrency Control (MVCC) to achieve nonblocking SELECTs and very high concurrency. It has been the default storage engine for MySQL since version 5.5.5

InnoDB's MVCC supports four levels of Transaction Isolation

  • READ-UNCOMMITTED : allows a transaction to see uncommitted changes made by other transactions. This isolation level allows dirty reads, non-repeatable reads, and phantoms to occur.
  • READ-COMMITTED : allows a transaction to see changes made by other transactions only if they've been committed. Uncommitted changes remains invisible. This isolation level allows non-repeatable reads, and phantoms to occur.
  • REPEATABLE READ (default) : ensure that is a transaction issues the same SELECT twice, it gets the same result both times, regardless of committed or uncommitted changesmade by other transactions. In other words, it gets a consistent result from different executions of the same query. In some database systems, REPEATABLE READ isolation level allows phantoms, such that if another transaction inserts new rows,in the inerbal between the SELECT statements, the second SELECT will see them. This is not true for InnoDB; phantoms do not occur for the REPEATABLE READ level.
  • SERIALIZABLE : completely isolates the effects of one transaction from others. It is similar to REPEATABLE READ with the additional restriction that rows selected by one transaction cannot be changed by another until the first transaction finishes.

You can set the Transaction Isolation Level Globally, Session-Wide, or just for one Transaction:

SET GLOBAL TRANSACTION ISOLATION LEVEL isolation_level;
SET SESSION TRANSACTION ISOLATION LEVEL isolation_level;
SET TRANSACTION ISOLATION LEVEL isolation_level;

InnoDB Architecture

InnoDB Architecture

The basic infrastructure of InnoDB centers around three major files

  • ibdata1, or System Tablespace (See InnoDB Architecture)
  • ib_logfile0 (See InnoDB Architecture)
  • ib_logfile1 (See InnoDB Architecture)

In conjunction with memory structures, ibdata1 processes info for 6 basic data structures

  • Table Data Pages
  • Table Index Pages
  • Table MetaData (List of Tablespace IDs + Misc Info)
  • MVCC Records
    • Rollback Segments
    • Undo Space
  • Double Write Buffer (Allows Background Page Writes)
  • Insert Buffer (For Collecting/Processing Changes to Secondary Indexes)

InnoDB Configurations can accommodate the following

  • Separating Table Data and Index Pages from the System Tablespace
  • Storing the System Tablespace in a Raw Disk Partition
  • Creating Multiple System Tablespace Files
  • Creating Multiple Log Files
  • and more...

There is important cache known as the InnoDB Buffer Pool. As of MySQL 5.5, you can configure multiple buffer pool instances. Prior to MySQL 5.5, there is only one buffer pool instance.

4413 questions
9
votes
2 answers

How do I set Full Text on MySQL Workbench?

I'm trying to set the Full Text property for some columns within a table in a MySQL InnoDB database. I can't find the option on MySQL Workbench and I've tried various searches on Google to find out how but I couldn't find anything. These are my…
Dom
  • 2,275
  • 3
  • 24
  • 34
9
votes
5 answers

InnoDB working, still showing "Database server does not support InnoDB storage engine message"

I'm trying to install Magento on a local server using WAMP. InnoDB is set as the default engine but it still shows me the message: Database server does not support InnoDB storage engine. I really don't know what to do. Can someone help?
user2517781
  • 91
  • 1
  • 1
  • 2
9
votes
2 answers

What is the scope of 'SET foreign_key_checks = 0'?

Can't really find any details on this, but is the scope of 'SET foreign_key_checks = 0' the current connection, current session or current transaction?
sbrattla
  • 5,274
  • 3
  • 39
  • 63
9
votes
4 answers

update query sometimes does not update field in mySQL database

I have an mySQL update query that will sometimes update all the fields and sometimes it will update all the fields except one. It is failing on about 10% of the calls. My table is: CREATE TABLE IF NOT EXISTS `grades` ( `id` int(11) NOT NULL…
Emily
  • 9,926
  • 4
  • 31
  • 39
9
votes
3 answers

Is using char as a primary/foreign key a no no?

Consider that there is a bunch of tables which link to "countries" or "currencies" tables. For making data easier to read I'd like make CHAR field with country code (eg US, GB, AU) and currency code (USD, AUD) a primary keys in each of those 2…
Alexei Tenitski
  • 9,030
  • 6
  • 41
  • 50
9
votes
2 answers

MySQL reload privilege for mysqldump during PHP cron job: Use MySQL admin account or create unique user? Security?

I'm running a cron job that executes mysqldump via a PHP script, the dump requires the RELOAD privilege. Using the MySQL admin account doesn't feel right, but neither does creating a user with admin privileges. My main concern is the security…
codewaggle
  • 4,893
  • 2
  • 32
  • 48
9
votes
2 answers

Life without transactions (MyISAM)

My site runs on a VDS-server. I've just found out that my MySQL server doesn't support InnoDB engine, therefore I can't use database transactions in my application. It makes me think, that some people might never use transactions. Is this the case?…
Webmezha
  • 117
  • 1
  • 8
9
votes
2 answers

Foo.objects.get(id=None) returns Foo instance, sometimes

I have this code: try: parent_comment = models.Comment.all_objects.get(id=parent_comment_id) except models.Comment.DoesNotExist: parent_comment = None if parent_comment is not None and parent_comment_id is None: raise Exception("WTF…
aehlke
  • 15,225
  • 5
  • 36
  • 45
9
votes
3 answers

Optimal MySQL-configuration (my.cnf)

The following is my default production MySQL configuration file (my.cnf) for a pure UTF-8 setup with InnoDB as the default storage…
knorv
  • 49,059
  • 74
  • 210
  • 294
9
votes
1 answer

MySQL: InnoDB vs. MyISAM: how and why to change (Amazon RDS)?

I didn't set up my database and noticed that some of my tables are innoDB whereas others are MyISAM. The reason I'm interested in changing them is because Jurg van Vliet (who writes O'Reilly books on AWS) says that Amazon RDS's automatic database…
tim peterson
  • 23,653
  • 59
  • 177
  • 299
9
votes
1 answer

Need to clear MySQL InnoDB lock without restarting database

I have an MySQL InnoDB lock that is preventing a user from logging in. I don't care about the cause of this lock at the moment - I just need to clear the lock without restarting the database. Killing the query process does nothing FYI. Any…
modulaaron
  • 2,856
  • 3
  • 24
  • 28
9
votes
3 answers

Get DATETIME in php and post it to MySQL for transaction consistency

Here is a link to the reason behind this question: NOW() for DATETIME InnoDB Transaction guaranteed? So to ensure a single transaction with any number of queries (20+ queries for example) has a 100% accurate and consistent NOW() value accross…
Maverick
  • 1,123
  • 5
  • 16
  • 30
8
votes
2 answers

Best Way to make a "hashtag" system

This is possible a problem what i lost more time to think how to do correct, thinking in the best optimized way to do. I have a table "Contents", and need to add the option to associate multiple "hashtags" or "tags" or "keywords" to the contents,…
Zenth
  • 769
  • 2
  • 7
  • 23
8
votes
4 answers

Converting an existing MyISAM database to InnoDB with Django

Is there a way I can convert a full populated MyISAM database to InnoDB (in a way that will create all foreign key constraints, the same way it would be if I ran the syncdb command from the beginning)?
Ohad
  • 1,450
  • 4
  • 18
  • 27
8
votes
3 answers

Mysql Search - InnoDB and transactions vs MyISAM for FULLTEXT search

I'm currently doing research on the best ways to provide an advanced search for my php project. I have narrowed it down to using FULLTEXT search rather than using LIKE to find matching strings in a table row. However, to do this it appears I need to…
Daniel West
  • 1,808
  • 2
  • 24
  • 34