mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	Avoid making a separate pass over the query to check for partializability.
It's rather silly to make a separate pass over the tlist + HAVING qual, and a separate set of visits to the syscache, when get_agg_clause_costs already has all the required information in hand. This nets out as less code as well as fewer cycles.
This commit is contained in:
		@@ -50,12 +50,15 @@ typedef struct QualCost
 | 
			
		||||
 * Costing aggregate function execution requires these statistics about
 | 
			
		||||
 * the aggregates to be executed by a given Agg node.  Note that the costs
 | 
			
		||||
 * include the execution costs of the aggregates' argument expressions as
 | 
			
		||||
 * well as the aggregate functions themselves.
 | 
			
		||||
 * well as the aggregate functions themselves.  Also, the fields must be
 | 
			
		||||
 * defined so that initializing the struct to zeroes with memset is correct.
 | 
			
		||||
 */
 | 
			
		||||
typedef struct AggClauseCosts
 | 
			
		||||
{
 | 
			
		||||
	int			numAggs;		/* total number of aggregate functions */
 | 
			
		||||
	int			numOrderedAggs; /* number w/ DISTINCT/ORDER BY/WITHIN GROUP */
 | 
			
		||||
	bool		hasNonPartial;	/* does any agg not support partial mode? */
 | 
			
		||||
	bool		hasNonSerial;	/* is any partial agg non-serializable? */
 | 
			
		||||
	QualCost	transCost;		/* total per-input-row execution costs */
 | 
			
		||||
	Cost		finalCost;		/* total per-aggregated-row costs */
 | 
			
		||||
	Size		transitionSpace;	/* space for pass-by-ref transition data */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user