相关疑难解决方法(0)

使用参数化IN子句时,N1QL查询超时

使用Couchbase服务器4.1.0(和4.5),Java SDK 2.2.8(也尝试使用2.2.7,2.3.1和2.3.3),我有一个利用二级索引的查询,当我运行我的代码时它运行正常本地甚至通过AWS服务器上的CBQ(CBQ大约需要3毫秒).但是,当在AWS上运行我的应用程序时,我得到一个TimeOutException,它只有一个查询超时,其他查询不是.详情见下文.

值得注意的是我的Couchbase设置有3个桶.

示例文档:

"bucketName": {
    "userName": "User_A",
    "MessageContent": "This is a message",
    "docType": "msg",
    "ParentMsgId": "1234",
    "MsgType": "test",
    "expireTimestamp": 1454975772613,
    "publishTimestamp": 1455322362028,
    "id": "145826845",
    "urls": [],
    "subject": "this is a subject",
    "type": 1,
    "GroupId": "Group_1"
}
Run Code Online (Sandbox Code Playgroud)

二级指数:

CREATE INDEX `indexName` ON `bucketName`(`ParentMsgId`,`docType`,`publishTimestamp`) USING GSI
Run Code Online (Sandbox Code Playgroud)

从中提取的示例查询 N1qlQuery#n1ql()

{"statement":
"select count(*) as msgCount from bucketName 
where ParentMsgId is not missing and docType = 'msg' 
and ParentMsgId IN $parentId 
and publishTimestamp between $startTime and $endTime
","$endTime":1470726861816,
  "$startTime":1470640461816,
  "$parenIds":["fa11845b-9ea5-4778-95fe-e7206843c69b"]
} …
Run Code Online (Sandbox Code Playgroud)

java indexing couchbase sql++

8
推荐指数
1
解决办法
578
查看次数

标签 统计

couchbase ×1

indexing ×1

java ×1

sql++ ×1