You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Per Ejeklint <ej...@mac.com> on 2009/10/03 15:29:00 UTC

Short keys == faster lookups?

Please excuse a silly question from a newbie. I have a db that grows  
pretty fast (data measurements done every minute all year around). I  
wonder what I save if I mangle keys to be as short as possible. Like  
instead of calling things "temp_outside" I rename them to "t_o" or  
something like it. The size of the db will of course shrink, but will  
it do anything for indexing/lookup speed when I search in the db?

/Per

Re: Short keys == faster lookups?

Posted by Damien Katz <da...@apache.org>.
On Oct 3, 2009, at 3:43 PM, Paul Davis wrote:

> Technically speaking you could probably engineer keys to exhibit bad
> collation behavior, but that'd take some thought. Something like 1KiB
> or larger keys with long identical prefixes.
>
> That said, measure twice, code once. I've never heard any numbers on  
> it.

Good advice. My knowledge of couchdb internals says shorter is faster,  
but by how much, I don't know. Probably not much. Definitely benchmark  
with production sized data to see if it makes any significant  
difference.

-Damien

>
> Paul Davis
>
> On Sat, Oct 3, 2009 at 9:29 AM, Per Ejeklint <ej...@mac.com> wrote:
>> Please excuse a silly question from a newbie. I have a db that  
>> grows pretty
>> fast (data measurements done every minute all year around). I  
>> wonder what I
>> save if I mangle keys to be as short as possible. Like instead of  
>> calling
>> things "temp_outside" I rename them to "t_o" or something like it.  
>> The size
>> of the db will of course shrink, but will it do anything for  
>> indexing/lookup
>> speed when I search in the db?
>>
>> /Per
>>


Re: Short keys == faster lookups?

Posted by Paul Davis <pa...@gmail.com>.
Technically speaking you could probably engineer keys to exhibit bad
collation behavior, but that'd take some thought. Something like 1KiB
or larger keys with long identical prefixes.

That said, measure twice, code once. I've never heard any numbers on it.

Paul Davis

On Sat, Oct 3, 2009 at 9:29 AM, Per Ejeklint <ej...@mac.com> wrote:
> Please excuse a silly question from a newbie. I have a db that grows pretty
> fast (data measurements done every minute all year around). I wonder what I
> save if I mangle keys to be as short as possible. Like instead of calling
> things "temp_outside" I rename them to "t_o" or something like it. The size
> of the db will of course shrink, but will it do anything for indexing/lookup
> speed when I search in the db?
>
> /Per
>