[Bug] GPORCA: ERROR "btree index keys must be ordered by attribute" when a qual references an INCLUDE column
メンテナーはふだん 3 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 52/100
調査の方向性
Start by reproducing the SQL examples with GPORCA enabled, then compare the plans and results with the optimizer disabled. Trace how the btree INCLUDE column reaches the Index Cond; done means INCLUDE columns are not used as scan keys and the queries complete without the runtime error.
索引モデルが issue の本文から書いたものです。
説明
Apache Cloudberry version
No response
What happened
With GPORCA (optimizer = on), a qual on a btree index's INCLUDE (non-key) column can be pushed into the Index Cond. INCLUDE columns are payload only and are not searchable, so the executor
rejects the scan keys at runtime:
ERROR: btree index keys must be ordered by attribute (nbtutils.c:799)
The Postgres planner (optimizer = off) is not affected. The table does not need to contain any rows.
What you think should happen instead
No response
How to reproduce
CREATE TABLE c2t(a int, b int) DISTRIBUTED BY (a);
CREATE INDEX ci1 ON c2t USING btree (a) INCLUDE (b);
SET optimizer = on;
SELECT a, b FROM c2t WHERE b IS NULL;
-- ERROR: btree index keys must be ordered by attribute (nbtutils.c:799) (seg2 slice1 ...)
The plan puts the INCLUDE column b into the Index Cond:
EXPLAIN (COSTS OFF) SELECT a, b FROM c2t WHERE b IS NULL;
Gather Motion 3:1 (slice1; segments: 3)
-> Index Scan using ci1 on c2t
Index Cond: (b IS NULL)
Optimizer: GPORCA
Same error with GROUP BY and with an index whose INCLUDE list repeats a key column:
CREATE TABLE c1t(a int, b int) DISTRIBUTED BY (a);
CREATE INDEX ci0 ON c1t USING btree (a) INCLUDE (a, b);
SET optimizer = on;
SELECT a, b FROM c1t WHERE b IS NULL GROUP BY a, b;
-- ERROR: btree index keys must be ordered by attribute (nbtutils.c:799)
With SET optimizer = off; all of the above return the correct rows.
Operating System
any
Anything else
No response
Are you willing to submit PR?
- Yes, I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct.
- 主要言語
- C
- スター
- 1.4k
- フォーク
- 260
- 平均マージ
- 4日 5時間
- マージ済み PR(30日)
- 51
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
apache/cloudberry のほかの issue
-
[Bug] Expand fails to recognize user-defined tablespaces対応中かも @nix-oss が 54 日前に担当しました。 オープンtype: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
apache/cloudberry#1885 · リアクション 2 件 ·
メンテナーはふだん 3 日以内に返信
-
gpexpand first stage fails: 'SyncPackages' object has no attribute 'ret' (extension sync never runs; regression)対応中かも @talmacschen-arch が 115 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
apache/cloudberry#1825 ·
メンテナーはふだん 3 日以内に返信
-
type: Bug
難易度 4/5 3〜5日 初心者へのやさしさ 12/100
apache/cloudberry#2101 · コメント 1 件 ·
メンテナーはふだん 3 日以内に返信
-
[Bug]対応中かも @yjhjstz が 3 日前に担当しました。 オープンtype: Bug
難易度 4/5 3〜5日 初心者へのやさしさ 15/100
apache/cloudberry#2098 · コメント 1 件 ·
メンテナーはふだん 3 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 12/100
apache/cloudberry#2097 · コメント 1 件 ·
メンテナーはふだん 3 日以内に返信
apache/cloudberry の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
KalicoCrew/kalico#1012 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
joncampbell123/dosbox-x#6664 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
osam-cologne/archlinux-proaudio#909 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
tpm2-software/tpm2-abrmd#879 ·
メンテナーはふだん 1 日以内に返信