问HN:为什么大型语言模型(LLMs)仍然很难查询NoSQL数据库?

3作者: cammasmith26 天前原帖
大型语言模型(LLMs)在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&#x27;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&#x27;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&#x27;s curious: https:&#x2F;&#x2F;dynamosql.hashnode.dev&#x2F;why-llm-agents-still-can-t-query-nosql-databases. But I&#x27;m more interested in how others have handled this. Why is it still such an unresolved problem?