時間ウィンドウでデータを分析し、hyperloglog
を使用して各時間ウィンドウの基数を見積もることができます。
たとえば、あなたは毎日の分析のためhyperloglog
を使用することができます。
// for each key that has been read or written in day1
// add it to the corresponding hyperloglog
pfadd key-count-day1 a b
pfadd key-count-day1 c d e
// for each key that has been read or written in day2
// add it to the corresponding hyperloglog
pfadd key-count-day2 a
pfadd key-count-day2 c
をこのケースでは、そのキーhyperloglog
でdayNにアクティブをしている鍵の推定数を取得することができますkey-count-dayN
です。
pfcount
とすると、の番号を有効にしてのキーを毎日または数日間得ることができます。これら2つのカウントで
// number of active keys in day2: count2
pfcount key-count-day2
// number of active keys in day1 and day2: count-total
pfcount key-count-day1 key-count-day2
は、あなたは2日目以降使用されていないキーの割合を計算することができます(count-total - count2)/count-total