create_unique_path and GEQO
Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>
From: Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2017-03-22T10:13:56Z
Lists: pgsql-hackers
Hi,
In create_unique_path() there's comment
/*
* We must ensure path struct and subsidiary data are allocated in main
* planning context; otherwise GEQO memory management causes trouble.
*/
oldcontext = MemoryContextSwitchTo(root->planner_cxt);
pathnode = makeNode(UniquePath);
This means that when GEQO resets the memory context, the RelOptInfo
for which this path is created and may be set to cheapest_unique_path
goes away, the unique path lingers on in the planner context.
Shouldn't we instead allocate the path in the same context as the
RelOptInfo similar to mark_dummy_rel()?
--
Best Wishes,
Ashutosh Bapat
EnterpriseDB Corporation
The Postgres Database Company
Commits
-
Make create_unique_path manage memory like mark_dummy_rel.
- 1761653bbb17 11.0 landed
-
Use parameterized paths to generate inner indexscans more flexibly.
- e2fa76d80ba5 9.2.0 cited
-
Ensure mark_dummy_rel doesn't create dangling pointers in RelOptInfos.
- eca75a12a27d 9.1.0 cited
-
Refactor planner's pathkeys data structure to create a separate, explicit
- f41803bb39bc 8.3.0 cited
-
IN clauses appearing at top level of WHERE can now be handled as joins.
- bdfbfde1b168 7.4.1 cited