1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-02 04:21:28 +03:00

Improve performance of SendRowDescriptionMessage.

There's three categories of changes leading to better performance:
- Splitting the per-attribute part of SendRowDescriptionMessage into a
  v2 and a v3 version allows avoiding branches for every attribute.
- Preallocating the size of the buffer to be big enough for all
  attributes and then using pq_write* avoids unnecessary buffer
  size checks & resizing.
- Reusing a persistently allocated StringInfo for all
  SendRowDescriptionMessage() invocations avoids repeated allocations
  & reallocations.

Author: Andres Freund
Discussion: https://postgr.es/m/20170914063418.sckdzgjfrsbekae4@alap3.anarazel.de
This commit is contained in:
Andres Freund
2017-10-11 16:49:31 -07:00
parent cff440d368
commit 4c119fbcd4
3 changed files with 140 additions and 49 deletions

View File

@@ -20,8 +20,8 @@ extern DestReceiver *printtup_create_DR(CommandDest dest);
extern void SetRemoteDestReceiverParams(DestReceiver *self, Portal portal);
extern void SendRowDescriptionMessage(TupleDesc typeinfo, List *targetlist,
int16 *formats);
extern void SendRowDescriptionMessage(StringInfo buf,
TupleDesc typeinfo, List *targetlist, int16 *formats);
extern void debugStartup(DestReceiver *self, int operation,
TupleDesc typeinfo);