Re: Performance difference in accessing differrent columns in a Postgres Table

From: Tom Lane
Subject: Re: Performance difference in accessing differrent columns in a Postgres Table
Date: ,
Msg-id: 16506.1532905259@sss.pgh.pa.us
(view: Whole thread, Raw)
In response to: Re: Performance difference in accessing differrent columns in aPostgres Table  (David Rowley)
Responses: Re: Performance difference in accessing differrent columns in aPostgres Table  (Pavel Stehule)
List: pgsql-performance

Tree view

Performance difference in accessing differrent columns in a Postgres Table  (Dinesh Kumar, )
 Re: Performance difference in accessing differrent columns in aPostgres Table  (David Rowley, )
  Re: Performance difference in accessing differrent columns in a Postgres Table  (Tom Lane, )
   Re: Performance difference in accessing differrent columns in aPostgres Table  (Pavel Stehule, )
    Re: Performance difference in accessing differrent columns in aPostgres Table  (Jeff Janes, )
     Re: Performance difference in accessing differrent columns in aPostgres Table  (Pavel Stehule, )
      Re: Performance difference in accessing differrent columns in aPostgres Table  (Jeff Janes, )
       Re: Performance difference in accessing differrent columns in aPostgres Table  (Andres Freund, )
        Re: Performance difference in accessing differrent columns in aPostgres Table  (Jeff Janes, )
         Re: Performance difference in accessing differrent columns in aPostgres Table  (Dinesh Kumar, )
          Re: Performance difference in accessing differrent columns in aPostgres Table  (Jeff Janes, )
           Re: Performance difference in accessing differrent columns in aPostgres Table  (Jeff Janes, )
            Re: Performance difference in accessing differrent columns in aPostgres Table  (Dinesh Kumar, )
      Re: Performance difference in accessing differrent columns in aPostgres Table  (Andres Freund, )
     Re: Performance difference in accessing differrent columns in aPostgres Table  (Andres Freund, )
      Re: Performance difference in accessing differrent columns in aPostgres Table  (Jeff Janes, )
       Re: Performance difference in accessing differrent columns in aPostgres Table  (Andres Freund, )

David Rowley <> writes:
> On 29 July 2018 at 17:38, Dinesh Kumar <> 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



pgsql-performance by date:

From: Pavel Stehule
Date:
Subject: Re: Performance difference in accessing differrent columns in aPostgres Table
From: Jeff Janes
Date:
Subject: Re: Performance difference in accessing differrent columns in aPostgres Table