Re: Does TupleQueueReaderNext() really need to copy its result?
| От | Thomas Munro | 
|---|---|
| Тема | Re: Does TupleQueueReaderNext() really need to copy its result? | 
| Дата | |
| Msg-id | CA+hUKGJzJ7iuoiRhqTpYXrd4xy71Bcs_ExhrO7OO-JQ_4k+gLA@mail.gmail.com обсуждение исходный текст | 
| Ответ на | Re: Does TupleQueueReaderNext() really need to copy its result? (Andres Freund <andres@anarazel.de>) | 
| Ответы | Re: Does TupleQueueReaderNext() really need to copy its result? | 
| Список | pgsql-hackers | 
On Tue, Aug 27, 2019 at 6:35 AM Andres Freund <andres@anarazel.de> wrote:
> On 2019-08-26 14:09:45 -0400, Robert Haas wrote:
> > There's a comment in htup.h which says:
> >
> >  * * Separately allocated tuple: t_data points to a palloc'd chunk that
> >  *       is not adjacent to the HeapTupleData.  (This case is deprecated since
> >  *       it's difficult to tell apart from case #1.  It should be used only in
> >  *       limited contexts where the code knows that case #1 will never apply.)
> >
> > I got scared and ran away.
>
> Perhaps this'd could be sidestepped by funneling through MinimalTuples
> instead of HeapTuples. Afaict that should always be sufficient, because
> all system column accesses ought to happen below (including being
> projected into a separate column, if needed above). With the added
> benefit of needing less space, of course.
I tried that out (attached).  That makes various simple tests like
this to go 10%+ faster on my development machine:
  create table s as select generate_series(1, 50000000)::int i,
                           'hello world' a,
                           'this is a message' b,
                           42 c;
  select pg_prewarm('s');
  set force_parallel_mode = on;
  explain analyze select * from s;
PS  It looks like the following load of mq_ring_size might be running
a little hot due to false sharing with the atomic counters:
       if (mqh->mqh_consume_pending > mq->mq_ring_size / 4)
		
	Вложения
В списке pgsql-hackers по дате отправления: