2

I was installing Govway 3.3.2 on a linux machine with Tomcat 7.0.76.0 and MariaDB 10.2.23; when I started importing the sql "GovWay.sql" I got the error "ERROR 1071 (42000): Specified key was too long; max key length is 3072 bytes". I tried to change the character and I also tried to set the following variables:

  • SET GLOBAL innodb_large_prefix=ON;
  • SET GLOBAL innodb_file_format=barracuda;
  • SET GLOBAL innodb_file_per_table=true;

but I haven't solved the problem.

the solutions proposed in this question, it is not possible for me to apply them question

other solutions said to change the

varchar (4000)

but I can't make this change.

any suggestions?

Leo
  • 674
  • 5
  • 18
  • 1
    This is hardcoded restriction, it cannot be altered, see [InnoDB Limitations - Large Prefix Size](https://mariadb.com/kb/en/innodb-limitations/). – Akina Sep 25 '20 at 09:33
  • so it is not possible to do this? did they do something wrong in writing the installation manual? @Akina – Leo Sep 25 '20 at 09:40
  • 1
    Do you really need to index the whole 4000 symbols of the column? Maybe indexing first 3072 chars `CREATE TABLE .. ( .., column VARCHAR(4000) .. INDEX .. (column(3072)), .. )` is enough? – Akina Sep 25 '20 at 09:41
  • I don't know honestly, because it's a third party application. I could try @Akina – Leo Sep 25 '20 at 09:42
  • 1
    Investigate the aim of the problematic index. Maybe it is not needed critically at all? or, for example, even first 10 chars is enough for to improve the queries which uses this index? I think the prefix length is not specified in the DDL at all. – Akina Sep 25 '20 at 09:46
  • Ok, i will try to do as you suggested. Thank you @Akina – Leo Sep 25 '20 at 09:50
  • Please provide `SHOW CREATE TABLE` and the index you would like to add. Then we can point out specifics. Also, provide the `SELECT` that would like to use that index; that way we can point out workarounds. – Rick James Sep 26 '20 at 00:16

1 Answers1

-3

a proposed solution is to comment on the "constraint"

-- CONSTRAINT uniq_pa_behaviour_props_1 UNIQUE (id_porta,nome,valore),

Leo
  • 674
  • 5
  • 18
  • This isn't a great solution as in many cases you need those. For example, I stumbled upon this for a WordPress import error and the tables have to have these. – Tyler C Jun 14 '22 at 15:51