Questions on printtup()

Started by Qingqing Zhouabout 20 years ago2 messages
#1Qingqing Zhou
zhouqq@cs.toronto.edu

I did some profiling related to printtup() by a simple libpq "SELECT *
test" program (revised from the libpq programing sample in document
without retriving the results). There are 260k or so records in table
test(i int).

/* original version - prepare tuple and send */
SELECT * TIMING: 0.63 sec

/* Prepare but not send
In printtup():
- pq_endmessage(&buf);
+ pfree(buf.data);
+ buf.data = NULL;
*/
SELECT * TIMING: 0.46 sec

/* No prepare no send
In ExecSelect():
- (*dest->receiveSlot) (slot, dest);
*/
SELECT * TIMING: 0.08 sec

So we spend a portion of time at preparing tuples in printtup() by
converting the tuple format to a network format. I am not quite familiar
with that part, so I wonder is it possible to try to send with original
tuple format with minimal preparing job (say handling toast) -- which
might increase the amount of data of network communication, but may reduce
the CPU on server side?

If this is not a non-starter, I am happy to look into details,

Regards,
Qingqing

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Qingqing Zhou (#1)
Re: Questions on printtup()

Qingqing Zhou <zhouqq@cs.toronto.edu> writes:

So we spend a portion of time at preparing tuples in printtup() by
converting the tuple format to a network format. I am not quite familiar
with that part, so I wonder is it possible to try to send with original
tuple format with minimal preparing job (say handling toast) -- which
might increase the amount of data of network communication, but may reduce
the CPU on server side?

It's called retrieving in binary format ...

regards, tom lane