db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rick Hillegas <Richard.Hille...@Sun.COM>
Subject Re: btree overflow during insert
Date Thu, 13 Nov 2008 18:08:18 GMT
Alan Burlison wrote:
> Rick Hillegas wrote:
>
>> Do you really need a 4KB key? That seems like a very big key. Is 
>> there some reduction, summary, or checksum of the text which might 
>> serve as a more compact key?
>
> The key is in fact a SSH key, and we want to prevent duplicates.  We 
> could generate a checksum I suppose, although that would need doing 
> externally to Derby.
>
Hi Alan,

Thanks for the explanation. I see that uniqueness is an issue for you. 
If you could tolerate the slight chance of false duplicates, you might 
want to experiment with generated columns now. I think that there is 
enough functionality checked into the development trunk that you could 
kick the tires. Something like the following might work for you:

create function md5( rawValue varchar( 32672 ) )
  returns varchar( 32 )
  language java
  deterministic
  parameter style java
  no sql
  external name 'ChecksumCalculator.md5';

create table t( rawValue varchar( 32672 ), checksum varchar( 32 ) 
generated always as( md5( rawValue ) ) );
create index checksumIdx on t( checksum );

If this seems appealing, let us know how this works for you.

Thanks,
-Rick




Mime
View raw message