mirror of
				https://github.com/postgres/postgres.git
				synced 2025-10-29 22:49:41 +03:00 
			
		
		
		
	Department of marginal improvements: teach tupconvert.c to avoid doing a
physical conversion when there are dropped columns in the same places in the input and output tupdescs. This avoids possible performance loss from the recent patch to improve dropped-column handling, in some cases where the old code would have worked.
This commit is contained in:
		| @@ -14,7 +14,7 @@ | |||||||
|  * |  * | ||||||
|  * |  * | ||||||
|  * IDENTIFICATION |  * IDENTIFICATION | ||||||
|  *	  $PostgreSQL: pgsql/src/backend/access/common/tupconvert.c,v 1.1 2009/08/06 20:44:31 tgl Exp $ |  *	  $PostgreSQL: pgsql/src/backend/access/common/tupconvert.c,v 1.2 2009/08/17 20:34:31 tgl Exp $ | ||||||
|  * |  * | ||||||
|  *------------------------------------------------------------------------- |  *------------------------------------------------------------------------- | ||||||
|  */ |  */ | ||||||
| @@ -146,13 +146,24 @@ convert_tuples_by_position(TupleDesc indesc, | |||||||
| 	{ | 	{ | ||||||
| 		for (i = 0; i < n; i++) | 		for (i = 0; i < n; i++) | ||||||
| 		{ | 		{ | ||||||
| 			if (attrMap[i] != (i+1)) | 			if (attrMap[i] == (i+1)) | ||||||
| 			{ | 				continue; | ||||||
|  |  | ||||||
|  | 			/* | ||||||
|  | 			 * If it's a dropped column and the corresponding input | ||||||
|  | 			 * column is also dropped, we needn't convert.  However, | ||||||
|  | 			 * attlen and attalign must agree. | ||||||
|  | 			 */ | ||||||
|  | 			if (attrMap[i] == 0 && | ||||||
|  | 				indesc->attrs[i]->attisdropped && | ||||||
|  | 				indesc->attrs[i]->attlen == outdesc->attrs[i]->attlen && | ||||||
|  | 				indesc->attrs[i]->attalign == outdesc->attrs[i]->attalign) | ||||||
|  | 				continue; | ||||||
|  |  | ||||||
| 			same = false; | 			same = false; | ||||||
| 			break; | 			break; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	} |  | ||||||
| 	else | 	else | ||||||
| 		same = false; | 		same = false; | ||||||
|  |  | ||||||
| @@ -255,13 +266,24 @@ convert_tuples_by_name(TupleDesc indesc, | |||||||
| 		same = true; | 		same = true; | ||||||
| 		for (i = 0; i < n; i++) | 		for (i = 0; i < n; i++) | ||||||
| 		{ | 		{ | ||||||
| 			if (attrMap[i] != (i+1)) | 			if (attrMap[i] == (i+1)) | ||||||
| 			{ | 				continue; | ||||||
|  |  | ||||||
|  | 			/* | ||||||
|  | 			 * If it's a dropped column and the corresponding input | ||||||
|  | 			 * column is also dropped, we needn't convert.  However, | ||||||
|  | 			 * attlen and attalign must agree. | ||||||
|  | 			 */ | ||||||
|  | 			if (attrMap[i] == 0 && | ||||||
|  | 				indesc->attrs[i]->attisdropped && | ||||||
|  | 				indesc->attrs[i]->attlen == outdesc->attrs[i]->attlen && | ||||||
|  | 				indesc->attrs[i]->attalign == outdesc->attrs[i]->attalign) | ||||||
|  | 				continue; | ||||||
|  |  | ||||||
| 			same = false; | 			same = false; | ||||||
| 			break; | 			break; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 	} |  | ||||||
| 	else | 	else | ||||||
| 		same = false; | 		same = false; | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user