|
7 | 7 | * Portions Copyright (c) 1994, Regents of the University of California
|
8 | 8 | *
|
9 | 9 | * IDENTIFICATION
|
10 |
| - * $PostgreSQL: pgsql/src/backend/optimizer/plan/subselect.c,v 1.107 2006/05/03 00:24:56 tgl Exp $ |
| 10 | + * $PostgreSQL: pgsql/src/backend/optimizer/plan/subselect.c,v 1.108 2006/06/28 20:04:38 tgl Exp $ |
11 | 11 | *
|
12 | 12 | *-------------------------------------------------------------------------
|
13 | 13 | */
|
@@ -585,11 +585,13 @@ subplan_is_hashable(SubLink *slink, SubPlan *node)
|
585 | 585 | return false;
|
586 | 586 |
|
587 | 587 | /*
|
588 |
| - * The estimated size of the subquery result must fit in work_mem. (XXX |
589 |
| - * what about hashtable overhead?) |
| 588 | + * The estimated size of the subquery result must fit in work_mem. |
| 589 | + * (Note: we use sizeof(HeapTupleHeaderData) here even though the tuples |
| 590 | + * will actually be stored as MinimalTuples; this provides some fudge |
| 591 | + * factor for hashtable overhead.) |
590 | 592 | */
|
591 | 593 | subquery_size=node->plan->plan_rows*
|
592 |
| -(MAXALIGN(node->plan->plan_width)+MAXALIGN(sizeof(HeapTupleData))); |
| 594 | +(MAXALIGN(node->plan->plan_width)+MAXALIGN(sizeof(HeapTupleHeaderData))); |
593 | 595 | if (subquery_size>work_mem*1024L)
|
594 | 596 | return false;
|
595 | 597 |
|
|