我的征尘是星辰大海。。。
The dirt and dust from my pilgrimage forms oceans of stars...
-------当记忆的篇章变得零碎,当追忆的图片变得模糊,我们只能求助于数字存储的永恒的回忆
作者:黄教授
手机视频列表
OceanBase_PowerRAG用RAG技术增强数据库检索1
视频
音频
原始脚本
OceanBase PowerRAG 用 RAG 技术增强数据库检索,绝非运行大模型的 RAG 系统。 核心结论先立住,OceanBase 不是 RAG 系统,不内嵌、不运行任何大模型,也不会将数据喂给大模型做判断,它只是借用 RAG 的向量化、语义检索技术,补全 传统数据库的查询短板,本质仍是纯粹的数据库,全程由原生引擎独立完成数据检索。 之所以必须开篇点破,是因为 Power R A G 的命名极易造成误解。 很多人会默认 RAG 就意味着为大模型提供上下文,背后必然绑定大模型运行。 但事实恰恰相反,OceanBase 完全脱离大模型独立工作。 其 PowerRAG 的核心是用 RAG 技术赋能数据库,而非为大模型服务的 RAG 系统,彻底规避了大模型的高成本、低效率与黑盒风险。 企业之所以不敢将大模型直接用于核心业务,根源在于两大硬伤。 一是效率与成本不可承受,大模型实时调用需秒级响应,远达不到数据库毫秒级查询要求,且资源消耗极高。 二是黑盒风险无法追溯,大模型的幻觉可能导致错误判断,如误判合规用户为反洗钱风险对象,且决策逻辑无法拆解,责任 界定模糊。 而 OceanBase 的突破正是用数据库原生能力实现了 AI 级检索,完全避开了这些痛点,让 RAG 技术真正适配企业商业场景。 E R A G 的技术内核,被数据库借用的语义检索能力。 RAG 检索增强生成的核心技术逻辑,是将非结构化数据向量化,通过向量相似度匹配实现语义检索。 这一技术本身不依赖大模型运行,仅在数据向量化预处理时可能用到外部模型,如将文本转成向量。 OceanBase 正是精准截取了这一技术内核,将其集成到数据库中,用于解决传统数据库的检索缺陷。 传统数据库仅能高效应对结构化数据精准查询这一基础场景,却在多字段模式匹配和全文语义检索两大核心需求上存在明显短板。 而 RAG 的向量化技术恰好能补全这两大缺口,OceanBase 正是借用这一技术,让数据库具备模式向量。 匹配和语义向量检索能力,完成从精准查询工具到全能检索平台的升级,而非成为服务大模型的 RAG 系统。 二、传统数据库的两大检索短板,RAG 技术如何补全?OceanBase 对 RAG 技术的借用,精准瞄准了传统数据库的核心痛点,同时完整保留了原 本就成熟的结构化查询能力,形成基础稳固、短板补齐的全能检索体系。 结构化数据查询,原生成熟能力筑牢根基。 OceanBase 作为分布式关系型数据库,原生支持 TP 事务处理能力,可毫秒级响应高并发的结构化查询需求。 例如查询2025年3月凌晨2点到5点单笔转账超5万元的记录,仅需常规 SQL 即可完成,数据一致性与实时性完全满足企业核心业务要求。 这一基础能力经过长期验证已十分成熟,是所有复杂查询的可靠支撑。 多字段模式匹配 突破高维向量检索难题。 破解复杂模式定义难,传统数据库的致命短板的在于无法高效处理多字段组合的模式匹配,多维度特征组合后形成的是高维向量,既不能用传统字段的索引方式,如字母序、数字序加速查询,也无法通过多条件 C 库实现精准的综合相似度判断,这也是为何单单独的向量数据库会应运而生。 而 OceanBase 的核心突破正是将高维向量检索能力原生集成到数据库中,彻底解决了这一行业难题。 先厘清高维向量的检索困境。 以反洗钱场景为例,风险模式包含账户开户时长小于3个月、每日存取款次数大于5次、单笔金额1000元、凌晨2点到5点交易占比大于64%四个维度 组合后形成的是四维向量。 传统数据库的处理方式存在两大硬伤。 无有效索引,向量是高维空间的方向标识,无法按传统方式排序键索引,只能全表遍历比对,查询速度极慢。 多条件 SQL 失效,若用 SQL 写开户时长,3个月 and 交易次数大于5次 and 不仅语句冗长,更无法体现综合相似度。 比如某用户开户时长4个月,略超阈值,但其他三个维度完全匹配,传统 SQL 会直接过滤,而实际该用户仍属高风险。 模式向量的构建逻辑,OceanBase 将多维度风险特征按业务权重组合成高维向量。 每个特征对应一个向量维度,权重越高,该维度对匹配结果的影响越显著。 例如给凌晨交易占比分配0.4的权重,最高,单笔金额分配0.3,交易次数分配0.2。 开户时长分配0.1,精准贴合反洗钱业务逻辑。 存储与匹配的高效实现,风险模式向量与用户行为向量,由用户交易字段实时计算生成,一同存储在表的 vector 原生字段中,无需跨表关联。 查询时,通过余弦相似度计算两者的方向相近程度,向量点乘运算,而非传统的字段阈值判断。 比如用户向量与风险模式向量的相似度为0.92,越接近1越相似,即便某一个维度略超阈值,仍会被判定为高风险,避免误判。 同时,OceanBase 内置 IDF、HNSW 等聚类算法,将相似向量预先分簇,查询时先匹配簇内向量,大幅减少比对次数,解决了高维向量全表遍历的低效问题。 C 库简化操作,例如判断用户是否符合反洗钱风险模式,仅需一条向量查询 C 库。 S, E, L, E, C, T, user, underscore, id, vector, underscore, distance, behavior, underscore, vek, risk, underscore, pattern, underscore, vek, cosine, AS, similarity, F, R, O, M, user, underscore For transaction w h e r e similarity greater than 0.8 相似度高于阈值即判定为高风险。 这条语句替代了传统需关联多表,包含十几个条件的繁琐 SQL。 不仅开发效率提升数倍,更能实现传统 SQL 无法做到的综合相似度判断。
修正脚本
OceanBase PowerRAG 用 RAG 技术增强数据库检索,绝非运行大模型的 RAG 系统。 核心结论先立住,OceanBase 不是 RAG 系统,不内嵌、不运行任何大模型,也不会将数据喂给大模型做判断,它只是借用 RAG 的向量化、语义检索技术,补全传统数据库的查询短板,本质仍是纯粹的数据库,全程由原生引擎独立完成数据检索。 之所以必须开篇点破,是因为 PowerRAG 的命名极易造成误解。 很多人会默认 RAG 就意味着为大模型提供上下文,背后必然绑定大模型运行。 但事实恰恰相反,OceanBase 完全脱离大模型独立工作。 其 PowerRAG 的核心是用 RAG 技术赋能数据库,而非为大模型服务的 RAG 系统,彻底规避了大模型的高成本、低效率与黑盒风险。 企业之所以不敢将大模型直接用于核心业务,根源在于两大硬伤。 一是效率与成本不可承受,大模型实时调用需秒级响应,远达不到数据库毫秒级查询要求,且资源消耗极高。 二是黑盒风险无法追溯,大模型的幻觉可能导致错误判断,如误判合规用户为反洗钱风险对象,且决策逻辑无法拆解,责任界定模糊。 而 OceanBase 的突破正是用数据库原生能力实现了 AI 级检索,完全避开了这些痛点,让 RAG 技术真正适配企业商业场景。 RAG 的技术内核,就是被数据库借用的语义检索能力。 RAG 检索增强生成的核心技术逻辑,是将非结构化数据向量化,通过向量相似度匹配实现语义检索。 这一技术本身不依赖大模型运行,仅在数据向量化预处理时可能用到外部模型,如将文本转成向量。 OceanBase 正是精准截取了这一技术内核,将其集成到数据库中,用于解决传统数据库的检索缺陷。 传统数据库仅能高效应对结构化数据精准查询这一基础场景,却在多字段模式匹配和全文语义检索两大核心需求上存在明显短板。 而 RAG 的向量化技术恰好能补全这两大缺口,OceanBase 正是借用这一技术,让数据库具备模式向量匹配和语义向量检索能力,完成从精准查询工具到全能检索平台的升级,而非成为服务大模型的 RAG 系统。 二、传统数据库的两大检索短板,RAG 技术如何补全?OceanBase 对 RAG 技术的借用,精准瞄准了传统数据库的核心痛点,同时完整保留了原本就成熟的结构化查询能力,形成基础稳固、短板补齐的全能检索体系。 结构化数据查询,原生成熟能力筑牢根基。 OceanBase 作为分布式关系型数据库,原生支持 TP 事务处理能力,可毫秒级响应高并发的结构化查询需求。 例如查询2025年3月凌晨2点到5点单笔转账超5万元的记录,仅需常规 SQL 即可完成,数据一致性与实时性完全满足企业核心业务要求。 这一基础能力经过长期验证已十分成熟,是所有复杂查询的可靠支撑。 多字段模式匹配 突破高维向量检索难题。 破解复杂模式定义难,传统数据库的致命短板在于无法高效处理多字段组合的模式匹配,多维度特征组合后形成的是高维向量,既不能用传统字段的索引方式,如字母序、数字序加速查询,也无法通过多条件 SQL 实现精准的综合相似度判断,这也是为何单独的向量数据库会应运而生。 而 OceanBase 的核心突破正是将高维向量检索能力原生集成到数据库中,彻底解决了这一行业难题。 先厘清高维向量的检索困境。 以反洗钱场景为例,风险模式包含账户开户时长小于3个月、每日存取款次数大于5次、单笔金额1000元、凌晨2点到5点交易占比大于64%四个维度组合后形成的是四维向量。 传统数据库的处理方式存在两大硬伤。 无有效索引,向量是高维空间的方向标识,无法按传统方式排序键索引,只能全表遍历比对,查询速度极慢。 多条件 SQL 失效,若用 SQL 写开户时长小于3个月、交易次数大于5次,不仅语句冗长,更无法体现综合相似度。 比如某用户开户时长4个月,略超阈值,但其他三个维度完全匹配,传统 SQL 会直接过滤,而实际该用户仍属高风险。 模式向量的构建逻辑,OceanBase 将多维度风险特征按业务权重组合成高维向量。 每个特征对应一个向量维度,权重越高,该维度对匹配结果的影响越显著。 例如给凌晨交易占比分配0.4的权重,最高,单笔金额分配0.3,交易次数分配0.2,开户时长分配0.1,精准贴合反洗钱业务逻辑。 存储与匹配的高效实现,风险模式向量与用户行为向量,由用户交易字段实时计算生成,一同存储在表的 vector 原生字段中,无需跨表关联。 查询时,通过余弦相似度计算两者的方向相近程度,向量点乘运算,而非传统的字段阈值判断。 比如用户向量与风险模式向量的相似度为0.92,越接近1越相似,即便某一个维度略超阈值,仍会被判定为高风险,避免误判。 同时,OceanBase 内置 IDF、HNSW 等聚类算法,将相似向量预先分簇,查询时先匹配簇内向量,大幅减少比对次数,解决了高维向量全表遍历的低效问题。 SQL 简化操作,例如判断用户是否符合反洗钱风险模式,仅需一条向量查询 SQL。 S, E, L, E, C, T, user, underscore, id, vector, underscore, distance, behavior, underscore, vek, risk, underscore, pattern, underscore, vek, cosine, AS, similarity, F, R, O, M, user, underscore For transaction w h e r e similarity greater than 0.8 相似度高于阈值即判定为高风险。 这条语句替代了传统需关联多表,包含十几个条件的繁琐 SQL。 不仅开发效率提升数倍,更能实现传统 SQL 无法做到的综合相似度判断。
英文翻译
OceanBase PowerRAG enhances database retrieval using RAG technology, not a RAG system running large language models. Let me establish the core conclusion upfront: OceanBase is not a RAG system. It does not embed or run any large language model, nor does it feed data to LLMs for judgment. It merely borrows the vectorization and semantic retrieval technologies of RAG to fill the gaps in traditional database querying. At its core, it remains a pure database, with all data retrieval independently completed by its native engine. I must clarify this at the outset because the name "PowerRAG" is highly prone to misunderstanding. Many people default to the assumption that RAG implies providing context for large language models, inevitably tied to running an LLM. But the truth is the opposite: OceanBase operates entirely independently of any LLM. Its PowerRAG core leverages RAG technology to empower the database, not to serve as a RAG system for LLMs, thereby completely avoiding the high costs, low efficiency, and black-box risks of large language models. The reason enterprises dare not directly use LLMs in core business stems from two fundamental flaws. First, unacceptable efficiency and cost. Real-time LLM invocation requires second-level response times, far from the millisecond-level query requirements of databases, and resource consumption is extremely high. Second, black-box risks that cannot be traced. LLM hallucinations can lead to erroneous judgments, such as misclassifying compliant users as anti-money laundering risks, and the decision-making logic cannot be decomposed, leading to blurred accountability. OceanBase's breakthrough lies in achieving AI-level retrieval through native database capabilities, completely avoiding these pain points, making RAG technology truly suitable for enterprise commercial scenarios. The technical core of RAG is the semantic retrieval capability borrowed by the database. The core technical logic of RAG (Retrieval-Augmented Generation) is to vectorize unstructured data and achieve semantic retrieval through vector similarity matching. This technology itself does not depend on running an LLM; external models may only be used during the data vectorization preprocessing stage, such as converting text into vectors. OceanBase precisely extracts this technical core and integrates it into the database to address the retrieval deficiencies of traditional databases. Traditional databases can efficiently handle only the basic scenario of precise querying of structured data, but they have clear shortcomings in two key requirements: multi-field pattern matching and full-text semantic retrieval. RAG's vectorization technology happens to fill these two gaps. OceanBase borrows this technology to equip the database with pattern vector matching and semantic vector retrieval capabilities, upgrading it from a precise query tool to a comprehensive retrieval platform, rather than becoming a RAG system serving LLMs. II. How RAG Technology Complements the Two Retrieval Shortcomings of Traditional Databases? OceanBase's adoption of RAG technology precisely targets the core pain points of traditional databases while fully retaining the mature structured query capabilities, forming a comprehensive retrieval system with a solid foundation and filled gaps. Structured data querying: Native mature capabilities lay a solid foundation. As a distributed relational database, OceanBase natively supports TP transaction processing capabilities, enabling millisecond-level response for high-concurrency structured query demands. For example, querying records of single transfers exceeding 50,000 yuan between 2:00 AM and 5:00 AM in March 2025 can be done with a standard SQL statement. Data consistency and real-time performance fully meet enterprise core business requirements. This basic capability has been validated over time and is very mature, providing reliable support for all complex queries. Multi-field pattern matching: Breaking through the challenge of high-dimensional vector retrieval. The fatal flaw of traditional databases lies in their inability to efficiently handle pattern matching of multiple fields. When multiple dimensional features are combined, they form a high-dimensional vector, which cannot be indexed using traditional field methods (such as alphabetical or numerical order) to speed up queries, nor can precise comprehensive similarity judgment be achieved through multi-condition SQL. This is exactly why standalone vector databases emerged. OceanBase's core breakthrough is natively integrating high-dimensional vector retrieval capabilities into the database, completely solving this industry challenge. First, clarify the retrieval difficulty of high-dimensional vectors. Taking the anti-money laundering scenario as an example, the risk pattern includes four dimensions: account opening time less than 3 months, daily deposit/withdrawal count greater than 5 times, single transaction amount of 1,000 yuan, and transaction proportion between 2:00 AM and 5:00 AM greater than 64%. Combined, they form a four-dimensional vector. Traditional database approaches have two major flaws. No effective index: Vectors are directional identifiers in high-dimensional space and cannot be sorted or indexed in traditional ways. Only full table traversal and comparison are possible, resulting in extremely slow query speeds. Multi-condition SQL failure: Using SQL to write "account opening time less than 3 months AND transaction count greater than 5" not only results in verbose statements but also fails to reflect comprehensive similarity. For instance, a user whose account was opened for 4 months, slightly exceeding the threshold, but fully matching in the other three dimensions, would be directly filtered out by traditional SQL, while in reality, this user is still high-risk. Pattern vector construction logic: OceanBase combines multi-dimensional risk features into high-dimensional vectors according to business weights. Each feature corresponds to a vector dimension. The higher the weight, the more significant the impact on the matching result. For example, assigning a weight of 0.4 (highest) to the overnight transaction proportion, 0.3 to single transaction amount, 0.2 to transaction count, and 0.1 to account opening time, accurately aligning with anti-money laundering business logic. Efficient storage and matching: Risk pattern vectors and user behavior vectors are computed in real time from user transaction fields and stored together in the table's native vector field, without the need for cross-table joins. During querying, cosine similarity is used to calculate the directional closeness between the two (via vector dot product), rather than traditional field threshold judgment. For example, if the similarity between the user vector and the risk pattern vector is 0.92 (closer to 1 means more similar), even if one dimension slightly exceeds the threshold, it will still be judged as high-risk, avoiding misjudgment. At the same time, OceanBase includes clustering algorithms like IDF and HNSW, which pre-group similar vectors. During querying, it first matches vectors within a cluster, greatly reducing comparison times and solving the inefficiency of full table traversal for high-dimensional vectors. Simplified SQL operations: For example, determining whether a user matches the anti-money laundering risk pattern requires only one vector query SQL: SELECT user_id, vector_distance(behavior_vec, risk_pattern_vec, cosine) AS similarity FROM user_transaction WHERE similarity > 0.8. If similarity exceeds the threshold, it is judged as high-risk. This statement replaces traditional SQL that would require joining multiple tables and contain a dozen conditions. It not only improves development efficiency several times but also achieves comprehensive similarity judgment that traditional SQL cannot perform.
back to top