Skip to content

[Bug]: Composite-key pruning loses constituent block filters after stats recalculation #25592

Closed

Description

@XuPeng-SH

Is there an existing issue for the same bug?

  • I have checked the existing issues.

Branch Name

main

Commit ID

7821d21

Other Environment Information

  • Hardware parameters: N/A
  • OS type: Linux
  • Others: Optimizer block-filter planning for composite primary keys and composite cluster keys.

Actual Behavior

When composite-key predicate rewriting replaces predicates on physical key parts with a predicate on the hidden compound key, later ReCalcNodeStats rebuilds BlockFilterList from the rewritten FilterList. The physical-part predicates are then lost.

This preserves query results but removes valid zonemap pruning opportunities for each constituent key column. A high-cost/AP stats pass can repeat the loss after an earlier pass had retained the part filters.

Expected Behavior

The block-filter list should retain both:

  • the compound-key predicate, for sorted-key/read-filter pruning; and
  • every consumed, zonemappable predicate on a constituent key column, for independent zonemap pruning.

Repeated stats recalculation must neither lose nor duplicate these predicates.

Steps to Reproduce

  1. Create a table with a composite primary key or composite cluster key.
  2. Run a query such as WHERE c1 = 5 AND c2 > 3 AND c2 < 100.
  3. Inspect EXPLAIN before the fix: only the hidden compound-key predicate appears in Block Filter Cond.
  4. Trigger a plan path with repeated stats recalculation; the part-column predicates remain absent.

Additional Information

The fix preserves consumed constituent predicates across stats recalculation, retains the generated compound predicate, and deduplicates equivalent filters. Regression coverage includes unit tests and test/distributed/cases/optimizer/blockfilter.test.

Activity

  1. added this to the MO-202607 milestone on Jul 11, 2026
  2. self-assigned this
    on Jul 11, 2026
  3. added
    kind/bug
    severity/s0
    and removed on Jul 11, 2026
  4. added theissue type on Jul 11, 2026
  5. added a commit that references this issue on Jul 12, 2026
    de64386
  6. XuPeng-SH commented on Jul 12, 2026

    @XuPeng-SH
    ContributorAuthor
  7. Ariznawlll commented on Jul 13, 2026

    @Ariznawlll
    Collaborator

    已在最新 main@2865ed6cc8a39727b8b274bb52b88fe441d0b30c 验证通过。

    • 对应修复:de6438665 / fix: strengthen filter pushdown and PK pruning #25596。
    • stats 重算前会保存 composite rewrite 消耗的 constituent block filters,重建后与 compound filter 合并并按 canonical identity 去重。
    • 相关 planner 矩阵使用 -race -count=10 通过,覆盖复合 PK/cluster key、disable hint、in-place predicate mutation、folded IN vector、重复 stats/rewrite 和跨 planner representation 去重。

    未发现 part-column zonemap filter 再次丢失或重复,修复有效。

  8. added 3 commits that reference this issue on Sep 17, 2026
    69cf9ab
    00f3b8c
    59220c3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

kind/bugseverity/s0

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions