Ask HN:为什么大型语言模型(LLM)查询 NoSQL 数据库仍然如此困难?
3 分•作者: cammasmith•28 天前
大型语言模型(LLM)擅长处理 SQL。SQL 精确、表达力强且没有歧义。如果您将 MCP 服务器连接到 Postgres,那么代理可以直接查询它。但对于 NoSQL,情况并非如此,考虑到有很多人使用 NoSQL 数据库,我感到惊讶的是关于这个问题并没有更多的讨论。
问题的一部分在于多样性。MongoDB、DynamoDB、Cassandra、Redis 和 Neo4j 都拥有不同的查询模型。没有一个通用的接口供 LLM 进行推理。因此,代理需要编写代码而不是查询:SDK 调用、手动聚合、分页逻辑。这变得更加复杂,更难审查,并且在处理任何非简单任务时都会迅速出错。
我们遇到了与 DynamoDB 特别相关的问题,并最终构建了自己的解决方案。如果您有兴趣,我在这里写过相关内容:https://dynamosql.hashnode.dev/why-llm-agents-still-can-t-query-nosql-databases。但我更感兴趣的是其他人是如何处理这个问题的。为什么这仍然是一个悬而未决的问题?
查看原文
LLMs are good at SQL. It's precise, expressive, and unambiguous. If you connect an MCP server to Postgres, then the agent can query it directly. The same cannot be said for NoSQL, and given how many people use NoSQL databases, I’m surprised there isn’t more discussion about it.<p>Part of the problem is diversity. MongoDB, DynamoDB, Cassandra, Redis, and Neo4j all have different query models. There's no shared interface for an LLM to reason about. So instead of writing a query, the agent has to write code: SDK calls, manual aggregation, pagination logic. It becomes more complex, harder to review, and quickly breaks on anything non-trivial.<p>We ran into this problem with DynamoDB specifically and ended up building our own solution. I wrote about it here if anyone's curious: https://dynamosql.hashnode.dev/why-llm-agents-still-can-t-query-nosql-databases. But I'm more interested in how others have handled this. Why is it still such an unresolved problem?