On Mon, Jul 30, 2018 at 12:11 AM, Pavel Stehule <pavel.stehule@xxxxxxxxx> wrote:
2018-07-30 1:00 GMT+02:00 Tom Lane <tgl@xxxxxxxxxxxxx>:David Rowley <david.rowley@xxxxxxxxxxxxxxx> writes:
> On 29 July 2018 at 17:38, Dinesh Kumar <dns98944@xxxxxxxxx> wrote:
>> I found performance variance between accessing int1 and int200 column which
>> is quite large.
> Have a look at slot_deform_tuple and heap_deform_tuple. You'll see
> that tuples are deformed starting at the first attribute. If you ask
> for attribute 200 then it must deform 1-199 first.
Note that that can be optimized away in some cases, though evidently
not the one the OP is testing. From memory, you need a tuple that
contains no nulls, and all the columns to the left of the target
column have to be fixed-width datatypes. Otherwise, the offset to
the target column is uncertain, and we have to search for it.JIT decrease a overhead of this.
The bottleneck here is such a simple construct, I don't see how JIT could improve it by much.
And indeed, in my hands JIT makes it almost 3 times worse.
Run against ab87b8fedce3fa77ca0d6, I get 12669.619 ms for the 2nd JIT execution and 4594.994 ms for the JIT=off.
Cheers,
Jeff
drop table if exists i200c200; create table i200c200 ( pk bigint primary key, int1 bigint, int2 bigint, int3 bigint, int4 bigint, int5 bigint, int6 bigint, int7 bigint, int8 bigint, int9 bigint, int10 bigint, int11 bigint, int12 bigint, int13 bigint, int14 bigint, int15 bigint, int16 bigint, int17 bigint, int18 bigint, int19 bigint, int20 bigint, int21 bigint, int22 bigint, int23 bigint, int24 bigint, int25 bigint, int26 bigint, int27 bigint, int28 bigint, int29 bigint, int30 bigint, int31 bigint, int32 bigint, int33 bigint, int34 bigint, int35 bigint, int36 bigint, int37 bigint, int38 bigint, int39 bigint, int40 bigint, int41 bigint, int42 bigint, int43 bigint, int44 bigint, int45 bigint, int46 bigint, int47 bigint, int48 bigint, int49 bigint, int50 bigint, int51 bigint, int52 bigint, int53 bigint, int54 bigint, int55 bigint, int56 bigint, int57 bigint, int58 bigint, int59 bigint, int60 bigint, int61 bigint, int62 bigint, int63 bigint, int64 bigint, int65 bigint, int66 bigint, int67 bigint, int68 bigint, int69 bigint, int70 bigint, int71 bigint, int72 bigint, int73 bigint, int74 bigint, int75 bigint, int76 bigint, int77 bigint, int78 bigint, int79 bigint, int80 bigint, int81 bigint, int82 bigint, int83 bigint, int84 bigint, int85 bigint, int86 bigint, int87 bigint, int88 bigint, int89 bigint, int90 bigint, int91 bigint, int92 bigint, int93 bigint, int94 bigint, int95 bigint, int96 bigint, int97 bigint, int98 bigint, int99 bigint, int100 bigint, int101 bigint, int102 bigint, int103 bigint, int104 bigint, int105 bigint, int106 bigint, int107 bigint, int108 bigint, int109 bigint, int110 bigint, int111 bigint, int112 bigint, int113 bigint, int114 bigint, int115 bigint, int116 bigint, int117 bigint, int118 bigint, int119 bigint, int120 bigint, int121 bigint, int122 bigint, int123 bigint, int124 bigint, int125 bigint, int126 bigint, int127 bigint, int128 bigint, int129 bigint, int130 bigint, int131 bigint, int132 bigint, int133 bigint, int134 bigint, int135 bigint, int136 bigint, int137 bigint, int138 bigint, int139 bigint, int140 bigint, int141 bigint, int142 bigint, int143 bigint, int144 bigint, int145 bigint, int146 bigint, int147 bigint, int148 bigint, int149 bigint, int150 bigint, int151 bigint, int152 bigint, int153 bigint, int154 bigint, int155 bigint, int156 bigint, int157 bigint, int158 bigint, int159 bigint, int160 bigint, int161 bigint, int162 bigint, int163 bigint, int164 bigint, int165 bigint, int166 bigint, int167 bigint, int168 bigint, int169 bigint, int170 bigint, int171 bigint, int172 bigint, int173 bigint, int174 bigint, int175 bigint, int176 bigint, int177 bigint, int178 bigint, int179 bigint, int180 bigint, int181 bigint, int182 bigint, int183 bigint, int184 bigint, int185 bigint, int186 bigint, int187 bigint, int188 bigint, int189 bigint, int190 bigint, int191 bigint, int192 bigint, int193 bigint, int194 bigint, int195 bigint, int196 bigint, int197 bigint, int198 bigint, int199 bigint, int200 bigint, char1 varchar(255), char2 varchar(255), char3 varchar(255), char4 varchar(255), char5 varchar(255), char6 varchar(255), char7 varchar(255), char8 varchar(255), char9 varchar(255), char10 varchar(255), char11 varchar(255), char12 varchar(255), char13 varchar(255), char14 varchar(255), char15 varchar(255), char16 varchar(255), char17 varchar(255), char18 varchar(255), char19 varchar(255), char20 varchar(255), char21 varchar(255), char22 varchar(255), char23 varchar(255), char24 varchar(255), char25 varchar(255), char26 varchar(255), char27 varchar(255), char28 varchar(255), char29 varchar(255), char30 varchar(255), char31 varchar(255), char32 varchar(255), char33 varchar(255), char34 varchar(255), char35 varchar(255), char36 varchar(255), char37 varchar(255), char38 varchar(255), char39 varchar(255), char40 varchar(255), char41 varchar(255), char42 varchar(255), char43 varchar(255), char44 varchar(255), char45 varchar(255), char46 varchar(255), char47 varchar(255), char48 varchar(255), char49 varchar(255), char50 varchar(255), char51 varchar(255), char52 varchar(255), char53 varchar(255), char54 varchar(255), char55 varchar(255), char56 varchar(255), char57 varchar(255), char58 varchar(255), char59 varchar(255), char60 varchar(255), char61 varchar(255), char62 varchar(255), char63 varchar(255), char64 varchar(255), char65 varchar(255), char66 varchar(255), char67 varchar(255), char68 varchar(255), char69 varchar(255), char70 varchar(255), char71 varchar(255), char72 varchar(255), char73 varchar(255), char74 varchar(255), char75 varchar(255), char76 varchar(255), char77 varchar(255), char78 varchar(255), char79 varchar(255), char80 varchar(255), char81 varchar(255), char82 varchar(255), char83 varchar(255), char84 varchar(255), char85 varchar(255), char86 varchar(255), char87 varchar(255), char88 varchar(255), char89 varchar(255), char90 varchar(255), char91 varchar(255), char92 varchar(255), char93 varchar(255), char94 varchar(255), char95 varchar(255), char96 varchar(255), char97 varchar(255), char98 varchar(255), char99 varchar(255), char100 varchar(255), char101 varchar(255), char102 varchar(255), char103 varchar(255), char104 varchar(255), char105 varchar(255), char106 varchar(255), char107 varchar(255), char108 varchar(255), char109 varchar(255), char110 varchar(255), char111 varchar(255), char112 varchar(255), char113 varchar(255), char114 varchar(255), char115 varchar(255), char116 varchar(255), char117 varchar(255), char118 varchar(255), char119 varchar(255), char120 varchar(255), char121 varchar(255), char122 varchar(255), char123 varchar(255), char124 varchar(255), char125 varchar(255), char126 varchar(255), char127 varchar(255), char128 varchar(255), char129 varchar(255), char130 varchar(255), char131 varchar(255), char132 varchar(255), char133 varchar(255), char134 varchar(255), char135 varchar(255), char136 varchar(255), char137 varchar(255), char138 varchar(255), char139 varchar(255), char140 varchar(255), char141 varchar(255), char142 varchar(255), char143 varchar(255), char144 varchar(255), char145 varchar(255), char146 varchar(255), char147 varchar(255), char148 varchar(255), char149 varchar(255), char150 varchar(255), char151 varchar(255), char152 varchar(255), char153 varchar(255), char154 varchar(255), char155 varchar(255), char156 varchar(255), char157 varchar(255), char158 varchar(255), char159 varchar(255), char160 varchar(255), char161 varchar(255), char162 varchar(255), char163 varchar(255), char164 varchar(255), char165 varchar(255), char166 varchar(255), char167 varchar(255), char168 varchar(255), char169 varchar(255), char170 varchar(255), char171 varchar(255), char172 varchar(255), char173 varchar(255), char174 varchar(255), char175 varchar(255), char176 varchar(255), char177 varchar(255), char178 varchar(255), char179 varchar(255), char180 varchar(255), char181 varchar(255), char182 varchar(255), char183 varchar(255), char184 varchar(255), char185 varchar(255), char186 varchar(255), char187 varchar(255), char188 varchar(255), char189 varchar(255), char190 varchar(255), char191 varchar(255), char192 varchar(255), char193 varchar(255), char194 varchar(255), char195 varchar(255), char196 varchar(255), char197 varchar(255), char198 varchar(255), char199 varchar(255), char200 varchar(255) ) ; insert into i200c200 (pk, int1, int200) select x, random()*100000000, random()*100000000 from generate_series(1,10000000) f(x); vacuum analyze i200c200; explain analyze select pk, int200 from i200c200; explain analyze select pk, int200 from i200c200; set jit=off; explain analyze select pk, int200 from i200c200;