From 9b5b9616f49e0da74d227019e1ce20e73980dcb8 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 23 Apr 2005 21:32:34 +0000 Subject: Remove explicit FreeExprContext calls during plan node shutdown. The ExprContexts will be freed anyway when FreeExecutorState() is reached, and letting that routine do the work is more efficient because it will automatically free the ExprContexts in reverse creation order. The existing coding was effectively freeing them in exactly the worst possible order, resulting in O(N^2) behavior inside list_delete_ptr, which becomes highly visible in cases with a few thousand plan nodes. ExecFreeExprContext is now effectively a no-op and could be removed, but I left it in place in case we ever want to put it back to use. --- src/backend/executor/nodeIndexscan.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/backend/executor/nodeIndexscan.c') diff --git a/src/backend/executor/nodeIndexscan.c b/src/backend/executor/nodeIndexscan.c index 6546f479708..27cc29a62b4 100644 --- a/src/backend/executor/nodeIndexscan.c +++ b/src/backend/executor/nodeIndexscan.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeIndexscan.c,v 1.100 2005/03/16 21:38:07 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeIndexscan.c,v 1.101 2005/04/23 21:32:34 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -534,11 +534,13 @@ ExecEndIndexScan(IndexScanState *node) relation = node->ss.ss_currentRelation; /* - * Free the exprcontext(s) + * Free the exprcontext(s) ... now dead code, see ExecFreeExprContext */ +#ifdef NOT_USED ExecFreeExprContext(&node->ss.ps); if (node->iss_RuntimeContext) FreeExprContext(node->iss_RuntimeContext); +#endif /* * clear out tuple table slots -- cgit v1.2.3