Re: Way to check whether a particular block is on the shared_buffer?

Поиск
Список
Период
Сортировка
От Jim Nasby
Тема Re: Way to check whether a particular block is on the shared_buffer?
Дата
Msg-id 56AF6F11.4030004@BlueTreble.com
обсуждение исходный текст
Ответ на Way to check whether a particular block is on the shared_buffer?  (Kouhei Kaigai <kaigai@ak.jp.nec.com>)
Ответы Re: Way to check whether a particular block is on the shared_buffer?  (Kouhei Kaigai <kaigai@ak.jp.nec.com>)
Список pgsql-hackers
On 1/31/16 7:38 PM, Kouhei Kaigai wrote:
> I'm under investigation of SSD-to-GPU direct feature on top of
> the custom-scan interface. It intends to load a bunch of data
> blocks on NVMe-SSD to GPU RAM using P2P DMA, prior to the data
> loading onto CPU/RAM, to preprocess the data to be filtered out.
> It only makes sense if the target blocks are not loaded to the
> CPU/RAM yet, because SSD device is essentially slower than RAM.
> So, I like to have a reliable way to check the latest status of
> the shared buffer, to kwon whether a particular block is already
> loaded or not.

That completely ignores the OS cache though... wouldn't that be a major
issue?

To answer your direct question, I'm no expert, but I haven't seen any
functions that do exactly what you want. You'd have to pull relevant
bits from ReadBuffer_*. Or maybe a better method would just be to call
BufTableLookup() without any locks and if you get a result > -1 just
call the relevant ReadBuffer function. Sometimes you'll end up calling
ReadBuffer even though the buffer isn't in shared buffers, but I would
think that would be a rare occurrence.
-- 
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com



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

Предыдущее
От: Jim Nasby
Дата:
Сообщение: Re: WAL Re-Writes
Следующее
От: Jim Nasby
Дата:
Сообщение: Re: statistics for shared catalogs not updated when autovacuum is off