maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #09357
Re: GSoC 2016:Unique indexes for blobs
Hello everyone
@Shubham
As I said i am just prototyping
This is not the final code
It is just poc to see whether if I send some unique key will mi_create work
fine or not as it is working fine in create_internal_tmp_table on following
query "select distinct(a2) from tbl" where schema of tbl will be a1 int
primary key ,a2 blob
On Wed, Mar 16, 2016 at 9:18 AM, Shubham Barai <shubhambaraiss@xxxxxxxxx>
wrote:
> Hello, Sergie!
> I tried to explore the source code from
> mi_create.c,ha_myisam.cc,sql/sql_table.cc,include/myisam.h,.and some
> other files.
> The main task is to create MI_UNIQUEDEF "uniques" for long unique
> constraints.
> We have to consider all the cases where we need to create MI_UNIQUEDEF
> instead of MI_KEYDEF.
>
> It will include queries like
> create table table1 (blob_column blob,unique(blob_column) );
> create table table1 (a int,blob_column
> blob,unique(a,blob_column) );
> create table table1 (a int,blob_column1 blob,blob_column2
> blob,unique(blob_column1(300),blob_column2) );
> (key with multiple blob columns and one of the blob column specified with
> prefix length).
>
> I think we have to create MI_UNIQUEDEF if any one of the columns in a
> key is a blob field without prefix length.
>
> In sql/sql_table, mysql_prepare_create_table is the function which
> prepares the table and key structures for table creation in mi_create. It
> generates an error if any one of the blob fields in a key is specified
> without length.
> Currently, this task is limited to MyISAM, so if any other storage engine
> is selected, we have to generate the same error in
> mysql_prepare_create_table.
>
> In storage/myisam/ha_myisam.cc, table2myisam is a function which allocates
> and initializes myisam key and column definitions.The current function
> prototype of table2myisam is
> table2myisam(TABLE *table_arg, MI_KEYDEF **keydef_out,
> MI_COLUMNDEF **recinfo_out, uint records_out)
> We have to change it to
> table2myisam(TABLE *table_arg,MI_KEYDEF **keydef_out,MI_UNIQUEDEF **
> uniquedef_out,MI_COLUMNDEF **recinfo_out,uint records_out)
>
> table2myisam initializes all the key definitions from table_arg->keyinfo.
> So we can set a new flag (say uniquedef) in a keyinfo struct in
> mysql_prepare_create_table if any one of the key_part consists of blob
> field without prefix length.
> Later we can check the flag in table2myisam to see if we want to create
> MI_KEYDEF or MI_UNIQUEDEF.
>
> Thanks,
> Shubham.
>
> On 5 March 2016 at 03:52, Sergei Golubchik <serg@xxxxxxxxxxx> wrote:
>
>> Hi, Shubham!
>>
>> On Mar 03, Shubham Barai wrote:
>> >
>> > I am interested in the project "Unique indexes for blobs".I have read
>> the
>> > description of the project given on the link
>> > https://jira.mariadb.org/browse/MDEV-371.
>>
>> Great!
>>
>> > I want to know what exactly is the task for this project.Any help
>> > would be greatly appreciated
>>
>> See storage/myisam/mi_create.c. You see that a myisam table can have
>> keys (defined in MI_KEYDEF structure) and so-called "uniques" (defined
>> by MI_UNIQUEDEF).
>>
>> Keys have length limitation, keys can be unique (HA_NOSAME flag) or not
>> unique.
>>
>> "uniques" have no length limitation.
>>
>> When one creates a unique key from SQL:
>>
>> CREATE TABLE ... (... UNIQUE KEY (...) ... )
>>
>> this will always create a key (MI_KEYDEF) in a MyISAM table. That's why
>> unique constraints in MyISAM have a limited length.
>>
>> This task is about creating MI_UNIQUEDEF "uniques" instead of MI_KEYDEF
>> "keys" for long unique constraints.
>>
>> Regards,
>> Sergei
>> Chief Architect MariaDB
>> and security@xxxxxxxxxxx
>>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~maria-developers
> Post to : maria-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~maria-developers
> More help : https://help.launchpad.net/ListHelp
>
>
References