Re: Make tuple deformation faster - Mailing list pgsql-hackers

From Andy Fan
Subject Re: Make tuple deformation faster
Date
Msg-id 87cynxwjxv.fsf@163.com
Whole thread Raw
In response to Make tuple deformation faster  (David Rowley <dgrowleyml@gmail.com>)
Responses Re: Make tuple deformation faster
List pgsql-hackers
David Rowley <dgrowleyml@gmail.com> writes:

> Currently, TupleDescData contains the descriptor's attributes in a
> variable length array of FormData_pg_attribute allocated within the
> same allocation as the TupleDescData. According to my IDE,
> sizeof(FormData_pg_attribute) == 104 bytes. It's that large mainly due
> to attname being 64 bytes. The TupleDescData.attrs[] array could end
> up quite large on tables with many columns and that could result in
> poor CPU cache hit ratios when deforming tuples.
...
>
> To test the performance of this, I tried using the attached script
> which creates a table where the first column is a variable length
> column and the final column is an int.  The query I ran to test the
> performance inserted 1 million rows into this table and performed a
> sum() on the final column.  The attached graph shows that the query is
> 30% faster than master with 15 columns between the first and last
> column.

Yet another a wonderful optimization! I just want to know how did you
find this optimization (CPU cache hit) case and think it worths some
time. because before we invest our time to optimize something, it is
better know that we can get some measurable improvement after our time
is spend. At for this case, 30% is really a huge number even it is a
artificial case.

Another case is Andrew introduced NullableDatum 5 years ago and said using
it in TupleTableSlot could be CPU cache friendly, I can follow that, but
how much it can improve in an ideal case, is it possible to forecast it
somehow? I ask it here because both cases are optimizing for CPU cache..


-- 
Best Regards
Andy Fan




pgsql-hackers by date:

Previous
From: Jelte Fennema-Nio
Date:
Subject: Re: doc: modify the comment in function libpqrcv_check_conninfo()
Next
From: Andrei Lepikhov
Date:
Subject: Re: A new strategy for pull-up correlated ANY_SUBLINK