官术网_书友最值得收藏!

  • Mastering Redis
  • Jeremy Nelson
  • 200字
  • 2021-04-02 20:37:58

Advanced sorted set operations

Similarly to sets, sorted sets in Redis support the set operations of union and intersection, although the time complexity of these operations for sorted sets is worse than for sets. Another problem with the sorted set operations is that when using a Redis cluster, union and intersection operations can only be used when the sorted set keys have been sharded to the same hash slot and run on the same node. The ZINTERSTORE Redis command has a time complexity of O(nk)+O(mlog(m)), where n is the size of the smallest sorted set; k, the total number of sorted sets being intersected, and m, the number of elements in the resulting final sorted set. Likewise, for the ZUNIONSTORE command, the time complexity is O(n)+O(M log(M)) with n being the total size of all the sorted sets and m being the total number of elements in the final sorted set. Given the characteristics of sorted sets, the additional time required for these two set operations may be an acceptable trade-off. It is good to keep in mind this difference in performance between large sets and sorted sets irrespective of whether the data and your requirements require ordering or not.

主站蜘蛛池模板: 天镇县| 偏关县| 广东省| 望江县| 绥中县| 岳普湖县| 神农架林区| 吴忠市| 广水市| 两当县| 武平县| 广西| 茶陵县| 榆林市| 溧水县| 留坝县| 湘潭市| 弥渡县| 鞍山市| 灵川县| 庆城县| 江津市| 镇原县| 温泉县| 宣化县| 锡林浩特市| 广汉市| 平利县| 巍山| 桃园市| 西乌| 湟源县| 仁寿县| 蒲江县| 鄱阳县| 东方市| 松溪县| 台前县| 永福县| 安龙县| 惠水县|