首页
\
问答
\
我们可以重用多线程之间的hbase Java客户端连接吗?(Can we reuse the hbase Java client Connection between multi-threads?)
我们可以重用多线程之间的hbase Java客户端连接吗?(Can we reuse the hbase Java client Connection between multi-threads?)
在我们的环境中,我们使用多线程通过hbase Java Client调用hbase,并且在我们完成操作时我们在每个线程中调用Connection.close(),但是我们发现Connection.close()花了大约10毫秒,所以可能我知道是否可以在不关闭连接的情况下重用线程之间的连接?
In our environment we use the multi-threads call the hbase by hbase Java Client, and in each thread we call the Connection.close() when we finished the operation, however we found Connection.close() spent around 10 milliseconds, so may I know if it is possible reuse the connection between threads without closing the connection?
原文:
更新时间:2021-12-13 19:12
最满意答案
使用mutlirows变量赋值时不要依赖于order。
试试这个例子:
DECLARE @c INT = 0 SELECT @c = @c + x FROM (VALUES(1),(2),(3)) AS src(x) WHERE x BETWEEN 1 AND 3 ORDER BY 1 - x DESC SELECT @c SET @c = 0 SELECT @c = @c + x FROM (VALUES(1),(2),(3)) AS src(x) WHERE x BETWEEN 1 AND 3 ORDER BY x DESC SELECT @c
http://sqlmag.com/sql-server/multi-row-variable-assignment-and-order
Don't rely on order by when using mutlirows variable assignment.
try this for instance:
DECLARE @c INT = 0 SELECT @c = @c + x FROM (VALUES(1),(2),(3)) AS src(x) WHERE x BETWEEN 1 AND 3 ORDER BY 1 - x DESC SELECT @c SET @c = 0 SELECT @c = @c + x FROM (VALUES(1),(2),(3)) AS src(x) WHERE x BETWEEN 1 AND 3 ORDER BY x DESC SELECT @c
http://sqlmag.com/sql-server/multi-row-variable-assignment-and-order
相关问答
更多-
SELECT @CategoryId = A_categoryId from dbo.categories... 话虽如此,请不要发布有关如何在SO上分配变量的问题。 这实际上远低于网站的范围,可以通过查看SQL Server的任何文档来解决。 SELECT @CategoryId = A_categoryId from dbo.categories... That being said, please don't post questions about how to assign variables o ...
-
你不需要pl / sql - 你可以在一个更新语句中完成 - 例如: create table test1 as select 20 order_id, 'CAR' t_name, 50 t_price from dual union all select null order_id, 'VAN' t_name, 100 t_price from dual union all select null order_id, 'BIKE' t_name, 10 t_price from dual union al ...
-
case的语法是: (CASE WHEN wo_6.hil = 'Y' THEN 'DD' ELSE 'TTTT' END) as xx 括号是不需要的(尽管推荐它们),但是END是。 注意:这取决于您的代码。 您的描述不指定该值既不是'Y'也不是空白时要执行的操作。 The syntax for case would be: (CASE WHEN wo_6.hil = 'Y' THEN 'DD' ELSE 'TTTT' END) as xx The parentheses are not needed ...
-
将单个SQL SELECT语句查询结果分配给PHP变量(Assign a Single SQL SELECT Statement query result to a PHP Variable)[2022-03-07]
显然,在使用var_dump来调试Chris所述的问题之后,问题被缩小为mysql_fetch_object($caridresult);收集的NULL值mysql_fetch_object($caridresult); 。 由于数据库连接使用@$dbcnx = new mysqli('localhost','values','values','values'); DB类检索数组值是错误的。 因此解决方案是mysqli_fetch_array 。 这些代码可能对尝试调试的人有帮助:选择变量中的语句(Select statement in a variable)[2023-05-20]
您可以使用ref cursors来获得所需的结果。 这是一个例子。 declare type t_cursor is ref cursor; c_cursor t_cursor; l_sql varchar2(123); l_var number; begin l_sql := 'select count(*) from T1'; -- your query goes here open c_cursor for l_sql; ...pivot替代方案: select @frontenduser = case type when 1 then id else @frontenduser end, @backenduser = case type when 2 then id else @backenduser end, @newuser = case type when 3 then id else @newuser end from userlist 或者相同,使用iif运算符(如果您使用SqlServer ...用你的代码查询2结束了 SELECT * FROM ( 'SELECT * FROM table1 WHERE name LIKE 'a_'' ) WHERE age = '55' 如果你改变了 String query2 = "SELECT * FROM ( '" + query1 + "' ) WHERE age = '55'"; 至 String query2 = "SELECT * FROM ( " + query1 + " ) WHERE age = '55'"; (注意删除的' )它结束了 ...我认为文档完全错了。 如您所示,在这方面, SET和SELECT之间并没有什么区别。 I think the documentation is simply wrong. As you've shown, there's not really any difference between SET and SELECT in this regard.MySQL存储过程从select语句为多个变量赋值(MySQL store procedure Assign value to multiple variable from select statement)[2022-04-19]
不要使用具有相同列名的变量,查询将优先考虑表列名。 一个好主意是使用带前缀的变量: BEGIN DECLARE p_PaidFee INT DEFAULT 0; DECLARE p_DueFee INT DEFAULT 0; DECLARE p_CourseFee INT DEFAULT 0; INSERT INTO `creditdirectory`(`TypeID`, `PersonName`, `CreditBy`, `PersonID`, `ModeOfPaym ...使用mutlirows变量赋值时不要依赖于order。 试试这个例子: DECLARE @c INT = 0 SELECT @c = @c + x FROM (VALUES(1),(2),(3)) AS src(x) WHERE x BETWEEN 1 AND 3 ORDER BY 1 - x DESC SELECT @c SET @c = 0 SELECT @c = @c + x FROM (VALUES(1),(2),(3)) AS src(x) WHERE x BETWEEN 1 AND ...相关文章
更多- HBase多线程建立HTable问题
- Solr JAVA客户端SolrJ 4.9使用示例教程
- HBase 在淘宝的应用和优化
- HBase在淘宝的应用和优化小结
- HBase 在淘宝的应用和优化
- HBase在淘宝的应用和优化小结
- Redis 客户端连接、密码验证、连接数设置
- Hadoop中的RPC实现——客户端通信组件
- HDFS源码分析——RPC Client实现
- Hadoop的Hbase环境搭建
最新问答
更多- 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
- 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
- OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
- 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
- codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
- 在计算机拍照在哪里进入
- 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
- No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
- 单页应用程序:页面重新加载(Single Page Application: page reload)
- 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
- System.StackOverflow错误(System.StackOverflow error)
- KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
- 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
- android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
- TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
- 企业安全培训的各项内容
- 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
- C#类名中允许哪些字符?(What characters are allowed in C# class name?)
- NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
- 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
- 将多个行和可变行移动到列(moving multiple and variable rows to columns)
- 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
- 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
- Angular $资源不会改变方法(Angular $resource doesn't change method)
- 在Angular 5中不是一个函数(is not a function in Angular 5)
- 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
- 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
- 常见的python rpc和cli接口(Common python rpc and cli interface)
- Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
- 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)