Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-371

Unique indexes for blobs




      Allow a user to create unique constraints of arbitrary length. This will be done on the upper layer, in the server, not in the engine. The server will create the invisible virtual column with a hash over the to-be-unique columns. And a normal BTREE index over this column. On insert or update it'll check the index for hash collisions and, if needed, will retrieve the actual rows to compare the data.

      original bug report:

      hi guys, i was reading about index... and i have a interesting problem...
      i need to check if a file (ok a big row... no problem...) is inside my table...
      what i´m thinking....
      create table a(b int not null default '',c longblob not null, primary key b)
      ok no problems....
      the problem is... how to know if a file, let´s sai a file of 16MB is inside my table...
      first solution is... MD5 and check each row... OK nice work....
      but could be a other nicer solution?!
      i was thinking something like:

      alter table a
      add index some_index(c) using hash;

      could this work? since it´s a hash index, i don´t see why should i use a part of c value like c (100) for example...

      could check if this is possible? today not... i tryed and it return:
      /* SQL Error (1170): Coluna BLOB 'hash_automatico' usada na especificação de chave sem o comprimento da chave */ (in portugues PT_BR)

      i think that´s all


        Issue Links



              sachin.setiya.007 Sachin Setiya (Inactive)
              rspadim roberto spadim
              1 Vote for this issue
              10 Start watching this issue



                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.