From 0c621f8bc5309041d97dd5b00ec31bfdc794876f Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Mon, 15 Apr 2019 03:44:08 +0000 Subject: [PATCH] InnoDB as the default table type --- ...08-09-innodb-as-the-default-table-type.html | 18 ++++++++++++++++++ index.html | 1 + ...1-08-09-innodb-as-the-default-table-type.md | 17 +++++++++++++++++ markdown/index.md | 1 + 4 files changed, 37 insertions(+) create mode 100644 2011-08-09-innodb-as-the-default-table-type.html create mode 100644 markdown/2011-08-09-innodb-as-the-default-table-type.md diff --git a/2011-08-09-innodb-as-the-default-table-type.html b/2011-08-09-innodb-as-the-default-table-type.html new file mode 100644 index 0000000..5cc0b53 --- /dev/null +++ b/2011-08-09-innodb-as-the-default-table-type.html @@ -0,0 +1,18 @@ + + + + + +

We recently switched from MyISAM to InnoDB as the default table type. This affects CREATE TABLE without an explicit ENGINE=, as well as implicitly-created tables for sorting and such. Mark had previously discussed issues with this here, but we thought it was worth giving another try.

+ +

We've found a far more basic problem: KILL takes a long time. Consider the following:

+ +
CREATE TABLE scratch.MyShortLivedTable 
+  SELECT * FROM A JOIN B JOIN C....;
+
+ +

There's no ENGINE= there, so it uses the default table type. It seems to run at about the same speed as it did with MyISAM, but then you kill it. If it's MyISAM, the KILL takes effect immediately. If it's InnoDB, the CREATE is non-transactional and stays, but the implicit INSERTs have to be rolled back. If that query took 10 minutes, it may take 10 minutes to roll back, during which time the query is unkillable and MySQL won't shut down cleanly.

+ +

Our failovers rely on being able to kill all connections to a slave that they're promoting to master. Our backups rely on being able to shut down MySQL. We don't have a good answer for this, short of hardwiring ENGINE=MyISAM onto writes we know are going to be large.

+ + diff --git a/index.html b/index.html index a77fd1f..0f6a30f 100644 --- a/index.html +++ b/index.html @@ -20,6 +20,7 @@
  • 2016-Feb-15: Cable modem channel party
  • 2016-Feb-01: How to enrage your cable modem
  • 2016-Feb-01: Hall of 2.4 GHz Shame, 2016 Edition
  • +
  • 2011-Aug-09: InnoDB as the default table type
  • 2011-Aug-08: Database best practices for future scalability
  • 2011-Jul-12: Converting subselects to joins
  • 2011-Apr-22: Avoid MySQL round trips
  • diff --git a/markdown/2011-08-09-innodb-as-the-default-table-type.md b/markdown/2011-08-09-innodb-as-the-default-table-type.md new file mode 100644 index 0000000..ab3ef82 --- /dev/null +++ b/markdown/2011-08-09-innodb-as-the-default-table-type.md @@ -0,0 +1,17 @@ + + + + + +We recently switched from MyISAM to InnoDB as the default table type. This affects CREATE TABLE without an explicit ENGINE=, as well as implicitly-created tables for sorting and such. Mark had previously discussed issues with this [here](http://mysqlha.blogspot.com/2009/06/what-could-possibly-go-wrong.html), but we thought it was worth giving another try. + +We've found a far more basic problem: KILL takes a long time. Consider the following: + + CREATE TABLE scratch.MyShortLivedTable + SELECT * FROM A JOIN B JOIN C....; + +There's no ENGINE= there, so it uses the default table type. It seems to run at about the same speed as it did with MyISAM, but then you kill it. If it's MyISAM, the KILL takes effect immediately. If it's InnoDB, the CREATE is non-transactional and stays, but the implicit INSERTs have to be rolled back. If that query took 10 minutes, it may take 10 minutes to roll back, during which time the query is unkillable and MySQL won't shut down cleanly. + +Our failovers rely on being able to kill all connections to a slave that they're promoting to master. Our backups rely on being able to shut down MySQL. We don't have a good answer for this, short of hardwiring ENGINE=MyISAM onto writes we know are going to be large. + + diff --git a/markdown/index.md b/markdown/index.md index 4662f2a..fbb7a47 100644 --- a/markdown/index.md +++ b/markdown/index.md @@ -19,6 +19,7 @@ 1. 2016-Feb-15: [Cable modem channel party](2016-02-15-cable-modem-channel-party.html) 1. 2016-Feb-01: [How to enrage your cable modem](2016-02-01-how-to-enrage-your-cable-modem.html) 1. 2016-Feb-01: [Hall of 2.4 GHz Shame, 2016 Edition](2016-02-01-hall-of-2-4-ghz-shame-2016-edition.html) +1. 2011-Aug-09: [InnoDB as the default table type](2011-08-09-innodb-as-the-default-table-type.html) 1. 2011-Aug-08: [Database best practices for future scalability](2011-08-08-database-best-practices-for-future-scalability.html) 1. 2011-Jul-12: [Converting subselects to joins](2011-07-12-converting-subselects-to-joins.html) 1. 2011-Apr-22: [Avoid MySQL round trips](2011-04-22-avoid-mysql-round-trips.html)