maria-developers team mailing list archive
Mailing list archive
Re: InnoDB blob for primary key
On Apr 18, Sachin Setia wrote:
> Hi Actually I was thinking about how to implement blob as a foreign
> key.Foreign has to be unique which we can already implement. To make
> it foreign key we can either store unique hash or the whole blob
> column. But I am not sure much people want to copy so long blob data
> in reference table.
> Second option would be use blob hash as a reference key.
> But user can not directly us hash as a reference key
> because that is hidden.
> What I was thinking of a clear to programmer way of
> using blob hash. Suppose user can directly create
> blob hash column ,use that column as a primary key or
> foreign key.Like
> create table t1(abc blob , blob hash(abc))//this will just create blob hash
> create table t1(abc blob,unique(blob hash(abc))) // this will create unique
> blob hash column
> and similar for primary key and foreign key
> user can enter hash value if they have some good algorithm
> or if they do not give any value we will automatically
> create and store hash. What do you think? sir.
Mixed feelings. First, I wrote in an earlier email about using virtual
columns for that. In this line of thoughts, a user-specified hash
function is absolutely possible and logical.
On the other hand, I don't see why anyone would need that - a hash is
not guaranteed to be unique, no matter what algorithm one uses.
And, as I wrote in an earlier email, I don't think that primary/foreign
keys on blobs is a feature worth spending time on.
Chief Architect MariaDB