Skip site navigation (1) Skip section navigation (2)

Re: Cache last known per-tuple offsets to speed long tuple

From: a_ogawa <a_ogawa(at)hi-ho(dot)ne(dot)jp>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: Cache last known per-tuple offsets to speed long tuple
Date: 2004-10-31 14:29:37
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-patches
Thank you for advice.
I am going to remake a patch, in order to make it simple.
The plan of a new patch is as follows.

(1)Add fields to TupleTableSlot and TupleTableData.
This fields are for holding the tuple disassembly information.

(2)Add the codes which initializes/cleans new  fields.
These codes are added to execTuples.c.

(3)Add two functions to execQual.c.
One function is just like heap_deformtuple. It is given a 
TupleTableSlot. And it extracts the field of tuple incrementary
using the new fields of TupleTableSlot.

The meaning of incrementary is as the following example.
Example: The tupple has 100 columns.
 - first call to get col5 will fill first 5 positions in the array.
 - next call to get col75 will fill starts from 5 and up to 75.
 - next call to get col60 will only refer to array, because 
   already extracted.

Another function is just like heap_getattr and fast_getattr.
It is given a TupleTableSlot. And this function uses new
function(like a heap_deformtuple), instead of nocachegetattr.

(4)ExecEvalVar uses new function(like a heap_getattr) instead of 

With a new patch, only three files of tuptable.h, and execTuple.c
and execQual.c are due to be changed.

> BTW, why is it that your profile shows *more* calls to
> heap_deformtuple_incr after the patch than there were nocachegetattr
> calls before? 

Many one is for printtup. 
(printtup -> heap_deformtuple -> heap_deformtuple_incr)
Since the code of heap_deformtuple and heap_deformtuple_incr has been 
share, heap_deformtuple_incr looks many calls than nocachegetattr.

If a part for the number of calls of heap_deformtuple_incr 
by printtup is removed, heap_deformtuple_incr and nocachegetattr 
will be the same number of calls.

With my test being to access the column in ascending order
(select t100, t110 ...), heap_deformtuple_incr and nocachegetattr 
is the same calls.
If the column is accessed in descending order(select t200, t190...),
number of calls of heap_deformtuple_incr will decrease sharply. 
It is because a result is cached by the first call to get t200.


--- Atsushi Ogawa

In response to

pgsql-patches by date

Next:From: Gaetano MendolaDate: 2004-11-01 01:11:45
Subject: Re: [PATCHES] [HACKERS] ARC Memory Usage analysis
Previous:From: Bruce MomjianDate: 2004-10-31 02:48:24
Subject: Re: Win32 open items

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group