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
22
votes
2 answers

Warning: A long semaphore wait

For the past 4 days I have had massive problems with my nightly updates, except for 1 night were it all went fine in between these 4 days. During these updates i update a couple of fulltext indexes. I do it in this manner. Drop the fulltext…
Mad Dog Tannen
  • 7,129
  • 5
  • 31
  • 55
22
votes
2 answers

Any way to check if innodb_file_per_table is set in MYSQL 5.5 per table?

I want to check if innodb_file_per_table is set (i.e .ibd is created) for each database tables using MYSQL-5.5 query. Any way to do it?
Deepak Ingole
  • 14,912
  • 10
  • 47
  • 79
22
votes
1 answer

Storing base64 encoded data as BLOB or TEXT datatype

We have a MySQL InnoDB table holding ~10 columns of small base64 encoded javascript files and png (<2KB size) images base64 encoded as well. There are few inserts and a lot of reads comparatively, however the output is being cached on a Memcached…
21
votes
1 answer

How to check if MySQL table is UTF-8 and has storageEngine InnoDB?

Googling around just finds instructions for changing from one format to another, but I can't seem to find how exactly to make sure which of these I have first. How can I: Check what character encoding a table has? Check what storage engine a table…
GeekedOut
  • 16,905
  • 37
  • 107
  • 185
20
votes
1 answer

How to handle MySQL deadlock situations on an application level?

When a deadlock situation occurs in MySQL/InnoDB, it returns this familiar error: 'Deadlock found when trying to get lock; try restarting transaction' So what i did was record all queries that go into a transaction so that they can simply be…
leiavoia
  • 533
  • 1
  • 6
  • 12
20
votes
1 answer

Why we still need innodb redo log when mysql binlog has been enabled?

In my understanding, mysql binlog can fully function as InnoDB's redo log. So, after the binlog is enabled, why does InnoDB have to write a redo log at the same time instead of just switching to use the binlog? Doesn't this significantly slow down…
ASBai
  • 724
  • 2
  • 7
  • 17
20
votes
2 answers

mysqld service won't start

After Fedora 28 decided to upgrade mysql-community packages to 8.0 (latest) ,I realized my application was failing and had to downgrade to mysql 5.27.2 Of course my db files (.idb) were the same (altered by mysql 8.0). When starting mysql 5.27…
julianm
  • 2,393
  • 1
  • 23
  • 24
20
votes
2 answers

MySQL: Column Contains Word From List of Words

I have a list of words. Lets say they are 'Apple', 'Orange', and 'Pear'. I have rows in the database like this: ------------------------------------------------ |author_id | content …
mellowsoon
  • 22,273
  • 19
  • 57
  • 75
20
votes
6 answers

mysql_upgrade failed - innodb tables doesn't exist?

I am upgrading my mysql-5.5 docker container database to mysql-5.6 docker container. I was able to fix all other problems. Finally my server is running with 5.6. But when i run mysql_upgrade i am getting the following…
Gangaraju
  • 4,406
  • 9
  • 45
  • 77
20
votes
6 answers

MySQL Insert performance degrades on a large table

I'm working with a huge table which has 250+ million rows. The schema is simple. CREATE TABLE MyTable ( id BIGINT PRIMARY KEY AUTO_INCREMENT, oid INT NOT NULL, long1 BIGINT NOT NULL, str1 VARCHAR(30) DEFAULT NULL, …
Shashikant Kore
  • 4,952
  • 3
  • 31
  • 40
20
votes
3 answers

How to avoid jobs DB table locks issue when using Laravel queues?

I'm using Laravel 5.1. The queues are used for data fetching/syncing between several systems. I use the database driver, 3 "artisan queue:work --daemon" processes are running all the time. The jobs are dispatched both by system users and scheduler…
MaGnetas
  • 4,918
  • 4
  • 32
  • 52
20
votes
2 answers

MySQL row_format compressed vs dynamic

I've changed "innodb_file_format" from "Antelope" to "Barracuda" bcoz of following reasons. To avoid row size limit To avoid column index size limit While doing file format change i chosen "row_format" as "dynamic". This is working fine. But, i…
Murali Mopuru
  • 6,086
  • 5
  • 33
  • 51
20
votes
6 answers

Should I always prefer MySQL InnoDB over MyISAM?

Someone just told me that InnoDB is much better than MyISAM. So when I create a table, should I always try to use InnoDB Engine instead of MyISAM? Or do both have it's big benefits?
openfrog
  • 40,201
  • 65
  • 225
  • 373
20
votes
4 answers

How do I check my InnoDB settings?

Is there a MySQL command that I can execute which will show settings such as innodb_file_format, or a configuration file which I should check? MySQL version: 5.5.32
Lemmings19
  • 1,383
  • 3
  • 21
  • 34
19
votes
2 answers

Muzak replication advice and techniques

I am attempting my first large scale database project on my own. I have a myisam mysql db on server 1 with a php app consuming large amount of various data. I have mysql myisam on server 2 with php app selecting and displaying data. I want to…
user915831
  • 241
  • 1
  • 2