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

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.

主站蜘蛛池模板: 紫金县| 惠水县| 沁水县| 温州市| 兰考县| 越西县| 天镇县| 山东| 兴安盟| 兴安县| 吉安市| 河东区| 文化| 巴楚县| 镇赉县| 英德市| 多伦县| 万源市| 洛川县| 浏阳市| 江山市| 临沧市| 兴国县| 衡水市| 札达县| 涟水县| 松潘县| 崇信县| 清徐县| 新安县| 静宁县| 德昌县| 南丹县| 华池县| 黄平县| 噶尔县| 达尔| 台前县| 长春市| 称多县| 昭觉县|