cassandra ALLOW FILTER 的工作原理
2015-09-10 14:17
281 查看
创建一下一个table:
CREATE TABLE ruling_stewards ( steward_name text, king text, reign_start int, event text, PRIMARY KEY (steward_name, king, reign_start) );当用
SELECT * FROM ruling_stewards WHERE king = 'none' AND reign_start >= 1500 AND reign_start < 3000 LIMIT 10 ALLOW FILTERING;时,会报错误:
Bad Request: Cannot execute this query as it might involve data filtering and thus may have unpredictable performance. If you want to execute this query despite the performance unpredictability, use ALLOW FILTERING.
要求用allow filtering, 为啥呢 ?官方的解释是:
ALLOW FILTERING will probably become less strict as we collect more statistics on our data. For example, if we knew that 90% of entries have no king we would know that finding 10 such entries should be relatively inexpensive.
加了ALLOW FILTERING 后,cassandra会根据已经创建好的统计表,查询那些NODE 上最有可能有king这个cluster, 然后到最有可能的node上去找满足条件的entries。 如果没有加ALLOW FILTERING , 那就是盲找,这个查询代价非常高。
相关文章推荐
- Caffe学习:pycaffe利用caffemodel进行分类
- access判断文件是否存在,是否可读可写等
- 流量统计工具 Piwik 简介
- springmvc+font-awesome开发出的页面显示方框乱码的解决方法
- APP有哪些常被黑客利用的安全漏洞
- opencv实例二:缩放一张图片
- TweenLite属性——.ononOverwrite
- 各种集合
- poj2762 强连通+拓扑序
- linux SVN常见问题解决
- Jenkins+maven+pmd对java代码进行静态代码分析
- Java中的final关键字
- Oracle用户创建及权限设置
- 悲观锁与乐观锁
- C++ 排序
- 配置MST实现负载均衡
- Vin2008 X64安装.Net Framework1.1
- ITRON系统
- nginx上设置禁止通过ip访问服务器,只能通过域名访问
- lintcode-删除数字-182