From: Tom Lane <tgl@sss.pgh.pa.us>
To: David Rowley <david.rowley@2ndquadrant.com>
Cc: Dinesh Kumar <dns98944@gmail.com>
Cc: postgres performance list <pgsql-performance@postgresql.org>
Subject: Re: Performance difference in accessing differrent columns in a Postgres Table
Date: Sun, 29 Jul 2018 19:00:59 -0400
Message-ID: <16506.1532905259@sss.pgh.pa.us> (raw)
In-Reply-To: <CAKJS1f_CrjvGYExtmzYzzUnD9XzcbFpo6R_FON2hewSHpqM1xg@mail.gmail.com>
References: <CAEe=mRnNNL3RDKJDmY=_mpcpAb5ugYL9NcchELa6Qgtoz2NjCw@mail.gmail.com>
<CAKJS1f_CrjvGYExtmzYzzUnD9XzcbFpo6R_FON2hewSHpqM1xg@mail.gmail.com>
David Rowley <david.rowley@2ndquadrant.com> writes:
> On 29 July 2018 at 17:38, Dinesh Kumar <dns98944@gmail.com> 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.
regards, tom lane
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: tgl@sss.pgh.pa.us, david.rowley@2ndquadrant.com, dns98944@gmail.com
Subject: Re: Performance difference in accessing differrent columns in a Postgres Table
In-Reply-To: <16506.1532905259@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox