A multimodal data hybrid query optimizer and method

By using a multimodal data hybrid query optimizer that combines structured filtering and vector similarity retrieval, dynamically determines the execution strategy and pushes down the structured index, the performance and accuracy issues of hybrid queries are solved, achieving efficient and accurate hybrid query results to meet the complex business needs of enterprises.

CN123048596APending Publication Date: 2026-11-06GUOSHUAN (BEIJING) TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611326317.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-29
Publication Date
2026-11-06

AI Technical Summary

Technical Problem

Existing technologies suffer from performance and accuracy deficiencies in mixed queries in real-world enterprise business scenarios. They are unable to adapt to large-scale knowledge bases, multi-dimensional permission filtering, and multi-condition business screening, and are insufficient to meet the high-concurrency and stable retrieval requirements of government, enterprise, financial, and military industries.

Method used

By employing a multimodal data hybrid query optimizer that combines structured filtering conditions with vector similarity retrieval, and using a hybrid cost model to dynamically determine the execution strategy, the full data pre-pruning is prioritized through the structured index to generate a set of effective data bitmaps. The structured filtering constraints are then pushed down to the vector index scanning layer, and high-dimensional vector similarity calculations are performed only on the effective vector subsets, thus achieving adaptive execution strategy switching.

Benefits of technology

Significantly improves hybrid query performance, reduces invalid vector calculations, avoids candidate set breakdown, ensures accurate and controllable search results, adapts to classified government scenarios, reduces query latency and improves throughput, and supports compliant retrieval under permission and security level conditions.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123048596A_ABST
    Figure CN123048596A_ABST
Patent Text Reader

Abstract

This invention discloses a multimodal data hybrid query optimizer and method, relating to the fields of AI-native databases and query optimizer technology. This invention reconstructs a hybrid structured and vector query cost model, employing an architecture combining pre-filtering of structured conditions with pushdown of the near nearest neighbor retrieval kernel. It dynamically determines the optimal execution strategy through cost evaluation. In high-selectivity scenarios, structured index pre-pruning is prioritized, and filtering constraints are pushed down to the vector index scanning stage. In low-selectivity scenarios, it automatically reverts to the traditional retrieval mode. Simultaneously, it achieves operator kernel fusion and pipelined parallel scheduling. This invention effectively reduces invalid vector computation, avoids candidate set breakdown problems, and improves retrieval accuracy and query performance, making it applicable to multimodal retrieval, confidential semantic retrieval, and other scenarios.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of AI-native databases and query optimizers, specifically to a multimodal data hybrid query optimizer and method. Background Technology

[0002] With the implementation of large-scale model knowledge bases, multimodal retrieval, and intelligent semantic analysis, modern databases have evolved from purely structured transaction queries to a hybrid query mode combining structured conditions and high-dimensional vector similarity. Huateng Database supports storing both structured business fields and high-dimensional vectors within the same data table, and supports extended vector retrieval syntax of the standard structured query language, enabling a single query to perform a joint query that combines business condition filtering and semantic similarity ranking.

[0003] The current industry-standard hybrid query execution paradigm is to first perform a full table vector retrieval and then perform structured condition filtering. That is, it first traverses the vector index to generate a similar vector candidate set, and then performs a secondary structured condition filtering on the candidate results. However, this paradigm can only be adapted to simple retrieval scenarios. It has serious performance and retrieval accuracy defects in real enterprise-level business scenarios. It cannot be adapted to production scenarios with large-scale knowledge bases, multi-dimensional permission filtering, and multi-condition business screening. It is difficult to meet the high-concurrency and stable retrieval requirements of government, enterprise, finance, and military industries. It has become the core performance bottleneck for the development of hybrid queries in AI native databases. Summary of the Invention

[0004] The purpose of this invention is to provide a multimodal data hybrid query optimizer that eliminates invalid vector calculations throughout the process, avoids candidate set breakdown, reuses the advantages of structured indexes, and achieves optimal hybrid query performance with accurate and controllable results.

[0005] The specific technical solution of this invention is as follows:

[0006] A method for optimizing multimodal data hybrid queries includes the following steps:

[0007] S1. Receive a mixed SQL query statement containing structured filtering conditions and vector similarity retrieval logic, and perform syntax parsing and operator decomposition through the query optimizer to obtain structured filtering operators and ANN vector retrieval operators respectively.

[0008] S2. Based on the statistical information of the target data table, calculate the selectivity of the structured filtering conditions and the estimated number of rows hit, and dynamically determine the optimal execution strategy of the hybrid query through the hybrid cost model.

[0009] S3. When the selectivity of the structured conditions is higher than the preset threshold, the full data is pre-pruned using the structured index to generate a set of valid data bitmaps that meet all filtering conditions.

[0010] S4. Push the structured filtering constraints and the valid data bitmap down to the ANN vector index scanning level. During the vector index traversal, match the structured conditions in real time, skip invalid vector data that does not meet the conditions, and do not perform the corresponding vector distance calculation.

[0011] S5. Perform high-dimensional vector similarity calculation and nearest neighbor ranking only on the pre-screened valid vector subset to generate accurate Top-K search results;

[0012] S6. When it is determined that the unstructured filtering condition or the selectivity of the structured condition is lower than the preset threshold, the execution mode of first performing full ANN vector retrieval and then performing structured condition filtering is automatically rolled back to achieve adaptive dynamic switching between the two execution strategies.

[0013] Preferably, the structured index pre-pruning in step S3 supports one or more of the following combined: B+ tree index, bitmap index, partition pruning, and time index. A unique set of valid row ID bitmaps is generated by filtering through the index, and the data range of subsequent ANN vector retrieval is constrained by the bitmap set.

[0014] Preferably, the structured filtering conditions that support pushdown in step S4 include tenant isolation conditions, security level permission conditions, status filtering conditions, time window conditions, and complex structured conditions with multiple field combinations. These conditions can directly eliminate data that does not meet permission and compliance requirements during the index traversal stage, adapting to classified government affairs retrieval scenarios.

[0015] Preferably, after determining the execution strategy, the structured filtering operator, vector distance calculation operator, and sorting operator are fused at the kernel level to build an integrated hybrid query execution pipeline, eliminating intermediate result write-downs and redundant memory copies, and realizing the integrated parallel execution of structured filtering, vector calculation, and sorting pagination.

[0016] Preferably, the hybrid cost model in step S2 uses conditional selectivity, data cardinality, vector dimension, partition distribution, and index hit rate as evaluation dimensions to determine the priority of the execution strategy based on multidimensional statistical results.

[0017] A multimodal data hybrid query optimizer includes a hybrid operator decomposition module, a hybrid cost evaluation module, a structured pre-pruning module, an ANN filtering pushdown rewriting module, and an adaptive execution scheduling module;

[0018] The hybrid operator decomposition module is used to parse the hybrid query statement and decompose it into structured filtering operators and vector retrieval operators;

[0019] The hybrid cost evaluation module is used to calculate the selectivity of structured filtering conditions and evaluate the optimal execution path decision based on the hybrid cost model.

[0020] The structured pre-clipping module is used to quickly filter valid data through structured indexes and generate a set of corresponding valid data bitmaps.

[0021] The ANN filter pushdown and rewrite module is used to push down the structured filter constraints and the effective data bitmap to the vector index scan layer and rewrite to generate an ANN retrieval execution plan with filter constraints.

[0022] The adaptive execution scheduling module is used to control the seamless dynamic switching between the two execution strategies and to schedule the integrated pipeline execution process of mixed queries.

[0023] A computer-readable storage medium storing a computer-executable program, which, when executed by a processor, implements the multimodal data hybrid query optimization method.

[0024] A lake-warehouse integrated AI distributed database system includes a memory, a processor, and a computer program stored in the memory. When the processor executes the computer program, it implements the multimodal data hybrid query optimization method.

[0025] The beneficial effects of this invention are as follows:

[0026] This invention addresses the inherent flaws of the industry's "search first, filter later" approach at the execution paradigm level. It also pioneers a pre-filter pushdown architecture, eliminating invalid vector calculations and candidate set breakdown issues. The accuracy of the mixed query results fully aligns with business expectations, avoiding insufficient or empty results and ensuring accurate and controllable search results.

[0027] This invention can significantly reduce the scale of vector computation, significantly reduce query latency, reduce computing power waste, effectively improve the throughput of high-concurrency mixed queries, and fully reuse the indexing capabilities of mature relational databases, realizing the fusion of kernel-level operators for structured and accurate filtering and intelligent semantic retrieval.

[0028] Moreover, this invention adopts an adaptive dual-execution strategy, which can automatically adapt to various business retrieval scenarios without manual parameter tuning or SQL modification. It has strong compatibility and low operation and maintenance costs. At the same time, it supports push-down filtering based on permissions, security levels, etc., to adapt to confidential and compliant retrieval requirements. Through kernel-level operator fusion, it ensures stable database operation under mixed loads.

[0029] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, the preferred embodiments of the present invention are described in detail below with reference to the accompanying drawings. Attached Figure Description

[0030] Figure 1 This is a schematic diagram of the query optimization method of the present invention;

[0031] Figure 2 This is a framework diagram of the query optimizer module of the present invention. Detailed Implementation

[0032] The technical solution of the present invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0033] like Figures 1-2 As shown, this embodiment uses Huaten Database HuatengBase-XDB, namely the integrated database of HTAP and AI vector lake warehouse, as the application carrier. The application scenarios are: RAG knowledge base retrieval, multimodal data query, confidential semantic retrieval, structured business conditions and vector similarity joint query, etc. The specific implementation process of the multimodal data hybrid query optimizer is described in detail.

[0034] When a user submits a mixed query SQL statement containing structured WHERE filtering conditions and vector similarity ORDER BY sorting logic, the mixed query syntax parsing and decomposition module first performs syntax parsing on the statement, distinguishing between the structured constraints and vector retrieval logic. The structured constraints cover various business filtering rules such as equality, range, time, tenant, permission, and status, while the vector retrieval logic includes vector operations such as L2 distance calculation, cosine similarity matching, and Top-K nearest neighbor retrieval.

[0035] After parsing, the hybrid query syntax parsing and decomposition module decomposes the original query into an operator tree composed of structured operators, vector operators, and post-processing operators. The entire decomposition process completely preserves the business semantics of the original SQL, without requiring the business side to modify the original calling logic.

[0036] After the operator decomposition is completed, the hybrid cost evaluation and execution path decision module retrieves the real-time statistical information of the target data table. Using conditional selectivity, data cardinality, vector dimension, partition distribution, and index hit rate as the core evaluation dimensions, it calculates the screening rate of structured filtering conditions and the estimated number of hit rows. The optimal execution strategy is dynamically determined through the built-in hybrid cost model.

[0037] When the structured condition filtering rate is higher than the configurable preset threshold and the estimated number of hit rows is less than 80% of the total number of rows in the table, the system determines it as a high-selectivity and precise mixed query scenario and enables the execution strategy of pre-filtering structured filtering and ANN retrieval pushdown. When the structured condition filtering rate is extremely low or there are no structured filtering conditions in the query statement, the system determines it as a global semantic retrieval scenario and automatically reverts to the traditional execution mode of first ANN retrieval and then filtering.

[0038] For highly selective and precise mixed query scenarios, the system first initiates a structured index pre-pruning process, calling on mature relational index capabilities such as B+ tree indexes, bitmap indexes, partition pruning, and time indexes to perform fast filtering on the full data, generating a set of valid row ID bitmaps that meet all structured filtering conditions. This accurately locks the valid data subset to be retrieved, pre-excluding all invalid data fragments and data rows, defining clear computational boundaries for subsequent vector retrieval, and fully utilizing the mature optimization capabilities accumulated from relational databases.

[0039] Building upon this, the structured conditional ANN pushdown rewriting module pushes down the structured filtering constraints and the generated set of valid row ID bitmaps together to the ANN vector index scan operator, completing a kernel-level rewrite of the ANN retrieval execution plan. The rewritten execution logic breaks the original fragmented architecture where the upper-layer computation layer performed structured filtering and the lower-layer index layer performed vector retrieval, directly pushing structured filtering down to the vector index scan stage. During vector index traversal, cluster retrieval, and nearest neighbor comparison, the system matches the pre-filtering conditions vector by vector, skipping vectors that do not meet the conditions directly, without performing high-dimensional vector distance calculations and candidate set inclusion, thus completely eliminating invalid vector computational overhead at the index traversal level and avoiding the waste of CPU and NPU computing power.

[0040] After the execution plan is rewritten, the secondary pipeline execution scheduling module initiates the integrated pipeline execution process, fusing structured filtering operators, vector distance calculation operators, and sorting operators at the kernel level to eliminate the overhead of intermediate result storage, redundant memory copying, and back-and-forth data scanning. The system only performs high-dimensional vector distance calculation, clustering comparison, and nearest neighbor sorting within the pre-filtered effective vector subset to generate an accurate Top-K search result set. Subsequently, the pipeline uniformly performs post-processing operations such as pagination, secondary ranking, deduplication, and data anonymization, finally returning complete hybrid search results to the user. The entire process is compatible with standard SQL syntax and is completely transparent to upper-layer business logic.

[0041] During continuous database operation, the kernel monitors running parameters such as data distribution, query concurrency, and index cache status in real time. If the real-time statistics deviate, causing the current execution strategy to no longer match the actual scenario characteristics, subsequent queries of the same type will automatically switch to the corresponding optimal execution strategy. This achieves seamless dynamic switching between the two execution strategies, balancing the performance of precise filtering and retrieval with full-domain semantic retrieval, and ensuring that the database is always in the optimal load state during long-term operation.

[0042] For special scenarios such as classified government affairs and multi-tenant isolation, the push-down mechanism can prioritize the execution of strong business conditions such as permission filtering, security level marking, tenant isolation, and time windows, automatically pruning sensitive data at the index layer, preventing sensitive data from entering the vector computing link, and ensuring data security and retrieval compliance from the kernel level.

[0043] In this embodiment, the execution logic of the hybrid query optimizer can be implemented using the following kernel pseudocode:

[0044] Python

[0045] # Hybrid Query Optimizer: Core Logic of SQL Filtering Before and ANN Vector Retrieval Pushdown

[0046] def hybrid_vector_query_optimize(sql_plan: QueryPlan):

[0047] # 1. Deconstructing Structured Operators and Vector Retrieval Operators

[0048] filter_ops, vector_ops = split_hybrid_operator(sql_plan)

[0049] # 2. Cost model evaluation, selective calculation conditions

[0050] selectivity = calc_condition_selectivity(filter_ops)

[0051] row_base = get_table_total_rows()

[0052] hit_rows = estimate_filter_rows(filter_ops)

[0053] # 3. Dynamic Execution Strategy Decisions

[0054] if selectivity > SELECTIVITY_THRESHOLD and hit_rows < row_base *0.8:

[0055] # Core Strategies: Structured Filtering Before Retrieval and ANN Search Pushdown

[0056] valid_bitmap = structured_index_prune(filter_ops)

[0057] # Push the filter bitmap down to the ANN index scan layer

[0058] vector_ops.pushdown_filter_bitmap(valid_bitmap)

[0059] # Build a pre-filter priority execution plan

[0060] new_plan = build_filter_first_plan(filter_ops, vector_ops)

[0061] else:

[0062] # Global Search: Revert to Traditional ANN-First Mode

[0063] new_plan = build_vector_first_plan(filter_ops, vector_ops)

[0064] # 4. Pipeline operator fusion optimization

[0065] fused_plan = fuse_hybrid_pipeline(new_plan)

[0066] return fused_plan

[0067] # Execution of ANN index retrieval with pushdown filtering

[0068] def ann_scan_with_pushdown_filter(vector_index, valid_bitmap, query_vec, topk):

[0069] result_candidates = []

[0070] # Real-time matching of pre-structured conditions while traversing vector indices

[0071] for vec_id, vec_data in vector_index.traverse():

[0072] if vec_id not in valid_bitmap:

[0073] continue # Filtering pushdown: Skip invalid vectors directly and do not perform distance calculations

[0074] # Perform high-dimensional similarity calculation only on valid vectors

[0075] dist = calc_cosine_distance(vec_data, query_vec)

[0076] result_candidates.append((vec_id, dist))

[0077] # Returning to precise Top-K sort

[0078] return sort_and_topk(result_candidates, topk)

[0079] In summary

[0080] This invention addresses the inherent defects of existing hybrid structured and vector query execution paradigms by reconstructing the optimization logic and execution architecture of hybrid queries. It can solve common industry problems such as redundant invalid vector calculations, insufficient candidate set results, inability to reuse structured indexes, logical separation between the retrieval layer and the computation layer, and unstable operation under hybrid load in the traditional retrieval-then-filtering mode.

[0081] This invention can also dynamically select the optimal execution path based on query features, realize kernel-level pushdown of filtering conditions and operator fusion execution, significantly improve retrieval efficiency and reduce computing power consumption while ensuring the accuracy of retrieval results, and has both full-scenario adaptability and confidentiality compliance, and can stably support various business scenarios such as multimodal data retrieval and intelligent semantic analysis.

[0082] The embodiments described above are merely illustrative of implementation methods of the present invention, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of the invention patent. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these all fall within the protection scope of the present invention. Therefore, the protection scope of this invention patent should be determined by the appended claims.

Claims

1. A multimodal data hybrid query optimization method, characterized in that, Includes the following steps: S1. Receive a mixed SQL query statement containing structured filtering conditions and vector similarity retrieval logic, and perform syntax parsing and operator decomposition through the query optimizer to obtain structured filtering operators and ANN vector retrieval operators respectively. S2. Based on the statistical information of the target data table, calculate the selectivity of the structured filtering conditions and the estimated number of rows hit, and dynamically determine the optimal execution strategy of the hybrid query through the hybrid cost model. S3. When the selectivity of the structured conditions is higher than the preset threshold, the full data is pre-pruned using the structured index first to generate a set of valid data bitmaps that meet all filtering conditions. S4. Push the structured filtering constraints and the valid data bitmap down to the ANN vector index scanning level. During the vector index traversal, match the structured conditions in real time, skip invalid vector data that does not meet the conditions, and do not perform the corresponding vector distance calculation. S5. Perform high-dimensional vector similarity calculation and nearest neighbor ranking only on the pre-screened valid vector subset to generate accurate Top-K search results; S6. When it is determined that the unstructured filtering condition or the selectivity of the structured condition is lower than the preset threshold, the execution mode of first performing full ANN vector retrieval and then performing structured condition filtering is automatically rolled back to achieve adaptive dynamic switching between the two execution strategies.

2. The multimodal data hybrid query optimization method according to claim 1, characterized in that, The structured index pre-pruning in step S3 supports one or more of the following combined: B+ tree index, bitmap index, partition pruning, and time index. It generates a unique set of valid row ID bitmaps by filtering the indexes, and uses the bitmap set to constrain the data range of subsequent ANN vector retrieval.

3. The multimodal data hybrid query optimization method according to claim 1, characterized in that, The structured filtering conditions supported in step S4 include tenant isolation conditions, security level permission conditions, status filtering conditions, time window conditions, and complex structured conditions with multiple field combinations. Data that does not meet permission and compliance requirements can be directly eliminated during the index traversal stage, making it suitable for classified government affairs retrieval scenarios.

4. The multimodal data hybrid query optimization method according to claim 1, characterized in that, After determining the execution strategy, the structured filtering operator, vector distance calculation operator, and sorting operator are fused at the kernel level to build an integrated hybrid query execution pipeline, eliminating intermediate result write-downs and redundant memory copies, and realizing the integrated parallel execution of structured filtering, vector calculation, and sorting pagination.

5. The multimodal data hybrid query optimization method according to claim 1, characterized in that, The hybrid cost model in step S2 uses conditional selectivity, data cardinality, vector dimension, partition distribution, and index hit rate as evaluation dimensions, and determines the priority of the execution strategy based on multidimensional statistical results.

6. A multimodal data hybrid query optimizer, characterized in that, It includes a hybrid operator decomposition module, a hybrid cost evaluation module, a structured pre-pruning module, an ANN filtering pushdown rewriting module, and an adaptive execution scheduling module; The hybrid operator decomposition module is used to parse the hybrid query statement and decompose it into structured filtering operators and vector retrieval operators; The hybrid cost evaluation module is used to calculate the selectivity of structured filtering conditions and evaluate the optimal execution path decision based on the hybrid cost model. The structured pre-clipping module is used to quickly filter valid data through structured indexes and generate a set of corresponding valid data bitmaps. The ANN filter pushdown and rewrite module is used to push down the structured filter constraints and the effective data bitmap to the vector index scan layer and rewrite to generate an ANN retrieval execution plan with filter constraints. The adaptive execution scheduling module is used to control the seamless dynamic switching between the two execution strategies and to schedule the integrated pipeline execution process of mixed queries.

7. A computer-readable storage medium, characterized in that, The storage medium stores a computer-executable program, which, when executed by a processor, implements the multimodal data hybrid query optimization method according to any one of claims 1 to 5.

8. A lake-warehouse integrated AI distributed database system, characterized in that, The method includes a memory, a processor, and a computer program stored in the memory. When the processor executes the computer program, it implements the multimodal data hybrid query optimization method according to any one of claims 1 to 5.