首页
\
问答
\
在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 ...
-
sql join distinct php(sql join distinct php)[2021-08-18]
如果您只想显示一个,请使用相关子查询: 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.
-
SQL与INNER JOIN不同(SQL Distinct with INNER JOIN)[2022-11-17]
而不是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 ...
-
SQL与SUM的区别连接(SQL Distinct join with SUM)[2022-09-11]
在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 ... -
SQL Server DISTINCT(SQL Server DISTINCT)[2022-05-30]
只需编写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 ...