Re: Caching number of blocks in relation to avoi lseek.

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Denis Perchine <dyp(at)perchine(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Caching number of blocks in relation to avoi lseek.
Date: 2000-06-12 18:05:45
Message-ID: 200006121805.OAA05626@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

> Hello all,
>
> While digging the code I found out quite interesting comment in
> src/backend/access/heap/hio.c before function RelationPutHeapTupleAtEnd
>
> * Eventually, we should cache the number of blocks in a relation somewhere.
> * Until that time, this code will have to do an lseek to determine the number
> * of blocks in a relation.
>
> As far as I can see there's field rd_nblocks in Relation.
>
> Question: is this field properly updated? Could it be used instead of RelationGetNumberOfBlocks
> which calls lseek.

Probably should be kept up-to-date. Currently only vacuum sets it. It
would have to be kept up-to-date for every INSERT/UPDATE that adds a block.

--
Bruce Momjian | http://www.op.net/~candle
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Denis Perchine 2000-06-12 18:11:39 Re: Caching number of blocks in relation to avoi lseek.
Previous Message Denis Perchine 2000-06-12 17:47:21 Re: Patch for 'Not to stuff everything as files in a single directory, hash dirs'

Browse pgsql-patches by date

  From Date Subject
Next Message Denis Perchine 2000-06-12 18:11:39 Re: Caching number of blocks in relation to avoi lseek.
Previous Message Bruce Momjian 2000-06-12 18:04:51 Re: Patch for better large objects support