Re: Eliminating PD_ALL_VISIBLE, take 2

Поиск
Список
Период
Сортировка
От Jeff Davis
Тема Re: Eliminating PD_ALL_VISIBLE, take 2
Дата
Msg-id 1373055512.5630.23.camel@jdavis
обсуждение исходный текст
Ответ на Re: Eliminating PD_ALL_VISIBLE, take 2  (Jeff Davis <pgsql@j-davis.com>)
Ответы Re: Eliminating PD_ALL_VISIBLE, take 2  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
On Tue, 2013-07-02 at 10:12 -0700, Jeff Davis wrote:
> Regardless, this is at least a concrete issue that I can focus on, and I
> appreciate that. Are scans of small tables the primary objection to this
> patch, or are there others? If I solve it, will this patch make real
> progress?

I had an idea here:

What if we keep PD_ALL_VISIBLE, but make it more like other hints, and
make it optional? If a page is all visible, either or both of the VM bit
or PD_ALL_VISIBLE could be set (please suspend disbelief for a moment).

Then, we could use a heuristic, like setting PD_ALL_VISIBLE in the first
256 pages of a relation; but in later pages, only setting it if the page
is already dirty for some other reason.

That has the following benefits:

1. Eliminates the worry over contention related to scans, because we
wouldn't need to use the VM for small tables. And I don't think anyone
was worried about using the VM on a large table scan.

2. Still avoids dirtying lots of pages after a data load. I'm not
worried if a few MB of data is rewritten on a large table.

3. Eliminates the complex way in which we (ab)use WAL and the recovery
mechanism to keep PD_ALL_VISIBLE and the VM bit in sync.

Of course, there's a reason that PD_ALL_VISIBLE is not like a normal
hint: we need to make sure that inserts/updates/deletes clear the VM
bit. But my patch already addresses that by keeping the VM page pinned.

That has some weaknesses: as Heikki pointed out[1], you can defeat the
cache of the pin by randomly seeking between 512MB regions during an
update (would only be noticable if it's all in shared buffers already,
of course). But even in that case, it was a fairly modest degradation
(20%), so overall this seems like a fairly minor drawback.

Thoughts?

Regards,Jeff Davis

[1] http://www.postgresql.org/message-id/50FD11C5.1030700@vmware.com





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

Предыдущее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: Millisecond-precision connect_timeout for libpq
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: Review: query result history in psql