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

Commit2a2435e

Browse files
committed
Small improvements to OPTIMIZER_DEBUG code.
Now that Paths have their own rows field, print that rather thanthe parent relation's rowcount.Show the relid sets associated with Paths using table names ratherthan numbers; since this code is able to print simple Var referencesusing table names, it seems a bit silly that print_relids can't.Print the cheapest_parameterized_paths list for a RelOptInfo, andinclude information about a parameterized path's required_outer rels.Noted while trying to use this feature to debug Alexander Kirkouski'srecent bug report.
1 parentc45bf57 commit2a2435e

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

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

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2829,7 +2829,7 @@ remove_unused_subquery_outputs(Query *subquery, RelOptInfo *rel)
28292829
#ifdefOPTIMIZER_DEBUG
28302830

28312831
staticvoid
2832-
print_relids(Relidsrelids)
2832+
print_relids(PlannerInfo*root,Relidsrelids)
28332833
{
28342834
intx;
28352835
boolfirst= true;
@@ -2839,7 +2839,11 @@ print_relids(Relids relids)
28392839
{
28402840
if (!first)
28412841
printf(" ");
2842-
printf("%d",x);
2842+
if (x<root->simple_rel_array_size&&
2843+
root->simple_rte_array[x])
2844+
printf("%s",root->simple_rte_array[x]->eref->aliasname);
2845+
else
2846+
printf("%d",x);
28432847
first= false;
28442848
}
28452849
}
@@ -3013,10 +3017,17 @@ print_path(PlannerInfo *root, Path *path, int indent)
30133017
if (path->parent)
30143018
{
30153019
printf("(");
3016-
print_relids(path->parent->relids);
3017-
printf(") rows=%.0f",path->parent->rows);
3020+
print_relids(root,path->parent->relids);
3021+
printf(")");
3022+
}
3023+
if (path->param_info)
3024+
{
3025+
printf(" required_outer (");
3026+
print_relids(root,path->param_info->ppi_req_outer);
3027+
printf(")");
30183028
}
3019-
printf(" cost=%.2f..%.2f\n",path->startup_cost,path->total_cost);
3029+
printf(" rows=%.0f cost=%.2f..%.2f\n",
3030+
path->rows,path->startup_cost,path->total_cost);
30203031

30213032
if (path->pathkeys)
30223033
{
@@ -3062,7 +3073,7 @@ debug_print_rel(PlannerInfo *root, RelOptInfo *rel)
30623073
ListCell*l;
30633074

30643075
printf("RELOPTINFO (");
3065-
print_relids(rel->relids);
3076+
print_relids(root,rel->relids);
30663077
printf("): rows=%.0f width=%d\n",rel->rows,rel->reltarget->width);
30673078

30683079
if (rel->baserestrictinfo)
@@ -3082,6 +3093,12 @@ debug_print_rel(PlannerInfo *root, RelOptInfo *rel)
30823093
printf("\tpath list:\n");
30833094
foreach(l,rel->pathlist)
30843095
print_path(root,lfirst(l),1);
3096+
if (rel->cheapest_parameterized_paths)
3097+
{
3098+
printf("\n\tcheapest parameterized paths:\n");
3099+
foreach(l,rel->cheapest_parameterized_paths)
3100+
print_path(root,lfirst(l),1);
3101+
}
30853102
if (rel->cheapest_startup_path)
30863103
{
30873104
printf("\n\tcheapest startup path:\n");

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp