Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite2c2c2e

Browse files
committed
Improve planner's handling of duplicated index column expressions.
It's potentially useful for an index to repeat the same indexable columnor expression in multiple index columns, if the columns have differentopclasses. (If they share opclasses too, the duplicate column is prettyuseless, but nonetheless we've allowed such cases since 9.0.) However,the planner failed to cope with this, because createplan.c was relying onsimple equal() matching to figure out which index column each index qualis intended for. We do have that information available upstream inindxpath.c, though, so the fix is to not flatten the multi-level indexqualslist when putting it into an IndexPath. Then we can rely on the subliststructure to identify target index columns in createplan.c. There's asimilar issue for index ORDER BYs (the KNNGIST feature), so introduce amulti-level-list representation for that too. This adds a bit morerepresentational overhead, but we might more or less buy that back by nothaving to search for matching index columns anymore in createplan.c;likewise btcostestimate saves some cycles.Per bug #6351 from Christian Rudolph. Likely symptoms include the "btreeindex keys must be ordered by attribute" failure shown there, as well as"operator MMMM is not a member of opfamily NNNN".Although this is a pre-existing problem that can be demonstrated in 9.0 and9.1, I'm not going to back-patch it, because the API changes in the plannerseem likely to break things such as index plugins. The corner cases wherethis matters seem too narrow to justify possibly breaking things in a minorrelease.
1 parentd5448c7 commite2c2c2e

File tree

12 files changed

+560
-317
lines changed

12 files changed

+560
-317
lines changed

‎src/backend/optimizer/path/costsize.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,10 @@ cost_seqscan(Path *path, PlannerInfo *root,
209209
* Determines and returns the cost of scanning a relation using an index.
210210
*
211211
* 'index' is the index to be used
212-
* 'indexQuals' is the list of applicable qual clauses (implicit AND semantics)
213-
* 'indexOrderBys' is the list of ORDER BY operators for amcanorderbyop indexes
212+
* 'indexQuals' is a list of lists of applicable qual clauses (implicit AND
213+
*semantics, one sub-list per index column)
214+
* 'indexOrderBys' is a list of lists of lists of ORDER BY expressions for
215+
*amcanorderbyop indexes (lists per pathkey and index column)
214216
* 'indexonly' is true if it's an index-only scan
215217
* 'outer_rel' is the outer relation when we are considering using the index
216218
*scan as the inside of a nestloop join (hence, some of the indexQuals
@@ -221,8 +223,8 @@ cost_seqscan(Path *path, PlannerInfo *root,
221223
* additional fields of the IndexPath besides startup_cost and total_cost.
222224
* These fields are needed if the IndexPath is used in a BitmapIndexScan.
223225
*
224-
* indexQuals is a list of RestrictInfo nodes, but indexOrderBys is a list of
225-
* bare expressions.
226+
* indexQuals is a list oflists ofRestrictInfo nodes, but indexOrderBys
227+
*is a list of lists of lists ofbare expressions.
226228
*
227229
* NOTE: 'indexQuals' must contain only clauses usable as index restrictions.
228230
* Any additional quals evaluated as qpquals may reduce the number of returned

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp