Guest User

Untitled

a guest
May 24th, 2018
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.83 KB | None | 0 0
  1. CREATE TABLE `phppos_modules_actions` (
  2. `action_id` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
  3. `module_id` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
  4. `action_name_key` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
  5. `sort` INT NOT NULL ,
  6. PRIMARY KEY ( `action_id` , `module_id` )
  7. ) ENGINE = INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci;
  8.  
  9. Options in my.cnf
  10. sql-mode=""
  11. default-storage-engine=MYISAM
  12. skip-innodb uncommented (without#)
  13.  
  14. Return on execution of your create statement:
  15. Error Code: 1071. Specified key was too long; max key length is 1000 bytes
  16.  
  17. Explanation: INNODB is not active, the engine is automatically switched to MYISAM
  18. that returns this error as they key is longer than MYISAM 1000 bytes limit.
  19. The key length is:
  20. 2 fields x 255 char x 3 bytes utf8 encoding + 2 x 1 length byte = 1532 bytes
  21.  
  22. Options in my.cnf
  23. sql-mode="NO_ENGINE_SUBSTITUTION"
  24. default-storage-engine=MYISAM
  25. skip-innodb uncommented (without#)
  26.  
  27. Return on execution of your create statement:
  28. Error Code: 1286. Unknown table engine 'INNODB'
  29.  
  30. Explanation: INNODB is not active but the engine substitution is not permitted
  31. by sql mode therefore the DB returns an error about the attempt of using a disabled engine.
  32.  
  33. Options in my.cnf
  34. sql-mode="NO_ENGINE_SUBSTITUTION"
  35. default-storage-engine=MYISAM
  36. skip-innodb commented (with#)
  37.  
  38. Return on execution of your create statement:
  39. Table creation OK!
  40.  
  41. Explanation: INNODB is active (skip-innodb commented) and it is used also if
  42. the default engine is MYISAM.
  43.  
  44. Error Code: 1071. Specified key was too long; max key length is 1000 bytes
  45.  
  46. Error Code: 1071. Specified key was too long; max key length is 767 bytes
  47.  
  48. 256 x 3 + 2 = 770 bytes
  49.  
  50. 255 x 3 + 1 = 766 bytes
  51.  
  52. Error Code: 1071. Specified key was too long; max key length is 767 bytes
  53.  
  54. Error Code: 1071. Specified key was too long; max key length is 3072 bytes
  55.  
  56. CREATE TABLE `phppos_modules_actions` (
  57. `action_id` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
  58. `module_id` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
  59. `action_name_key` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
  60. `action_name_key1` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
  61. `action_name_key2` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
  62. `sort` INT NOT NULL ,
  63. PRIMARY KEY ( `action_id` , `module_id`, `action_name_key`, `action_name_key1`, `action_name_key2` )
  64. ) ENGINE = INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci;
  65.  
  66. Error Code: 1071. Specified key was too long; max key length is 3072 bytes
  67.  
  68. KEY `key_name` (`action_id`(50),`module_id`(50))
  69.  
  70. CREATE TABLE `phppos_modules_actions` (
  71. `action_id` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
  72. `module_id` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
  73. `action_name_key` VARCHAR( 255 ) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL ,
  74. `sort` INT NOT NULL ,
  75. PRIMARY KEY ( `action_id`(50) , `module_id`(50) )
  76. ) ENGINE = INNODB CHARACTER SET utf8 COLLATE utf8_unicode_ci;
  77.  
  78. SELECT
  79. ROUND(SUM(LENGTH(`action_id`)<10)*100/COUNT(*),2) AS pct_length_10,
  80. ROUND(SUM(LENGTH(`action_id`)<20)*100/COUNT(*),2) AS pct_length_20,
  81. ROUND(SUM(LENGTH(`action_id`)<50)*100/COUNT(*),2) AS pct_length_50,
  82. ROUND(SUM(LENGTH(`action_id`)<100)*100/COUNT(*),2) AS pct_length_100
  83. FROM `phppos_modules_actions`;
  84.  
  85.  
  86. +---------------+---------------+---------------+----------------+
  87. | pct_length_10 | pct_length_20 | pct_length_50 | pct_length_100 |
  88. +---------------+---------------+---------------+----------------+
  89. | 42.86 | 80.20 | 100 | 100 |
  90. +---------------+---------------+---------------+----------------+
Add Comment
Please, Sign In to add comment