Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Counting Provile Visits: Keys vs. Hashtables
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Dominik Kukacka  
View profile  
 More options Oct 30 2012, 4:19 am
From: Dominik Kukacka <dominik.kuka...@gmail.com>
Date: Tue, 30 Oct 2012 01:19:07 -0700 (PDT)
Local: Tues, Oct 30 2012 4:19 am
Subject: Counting Provile Visits: Keys vs. Hashtables

Hey,

should I count Profile Visits in *Keys* or *Hashtables*?

*profile_visits:{{ID}}:YYYMMDDHH*
*profile_visits:{{ID}}:YYYMMDD
*
*profile_visits:{{ID}}:YYYMM
*
*profile_visits:{{ID}}:YYY
*
*profile_visits:{{ID}}:total*

or.

*profile:visits:{{ID}}*
*    YYYYMMDDHH*
*    YYYYMMDD
*
*    YYYYMM
*
*    YYYY*
*    total*

Which is more size efficient?
Which scales better?
Which is more logical?

Thanks in advanced!
Dominik


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Josiah Carlson  
View profile  
 More options Nov 1 2012, 11:28 am
From: Josiah Carlson <josiah.carl...@gmail.com>
Date: Thu, 1 Nov 2012 08:28:04 -0700
Local: Thurs, Nov 1 2012 11:28 am
Subject: Re: Counting Provile Visits: Keys vs. Hashtables
On Tue, Oct 30, 2012 at 1:19 AM, Dominik Kukacka

Do you ever want to time out your data? If so, you may want to
structure your data such that you can have the data clean itself up
with EXPIRE. Once you have answered that question, then you may want
to consider that short hashes (up to 512 items by default) can use
less space than the equivalent higher-level key. So maybe batch
together a single day or week's worth of hourly data (depending on
your expiration policy), one month's or one year's worth of daily data
(depending on your expiration policy), and maybe keep all of your
monthly/yearly data in a single hash for a given profile.

Regards,
 - Josiah


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Salvatore Sanfilippo  
View profile  
 More options Nov 1 2012, 12:55 pm
From: Salvatore Sanfilippo <anti...@gmail.com>
Date: Thu, 1 Nov 2012 17:55:24 +0100
Local: Thurs, Nov 1 2012 12:55 pm
Subject: Re: Counting Provile Visits: Keys vs. Hashtables

On Thu, Nov 1, 2012 at 4:28 PM, Josiah Carlson <josiah.carl...@gmail.com> wrote:
>> Which is more size efficient?
>> Which scales better?
>> Which is more logical?

> Do you ever want to time out your data? If so, you may want to
> structure your data such that you can have the data clean itself up
> with EXPIRE. Once you have answered that question, then you may want
> to consider that short hashes (up to 512 items by default) can use
> less space than the equivalent higher-level key. So maybe batch
> together a single day or week's worth of hourly data (depending on
> your expiration policy), one month's or one year's worth of daily data
> (depending on your expiration policy), and maybe keep all of your
> monthly/yearly data in a single hash for a given profile.

Agreed, so I would go for:

>> profile:visits:{{ID}}
>>     YYYYMMDDHH
>>     YYYYMMDD
>>     YYYYMM
>>     YYYY
>>     total

YYYYMMDDHH -> hash key named YYYYMMDD, filed HH
YYYYMMDD -> hash with key named YYYYMM, field DD
YYYYMM -> hash with key named YYYY, field MM
YYYY -> hash with key named YYYY (so you reuse the previous hash),
field named "year_total"
total -> put this counter inside the user-specific hash directly to
avoid wasting a singel key for it.

In this way all the hashes should have less tha 512 fields, but you
may want to double check as I'm sleep deprived right now :-)

Cheers,
Salvatore

--
Salvatore 'antirez' Sanfilippo
open source developer - VMware
http://invece.org

Beauty is more important in computing than anywhere else in technology
because software is so complicated. Beauty is the ultimate defence
against complexity.
       — David Gelernter


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic