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

Commit76799fc

Browse files
committed
Always build a custom plan node's targetlist from the path's pathtarget.
We were applying the use_physical_tlist optimization to all relationscan plans, even those implemented by custom scan providers. However,that's a bad idea for a couple of reasons. The custom provider mightbe unable to provide columns that it hadn't expected to be asked for(for example, the custom scan might depend on an index-only scan).Even more to the point, there's no good reason to suppose that this"optimization" is a win for a custom scan; whatever the custom provideris doing is likely not based on simply returning physical heap tuples.(As a counterexample, if the custom scan is an interface to a column store,demanding all columns would be a huge loss.) If it is a win, the customprovider could make that decision for itself and insert a suitablepathtarget into the path, anyway.Per discussion with Dmitry Ivanov. Back-patch to 9.5 where custom scansupport was introduced. The argument that the custom provider can adjustthe behavior by changing the pathtarget only applies to 9.6+, but onbalance it seems more likely that use_physical_tlist will hurt customscans than help them.Discussion:https://postgr.es/m/e29ddd30-8ef9-4da5-a50b-2bb7b8c7198d@postgrespro.ru
1 parent9e0e555 commit76799fc

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

‎src/backend/optimizer/plan/createplan.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,15 @@ use_physical_tlist(PlannerInfo *root, Path *path, int flags)
799799
if (rel->reloptkind!=RELOPT_BASEREL)
800800
return false;
801801

802+
/*
803+
* Also, don't do it to a CustomPath; the premise that we're extracting
804+
* columns from a simple physical tuple is unlikely to hold for those.
805+
* (When it does make sense, the custom path creator can set up the path's
806+
* pathtarget that way.)
807+
*/
808+
if (IsA(path,CustomPath))
809+
return false;
810+
802811
/*
803812
* Can't do it if any system columns or whole-row Vars are requested.
804813
* (This could possibly be fixed but would take some fragile assumptions

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp