【发布时间】:2023-03-10 20:40:01
【问题描述】:
我有一个 DataStax Astra 数据库,我有这个示例来说明如何获取具有特定用户名的用户:
curl --request GET \
--url https://${ASTRA_DB_ID}-${ASTRA_DB_REGION}.apps.astra.datastax.com/api/rest/v2/keyspaces/${ASTRA_DB_KEYSPACE}/user?where=\{"user_username":\{"$eq":"'+*username_value_here*+'"\}\}' \
--header "x-cassandra-token: ${ASTRA_DB_APPLICATION_TOKEN}"
由于 Cassandra,我没有选项允许过滤:
{"description":"Bad request: org.apache.cassandra.stargate.exceptions.InvalidRequestException: 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","code":400}
我在任何地方都找不到如何在 curl 命令中启用此选项,所以问题是我如何编写这个(如果可能的话)或者有更好的选择。欢迎任何帮助。
【问题讨论】:
-
ALLOW FILTERING在大多数情况下是最糟糕的选择 -
@AlexOtt 如果我们在一个没有复杂查询的单个节点中有一个小型数据库(9-10 百万行)怎么办,使用
ALLOW FILTERING是不是一个坏主意? -
您仍然需要扫描所有数据等。
标签: database cassandra datastax datastax-astra stargate-oss