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

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: Caching number of blocks in relation to avoi lseek.
Дата
Msg-id 200006121805.OAA05626@candle.pha.pa.us
обсуждение исходный текст
Ответ на Caching number of blocks in relation to avoi lseek.  (Denis Perchine <dyp@perchine.com>)
Ответы Re: Caching number of blocks in relation to avoi lseek.  (Denis Perchine <dyp@perchine.com>)
Re: Caching number of blocks in relation to avoi lseek.  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
> 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@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Denis Perchine
Дата:
Сообщение: Re: Patch for 'Not to stuff everything as files in a single directory, hash dirs'
Следующее
От: Denis Perchine
Дата:
Сообщение: Re: Caching number of blocks in relation to avoi lseek.