首页 \ 问答 \ 在cassandra中读取请求(使用replica 3和一致性ONE)是否返回数据?(Does read request in cassandra (with replica 3 and consistency ONE) return the data?)

在cassandra中读取请求(使用replica 3和一致性ONE)是否返回数据?(Does read request in cassandra (with replica 3 and consistency ONE) return the data?)

我有一个包含5个节点,副本3和一致性ONE的群集。 如果没有节点关闭,写入成功,并且没有更新命令!


如果我插入一个数据(一致性ONE),然后立即选择该数据(一致性ONE),当数据不存在于其他replicas.does它总是给我的数据(不管它是否过期)?


I have a cluster with 5 node, replica 3, and consistency ONE. If no node goes down, write success, and no Update commands!


if i insert a data (consistency ONE) and then immediately select that data (consistency ONE), when data not exist in other replicas.does it always give me the data (no matter if it is out of date)?


原文:https://stackoverflow.com/questions/41261829
更新时间:2023-12-06 12:12

最满意答案

如果您只想显示一个,请使用相关子查询:

select p.*,
       (select ph.url_little
        from ".Constants::$PHOTOS_PRODUCTS_TABLE." ph
        where p.id = ph.id_product
        order by ph.id asc
        limit 1
       ) as url_little
from  ".Constants::$PRODUCTS_TABLE." as p 
where p.id_client = ?;

If you only want to show one, use a correlated subquery:

select p.*,
       (select ph.url_little
        from ".Constants::$PHOTOS_PRODUCTS_TABLE." ph
        where p.id = ph.id_product
        order by ph.id asc
        limit 1
       ) as url_little
from  ".Constants::$PRODUCTS_TABLE." as p 
where p.id_client = ?;

相关问答

更多
  • 我使用下列表格对MS SQL 2005进行了测试:400K行,B 26K行和C 450行。 估计的查询计划表明,基本内部连接比嵌套子查询慢3倍,但是当实际运行查询时,基本内部连接的速度是嵌套查询的两倍,基本内部连接非常耗时297ms最小的服务器硬件 你在使用什么数据库,以及你看到了什么? 我想如果你看到糟糕的表现,那么这可能是一个索引问题。 I did a test on MS SQL 2005 using the following tables: A 400K rows, B 26K rows and ...
  • 如果您只想显示一个,请使用相关子查询: select p.*, (select ph.url_little from ".Constants::$PHOTOS_PRODUCTS_TABLE." ph where p.id = ph.id_product order by ph.id asc limit 1 ) as url_little from ".Constants::$PRODUCTS_TABLE." as ...
  • 你没有提到在station1_validated中是否存在station1_validated中不存在的记录,所以我使用了FULL JOIN 。 如果station1_validated所有行都存在于station1_nrt则可以使用LEFT JOIN。 像这样的东西 SELECT IFNULL(n.timed,v.timed) as timed, CASE WHEN v.timed IS NOT NULL THEN v.CO2 ELSE n.CO2 END as CO2, CA ...
  • 您需要将表连接在一起并应用DISTINCT : SELECT DISTINCT p.PrdNo, p.PrdName, o.OrdState FROM Product AS p INNER JOIN OrderList AS ol ON p.PrdNo = ol.PrdNo INNER JOIN Orders AS o ON o.OrdNo = ol.OrdNo WHERE o.OrdState = 'CA' ORDER BY PrdName 在这里演示 You need to join the tabl ...
  • 由于s.id似乎是wp_bbpas的唯一键,因此应将其排除在SELECT列表之外以将结果减少到不同的用户。 Since s.id appears to be the unique key of wp_bbpas, it should be left out of the SELECT list to reduce the result to distinct users.
  • 而不是DISTINCT ,使用GROUP BY 。 见下文: $query_result = mysqli_query($db, "SELECT C.name FROM Category AS C INNER JOIN MarketProduct AS MP ON C.Category_ID = MP.ID_Category WHERE MP.ID_Market ='$id' GROUP BY C.name"); Instead of DISTINCT, use GROUP BY. See below ...
  • 我建议将您的查询分开并检查重复项。 我的猜测是你的数据/ sub_ID不是很独特。 从您的子查询开始,因为您将返回所有这些列。 如果您在那里获得重复项,则无论您的排除表中包含哪些内容,您的查询都将返回重复项。 清除这些重复项后,请检查排除表中是否存在重复的sub_Id。 为了节省故障排除的时间,如果存在重复的已知罪魁祸首,您可能希望限制返回值,以便您可以专注于这些数据的特性。 我不确定这是一个问题,但请查看逻辑 on List_to_Check.SUB_ID = Master_List.SUB_I ...
  • 在join之前做distinct事情: select a.reference, sum(b.amount) from (select distinct reference from a) a left join b a.Reference = b.Reference group by a.reference; 您几乎从不需要使用select distinct group by with group by 。 Do the distinct before the join: sele ...
  • 只需编写SELECT DISTINCT ... SELECT distinct dbo.CLIENTREP.ref, dbo.REP2.ref FROM dbo.CLIENTREP FULL OUTER JOIN dbo.REP2 ON (dbo.REP2.ref = dbo.CLIENTREP.ref) WHERE dbo.REP2.ref is null OR dbo.CLIENTREP.ref IS NULL; Just write SELECT DISTINCT ... SELECT disti ...
  • 在我看来,你有一个给定的表B实体的多个表A记录,是吗? 顺便说一下,你的列名很糟糕...... table_B.id = table_A.TA_user ???? 如何检查您的数据库应该知道存在这种关系? 但这不是重点。 无论如何,我猜你是否试图返回在给定日期的table_A中有记录的表B实体? 如果是这样,不同应该对你有用。 我可能会使用group by,因为它通常更快。 但如果我理解正确的话,这应该做你想要的。 SELECT DISTINCT table_B.TB_name FROM table ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。