title: Would constraint unique key with lot of fields hurt MySQL performance?
body: <p>We are planning to create an table like below in production environment but concerning about what would happen to storage and query/insert/update performance if we create a constraint key with quite a lot of fields in MySQL like this:</p>
  
  <pre><code>create table table_name
  (
      f1  int null,
      f2  int null,
      f3  int null,
      f4  int null,
      f5  int null,
      f6  int null,
      f7  int null,
      f8  int null,
      f9  int null,
      f10 int null,
      f11 int null,
      f12 int null,
      f13 int null,
      f14 int null,
      f15 int null,
      f16 int null,
      f17 int null,
      f18 int null,
      f19 int null,
      f20 int null,
  
      v1 int null,
      v2 int null,
      v3 int null,
  
      constraint update_key unique (f1, f2, f3, f4, f5, f6, f7, f8, f9, f10,
                                    f11, f12, f13, f14, f15, f16, f17, f18, f19, f20);
  </code></pre>
  
  <p>And insert rows with SQL like this:</p>
  
  <pre><code>insert into table_name (f1,....f20, v1, v2, v3)
          values (values ...)
          on duplicate key update
                v1=v1+values(v1),
                v2=v2+values(v2),
                v3=v3+values(v3);
  </code></pre>
  
  <p>Could anyone give us some advice?</p>